Hi!

DP itself uses an IObjectReference, calling info.SetType on the
provided SerializationInfo. When a proxy is deserialized, the CLR will
deserialize the ProxyObjectReference. That will re-create the proxy
type, then call the proxy's deserialization ctor (if it has any).

So, how would we support the ClassWithNoSerializationCtor in your
example if it doesn't have a deserialization ctor? I guess we could
allow classes to override the IObjectReference provided by DP, but
then things like the ProxyGenerationOptions wouldn't get deserialized
automatically.

Fabian

On Tue, Mar 3, 2009 at 2:35 PM, Krzysztof Koźmic
<[email protected]> wrote:
>
> Hi there,
>
> The issue DYNPROXY-ISSUE-85 was just created by Krzysztof Ko?mic (xtoff).
>
>        Key: DYNPROXY-ISSUE-85
>        Summary: False positive exception for serializable type with no 
> serialization constructor
>        Type: Bug
>        Importance: Low
>
>        Description:
>        The following tests fails with exception message saying that type is 
> not serializable while in fact, it is.
>        [Test]
>        public void SerializatingObjectsWithoutDefaultConstructor1()
>        {
>            var c = new ClassWithNoSerializationCtor { Property = "foo" };
>            var c1 = SerializeAndDeserialize( c );
>            Assert.AreEqual( "foo", c1.Property );
>            var proxy = 
> this.generator.CreateClassProxy<ClassWithNoSerializationCtor>();
>            var proxy2 = SerializeAndDeserialize(proxy);
>            Assert.AreEqual( "foo", proxy2.Property );
>        }
>    [Serializable]
>    public class ClassWithNoSerializationCtor : ISerializable
>    {
>        public string Property{ get; set;}
>        public void GetObjectData(SerializationInfo info, StreamingContext 
> context)
>        {
>            
> info.SetType(typeof(SerializableClassTestCase.ClassWithNoSerializationCtorReference));
>            info.AddValue("Property", Property);
>        }
>    }
>        [Serializable]
>        public class ClassWithNoSerializationCtorReference : IObjectReference, 
> ISerializable
>        {
>            private ClassWithNoSerializationCtor _item;
>            public ClassWithNoSerializationCtorReference(SerializationInfo 
> info, StreamingContext context)
>            {
>                _item = new ClassWithNoSerializationCtor();
>                _item.Property = info.GetString("Property");
>            }
>            public object GetRealObject(StreamingContext context)
>            {
>                return _item;
>            }
>            public void GetObjectData(SerializationInfo info, StreamingContext 
> context)
>            {
>            }
>        }
>
> For more, see 
> http://support.castleproject.org/projects/DYNPROXY/issues/view/DYNPROXY-ISSUE-85
>
>
> --
> donjon
> by Castle Stronghold
> http://www.castle-donjon.com
>
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Castle Project Development List" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/castle-project-devel?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to