[SecurityPermission(SecurityAction.Assert, SerializationFormatter = true)]          // FIXME: to be reviewed
        internal static object DeserializeCallData(byte[] array)
        {
            if (array == null)
            {
                return(null);
            }

            MemoryStream ms = new MemoryStream(array);
            object       obj;

            lock (_deserializationFormatter) {
                obj = _deserializationFormatter.Deserialize(ms);
            }

            if (obj is CACD)
            {
                CACD cad = (CACD)obj;
                obj = cad.d;

                var lcc = (LogicalCallContext)cad.c;
                if (lcc.HasInfo)
                {
                    Thread.CurrentThread.GetMutableExecutionContext().LogicalCallContext.Merge(lcc);
                }
            }
            return(obj);
        }
Example #2
0
        [SecurityPermission(SecurityAction.Assert, SerializationFormatter = true)]          // FIXME: to be reviewed
        internal static object DeserializeCallData(byte[] array)
        {
            if (array == null)
            {
                return(null);
            }

            MemoryStream ms  = new MemoryStream(array);
            object       obj = _deserializationFormatter.Deserialize(ms);

            if (obj is CACD)
            {
                CACD cad = (CACD)obj;
                obj = cad.d;
                CallContext.UpdateCurrentCallContext((LogicalCallContext)cad.c);
            }
            return(obj);
        }
Example #3
0
        [SecurityPermission(SecurityAction.Assert, SerializationFormatter = true)]          // FIXME: to be reviewed
        internal static byte[] SerializeCallData(object obj)
        {
            var ctx = Thread.CurrentThread.GetExecutionContextReader().LogicalCallContext;

            if (!ctx.IsNull)
            {
                CACD cad = new CACD();
                cad.d = obj;
                cad.c = ctx.Clone();
                obj   = cad;
            }

            if (obj == null)
            {
                return(null);
            }
            MemoryStream ms = new MemoryStream();

            _serializationFormatter.Serialize(ms, obj);
            return(ms.ToArray());
        }
Example #4
0
        [SecurityPermission(SecurityAction.Assert, SerializationFormatter = true)]          // FIXME: to be reviewed
        internal static byte[] SerializeCallData(object obj)
        {
            LogicalCallContext ctx = CallContext.CreateLogicalCallContext(false);

            if (ctx != null)
            {
                CACD cad = new CACD();
                cad.d = obj;
                cad.c = ctx;
                obj   = cad;
            }

            if (obj == null)
            {
                return(null);
            }
            MemoryStream ms = new MemoryStream();

            _serializationFormatter.Serialize(ms, obj);
            return(ms.ToArray());
        }
Example #5
0
		[SecurityPermission (SecurityAction.Assert, SerializationFormatter = true)] // FIXME: to be reviewed
		internal static byte[] SerializeCallData (object obj)
		{
			LogicalCallContext ctx = CallContext.CreateLogicalCallContext (false);
			if (ctx != null) {
				CACD cad = new CACD ();
				cad.d = obj;
				cad.c = ctx;
				obj = cad;
			}
			
			if (obj == null) return null;
			MemoryStream ms = new MemoryStream ();
			_serializationFormatter.Serialize (ms, obj);
			return ms.ToArray ();
		}
Example #6
0
		[SecurityPermission (SecurityAction.Assert, SerializationFormatter = true)] // FIXME: to be reviewed
		internal static byte[] SerializeCallData (object obj)
		{
			var ctx = Thread.CurrentThread.GetExecutionContextReader().LogicalCallContext;
			if (!ctx.IsNull) {
				CACD cad = new CACD ();
				cad.d = obj;
				cad.c = ctx.Clone ();
				obj = cad;
			}
			
			if (obj == null) return null;
			MemoryStream ms = new MemoryStream ();
			_serializationFormatter.Serialize (ms, obj);
			return ms.ToArray ();
		}