[Mono-devel-list] Mono vs. MS CLR typecast Incompatibility

Twede, Roger S roger.twede at hp.com
Thu Sep 16 12:19:44 EDT 2004

After building some GUI apps using Microsoft Studio and C# we were
encouraged to find how easily they compiled for the Mono CLR, however,
the runtime experience has exposed some incompatibility.

The following line is an example of the problem:

this.largeImageList.ImageStream =

The System.Resources.ResourceManager(type) class appears to look up
resources in the assemblies fine and the GetObject() call will return a
System.String which contains the base64 raw representation of the
object's data.

However, the typecast of the System.String returned by GetObject()

Unhandled Exception: System.InvalidCastException: Cannot cast from
source type to destination type.

Apparently a string cannot be cast to an ImageListStreamer in Mono,
however the MS tools emitted this code and it compiles and runs fine one
the MS CLR.

Any help that can be provided would be appreciated.


Roger Twede

More information about the Mono-devel-list mailing list