TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
jmiller808
NA
4
0
Unable to load one or more of the requested types
Aug 18 2008 11:59 AM
I am running into an interesting problem when using Assembly.GetTypes(). When im debugging my application through visual studio, everything works great. When i run it on another computer that does not have visual studio installed it is throwing this error: "Unable to load one or more of the requested types"
The code that is having a problem performs a search on the assemblies and looks for any classes that inherit from a specified base class. When a class is found, an instance is created and its execution function is called. Here is the code that is causing the problem.
foreach(System.Reflection.Assembly oasm in AppDomain.CurrentDomain.GetAssemblies())
{
iType = 0;
Type[] aTypes = oasm.GetTypes(); // this line throws the exception
// loop through all types to look for a class inheriting from CDistributionBase
while (iType <= aTypes.Length - 1)
{
// if Type inherits from CDistributionBase, create instance and execute its StatusUpdate method
if (aTypes[iType].BaseType == typeof(SSLib.Fulfillment.CDistributionBase))
{
odistrib = (SSLib.Fulfillment.CDistributionBase)Activator.CreateInstance(aTypes[iType]);
odistrib.StatusUpdate();
odistrib = null;
}
iType++;
}
}
if anyone has any insight as to why this would work on my dev computer and not on my test computer, i would greatly appreciate it!
Thanks,
Josh Miller
Reply
Answers (
0
)
Read selected text from current active window
Help with saving images