[Mono-devel-list] Mono vs. MS CLR typecast Incompatibility: Cannot cast from source type to destination type.

Twede, Roger S roger.twede at hp.com
Thu Sep 16 13:18:38 EDT 2004


It appears that a runtime type conversion incompatibility exists in mono
version 1.0.1.  The GUI app code we build using MS Studio runs fine on
the MS CLR, but causes an exception on the Mono CLR.

The following line is an example of the problem:

this.largeImageList.ImageStream =
(System.Windows.Forms.ImageListStreamer)
            (resources.GetObject("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()
generates:

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

Apparently a System.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.

Thanks,

Roger Twede





More information about the Mono-devel-list mailing list