Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / February 2006

Tip: Looking for answers? Try searching our database.

System.Reflection.ReflectionTypeLoadException in Windows Service

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Zach - 10 Feb 2006 17:38 GMT
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
Dmytro Lapshyn [MVP] - 13 Feb 2006 12:42 GMT
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.

> Hello!
>
[quoted text clipped - 27 lines]
>
> Zach

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.