[Mono-bugs] [Bug 449492] New: OnDeserializationAttribute incompatible with List<> or

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Wed Nov 26 18:06:47 EST 2008


https://bugzilla.novell.com/show_bug.cgi?id=449492


           Summary: OnDeserializationAttribute incompatible with List<> or
           Product: Mono: Class Libraries
           Version: 2.0.x
          Platform: i686
        OS/Version: Mac OS X 10.5
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: System
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: M8R-2yr72d at mailinator.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


Created an attachment (id=255980)
 --> (https://bugzilla.novell.com/attachment.cgi?id=255980)
Test case

Description of Problem:
When a class has a method with an OnDeserializationAttribute and a member that
is a System.Collections.Generic.List of custom types, it cannot be
deserialized.

Steps to reproduce the problem:
1. Compile and run the attached code.

Actual Results:
Unhandled Exception: System.ArgumentException: method return type is
incompatible
  at System.Delegate.CreateDelegate (System.Type type, System.Object
firstArgument, System.Reflection.MethodInfo method, Boolean throwOnBindFailure)
[0x00266] in
/private/tmp/monobuild/build/BUILD/mono-2.0.1/mcs/class/corlib/System/Delegate.cs:251 
  at System.Delegate.CreateDelegate (System.Type type, System.Object
firstArgument, System.Reflection.MethodInfo method) [0x00000] in
/private/tmp/monobuild/build/BUILD/mono-2.0.1/mcs/class/corlib/System/Delegate.cs:255 
  at System.Runtime.Serialization.SerializationCallbacks.Invoke
(System.Collections.ArrayList list, System.Object target, StreamingContext
context) [0x00021] in
/private/tmp/monobuild/build/BUILD/mono-2.0.1/mcs/class/corlib/System.Runtime.Serialization/SerializationCallbacks.cs:110 
  at System.Runtime.Serialization.SerializationCallbacks.RaiseOnDeserialized
(System.Object target, StreamingContext contex) [0x00000] in
/private/tmp/monobuild/build/BUILD/mono-2.0.1/mcs/class/corlib/System.Runtime.Serialization/SerializationCallbacks.cs:136 
  at System.Runtime.Serialization.ObjectManager.RaiseOnDeserializedEvent
(System.Object obj) [0x0000c] in
/private/tmp/monobuild/build/BUILD/mono-2.0.1/mcs/class/corlib/System.Runtime.Serialization/ObjectManager.cs:186 
  at System.Runtime.Serialization.ObjectManager.RaiseDeserializationEvent ()
[0x00025] in
/private/tmp/monobuild/build/BUILD/mono-2.0.1/mcs/class/corlib/System.Runtime.Serialization/ObjectManager.cs:162 
  at System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadNextObject
(System.IO.BinaryReader reader) [0x0001a] in
/private/tmp/monobuild/build/BUILD/mono-2.0.1/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/ObjectReader.cs:117 
  at
System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadObjectGraph
(System.IO.BinaryReader reader, Boolean readHeaders, System.Object& result,
System.Runtime.Remoting.Messaging.Header[]& headers) [0x00041] in
/private/tmp/monobuild/build/BUILD/mono-2.0.1/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/ObjectReader.cs:99 
  at
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.NoCheckDeserialize
(System.IO.Stream serializationStream,
System.Runtime.Remoting.Messaging.HeaderHandler handler) [0x00076] in
/private/tmp/monobuild/build/BUILD/mono-2.0.1/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/BinaryFormatter.cs:177 
  at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize
(System.IO.Stream serializationStream) [0x00000] in
/private/tmp/monobuild/build/BUILD/mono-2.0.1/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/BinaryFormatter.cs:134 
  at Program.Main (System.String[] args) [0x00024] in
/Users/cgames/Projects/cbots/test.cs:28 

Expected Results:
Test Succeeded

How often does this happen? 
The problem is independent of:
 * Whether or not SerializedType.Test is marked with a SerializableAttribute
 * The access level of SerializedType.Test
 * The access level of SerializedType.test
 * The access level of SerializedType.OnDeserialized

The problem goes away if:
 * No method is marked with OnDeserializationAttribute
 * SerializedType.test is changed to List<object>

Additional Information:
$ mono --version
Mono JIT compiler version 2.0.1 (tarball)
Copyright (C) 2002-2008 Novell, Inc and Contributors. www.mono-project.com
        TLS:           normal
        GC:            Included Boehm (with typed GC)
        SIGSEGV:       normal
        Notification:  Thread + polling
        Architecture:  x86
        Disabled:      none


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list