[Mono-dev] Serialization issue with anonymous methods?
robertj at gmx.net
Thu Nov 16 11:33:51 EST 2006
Johan Hernandez wrote:
> Hi my name is Johan Hernandez(excuse me for my english). I was looking
> for a
> list of known issues for Mono 1.2 but I can't find it, so I will post my
> issue here. Please compile the attachments in this mail and run the
> sample. I got this Serialization error:
> "'MyApp.MainClass+<>c__CompilerGenerated1 is nor marked as serializable"
Gmcs' anonymous delegates implementation is different from
MS.NET. MS.NET seems to generate in this case a static method
in an existing class, while Mono generates a new anonymous class
with an instance member. Since anonymous classes are neither
marked as serializable nor derived from MarshalByRefObject,
their methods can't be passed as a delegate to events like
I'm not sure whether this issue of gmcs' anonymous delegates
implementation is actually a bug or rather an implementation
detail. Feel free to file a bug.
I'd rather not use anonymous delegates in this case, even on
MS.NET, because the code could be cease to work when the
implementation details of anonymous delegates are changed.
ps: Mono's ildasm is called 'monodis'.
More information about the Mono-devel-list