internal override IntPtr ToNative(PinCollection pinCollection) { string reasonToSendBack = null; if (ChaosUtility.DisableOptimizationForValidationFailedEvent) { reasonToSendBack = ChaosUtility.Decompress(this.reason); if (reasonToSendBack.Length > ChaosConstants.StringLengthLimit) { reasonToSendBack = reasonToSendBack.Substring(0, ChaosConstants.StringLengthLimit); } } else { reasonToSendBack = this.reason; } var nativeValidationFailedEvent = new NativeTypes.FABRIC_VALIDATION_FAILED_EVENT { TimeStampUtc = NativeTypes.ToNativeFILETIME(this.TimeStampUtc), Reason = pinCollection.AddObject(reasonToSendBack) }; return(pinCollection.AddBlittable(nativeValidationFailedEvent)); }
internal override IntPtr ToNative(PinCollection pinCollection) { string reasonToSendBack = null; if (ChaosUtility.DisableOptimizationForValidationFailedEvent) // not compressed { reasonToSendBack = ChaosUtility.Decompress(this.reason); if (reasonToSendBack.Length > ChaosConstants.StringLengthLimit) { reasonToSendBack = reasonToSendBack.Substring(0, ChaosConstants.StringLengthLimit); } reasonToSendBack = ChaosUtility.MakeLengthNotMultipleOfFour(reasonToSendBack); } else { reasonToSendBack = this.reason; } var nativeTestErrorEvent = new NativeTypes.FABRIC_TEST_ERROR_EVENT { TimeStampUtc = NativeTypes.ToNativeFILETIME(this.TimeStampUtc), Reason = pinCollection.AddObject(reasonToSendBack) }; return(pinCollection.AddBlittable(nativeTestErrorEvent)); }
internal static unsafe WaitingEvent FromNative(IntPtr nativeRaw) { if (nativeRaw == IntPtr.Zero) { return(null); } var native = *(NativeTypes.FABRIC_WAITING_EVENT *)nativeRaw; var timeStamp = NativeTypes.FromNativeFILETIME(native.TimeStampUtc); var reason = ChaosUtility.Decompress(NativeTypes.FromNativeString(native.Reason)); return(new WaitingEvent(timeStamp, reason)); }
internal static unsafe ValidationFailedEvent FromNative(IntPtr nativeRaw) { if (nativeRaw == IntPtr.Zero) { return(null); } var native = *(NativeTypes.FABRIC_VALIDATION_FAILED_EVENT *)nativeRaw; var timeStamp = NativeTypes.FromNativeFILETIME(native.TimeStampUtc); var reason = ChaosUtility.Decompress(NativeTypes.FromNativeString(native.Reason)); return(new ValidationFailedEvent(timeStamp, reason)); }
internal static unsafe TestErrorEvent FromNative(IntPtr nativeRaw) { if (nativeRaw == IntPtr.Zero) { return(null); } NativeTypes.FABRIC_TEST_ERROR_EVENT native = *(NativeTypes.FABRIC_TEST_ERROR_EVENT *)nativeRaw; var timeStamp = NativeTypes.FromNativeFILETIME(native.TimeStampUtc); var reason = ChaosUtility.Decompress(NativeTypes.FromNativeString(native.Reason)); return(new TestErrorEvent(timeStamp, reason)); }