[mono-android] Being driven insane....

Jonathan Pryor jonp at xamarin.com
Thu Feb 16 16:37:40 UTC 2012


On Feb 15, 2012, at 6:33 PM, Andrew Sinclair wrote:
> It seems as though during the re-start some of the assemblies that are usually "hanging around" (technical term) aren't there. So code like:
> 
> string typeName = "XmlElement";
> Type type = GetType(typeName);
> XmlSerializer s = new XmlSerializer(type);
> 
> would fail.

What I find odd is that this never should have worked in the first place. Type.GetType() is defined as only looking in the current executing assembly and mscorlib.dll, _not_ every assembly loaded into the AppDomain:

	http://msdn.microsoft.com/en-us/library/w3f99sx1.aspx

	Parameters: typeName: If the type is in the currently executing assembly or in Mscorlib.dll, it is sufficient to supply the type name qualified by its namespace.

Short testing with `csharp` confirms this behavior...in csharp:

> $ csharp -r:System.Xml.dll
> Mono C# Shell, type "help;" for help
> 
> Enter statements below.
> csharp> Type.GetType("System.Xml.XmlElement");
> null
> csharp> Type.GetType("System.Xml.XmlElement, System.Xml");
> System.Xml.XmlElement

I haven't tried this in a Mono for Android app, but I'd be shocked if it was any different.

 - Jon



More information about the Monodroid mailing list