NotSupportedException Type.GetType (String, Boolean, Boolean)

J

jonfroehlich

When running the following code in the SmartPhone 2005 emulator, I get
a NotSupportedException at the third line.

Type type1 = Type.GetType("System.DateTime");
Type type2 = Type.GetType("System.DateTime",true);
Type type3 = Type.GetType("System.DateTime",true,true);

I am using C# for .NET CF 2.0. The exact exception is:

System.NotSupportedException was unhandled
Message="NotSupportedException"
StackTrace:
at System.RuntimeType.GetTypeImpl()
at System.Type.GetType()
at PhoneTest.Form1.menuItem1_Click()
at System.Windows.Forms.MenuItem.OnClick()
at System.Windows.Forms.Menu.ProcessMnuProc()
at System.Windows.Forms.Form.WnProc()
at System.Windows.Forms.Control._InternalWnProc()
at Microsoft.AGL.Forms.EVL.EnterMainLoop()
at System.Windows.Forms.Application.Run()
at PhoneTest.Program.Main()

Note that the Microsoft Visual Studio 2005 documentation states that
all four of the Type.GetType methods are "supported by the .NET Compact
Framework." Anyone know what gives?

Thanks,

j
 
D

Daniel Moth

I haven't checked the documentation but if you read that then it is clearly
wrong as the runtime behaviour clearly tells you it is unsupported (ignoring
the case).

If someone was to make an "investigative" "guess" at what the source code
looks like for that method they "may" come up with something like this:
if (ignoreCase)
{
if (throwOnError)
{
throw new NotSupportedException();
}
return null;
}

Cheers
Daniel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top