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));
        }
Exemple #2
0
        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));
        }
Exemple #3
0
        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));
        }
Exemple #5
0
        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));
        }