[Mono-dev] Issues with System.Random

Robert Jordan robertj at gmx.net
Wed Mar 17 17:39:22 EDT 2010


On 17.03.2010 18:31, Adrian Willenbücher wrote:
> Robert Jordan wrote:
>> Implementing an interface is a breaking change of the API. That's
>> why Konél was mentioning OnDeserializedAttribute.
> Thanks for the info, I didn't know that (I'm pretty new to C#, Mono
> and .NET). The only alternative I could come up with is this:

Looks good.

> It's not very beautiful, but seems to work. I couldn't use

Code for serialization compatibility is always looking weird :)

> [NonSerialized] on the three legacy fields because that results in an
> exception complaining about "inext not in class System.Random" when
> loading an old serialized object.

The complaint is caused by a bug in Mono's deserialializer.

Please enclose these fields with

#pragma warning disable 169
#pragma warning restore 169

to get rid of the compiler warnings.


More information about the Mono-devel-list mailing list