PC Review
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Framework Forms
System.Reflection.ReflectionTypeLoadException in Windows Service
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Framework Forms
System.Reflection.ReflectionTypeLoadException in Windows Service
![]() |
System.Reflection.ReflectionTypeLoadException in Windows Service |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
Hello!
I'm experiencing this exception while attempting to examine the public types on my assembly DLL. Here is the code: Dim objType As Type Dim objDLL As Assembly objDLL = System.Reflection.Assembly.LoadFrom(pathToDLL) For each objType in objDLL.GetTypes <---- Exception is raised from GetTypes .... stuff Next The same code executes without a problem from a windows forms application, but not this Windows Service. When I examine the loaderexceptions property, it contains 1 System.TypeLoadException that simply states "Could not load type {myType} from Assembly {myAssembly}" etc. The Types array contains 1 RunTime type that contains a reference to a windows form that is a public member of my Assembly - which is why I bring the question to you. Is there a problem in general with loading windows forms types from an assembly while running within a Windows Service, or is there just some sort of dependency that isn't loading? Thanks for any assistance! Zach |
|
|
|
#2 |
|
Guest
Posts: n/a
|
Hello Zach,
> it contains 1 System.TypeLoadException that simply states "Could not load > type {myType} from Assembly {myAssembly}" etc. The Types array contains 1 > RunTime type that contains a reference to a windows form that is a public > member of my Assembly - which is why I bring the question to you. Actually, this might be a problem, if one of those Windows Form types contain a static constructor, and this constructor, in turn, attempts some interaction with the desktop. You might want to examine the InnerException property of the TypeLoadException you get - it might indicate the real underlying problem. "Zach" <Zach@discussions.microsoft.com> wrote in message news:10CEB384-7BA2-44C4-8146-9384CE13A170@microsoft.com... > Hello! > > I'm experiencing this exception while attempting to examine the public > types > on my assembly DLL. Here is the code: > > Dim objType As Type > Dim objDLL As Assembly > > objDLL = System.Reflection.Assembly.LoadFrom(pathToDLL) > > For each objType in objDLL.GetTypes <---- Exception is raised from > GetTypes > .... stuff > Next > > The same code executes without a problem from a windows forms application, > but not this Windows Service. When I examine the loaderexceptions > property, > it contains 1 System.TypeLoadException that simply states "Could not load > type {myType} from Assembly {myAssembly}" etc. The Types array contains 1 > RunTime type that contains a reference to a windows form that is a public > member of my Assembly - which is why I bring the question to you. Is > there a > problem in general with loading windows forms types from an assembly while > running within a Windows Service, or is there just some sort of dependency > that isn't loading? > > Thanks for any assistance! > > Zach > > > > |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

