The following code

Type t = Type.GetType("System.Drawing.RotateFlipType", True);

always throws an exception:

An unhandled exception of type 'System.TypeLoadException' occurred in
WindowsApplication1.exe

Additional information: Could not load type System.Drawing.RotateFlipType
from assembly WindowsApplication1, Version=1.0.1693.20837, Culture=neutral,
PublicKeyToken=null.

Re: Why System.Type.GetType fails on Enum types? by Imran

Imran
Thu Aug 19 23:35:40 CDT 2004

Well, its not got to do with enum types since I could get the Type for enums
like say System.Reflection.BindingFlags and others. I could also get the
type by doing:

Dim eFlipType as System.Drawing.RotateFlipType
Dim t as Type = eFlipType.GetType()

which worked fine. I couldn't get the the case you mentioned to work. In
fact, try getting the type for any of the objects in the System.Drawing
namespace (or any namespace within System.Drawing) using
Type.GetType(String) or any of its versions and you'll blow up (well,
atleast I did). This is most likely a bug since its working for all other
types in other namespaces. I could very well be wrong though. You might want
to verify if this is also happening in your case.

Imran.

"Neo The One" <NeoTheOne@discussions.microsoft.com> wrote in message
news:5868C5DA-B752-4813-B5C5-DF466D6803D6@microsoft.com...
> The following code
>
> Type t = Type.GetType("System.Drawing.RotateFlipType", True);
>
> always throws an exception:
>
> An unhandled exception of type 'System.TypeLoadException' occurred in
> WindowsApplication1.exe
>
> Additional information: Could not load type System.Drawing.RotateFlipType
> from assembly WindowsApplication1, Version=1.0.1693.20837,
> Culture=neutral,
> PublicKeyToken=null.
>



Re: Why System.Type.GetType fails on Enum types? by Mattias

Mattias
Fri Aug 20 06:28:18 CDT 2004

Imran,

>This is most likely a bug since its working for all other
>types in other namespaces.

No it isn't. The docs for Type.GetType clearly states that you must
supply the assembly name where the type is implemented, unless it's in
Mscorlib.dll or the calling assembly. This should work:

Type.GetType("System.Drawing.RotateFlipType, System.Drawing,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")



Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.

Re: Why System.Type.GetType fails on Enum types? by Imran

Imran
Fri Aug 20 07:58:36 CDT 2004

Oops..you're right. thanks for pointing that out.
As I also mentioned, I could very well be wrong :)

"Mattias Sjögren" <mattias.dont.want.spam@mvps.org> wrote in message
news:OgB1IjqhEHA.3076@tk2msftngp13.phx.gbl...
> Imran,
>
> >This is most likely a bug since its working for all other
> >types in other namespaces.
>
> No it isn't. The docs for Type.GetType clearly states that you must
> supply the assembly name where the type is implemented, unless it's in
> Mscorlib.dll or the calling assembly. This should work:
>
> Type.GetType("System.Drawing.RotateFlipType, System.Drawing,
> Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
>
>
>
> Mattias
>
> --
> Mattias Sjögren [MVP] mattias @ mvps.org
> http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
> Please reply only to the newsgroup.