A
Aberro-Bill
Hi All,
I have code that loads a strongly named assembly using "Assembly.LoadFrom()"
and then finds all the types in the assembly using "GetTypes()". The code
has worked flawlessly in .NET 1.1 both on a development box and a clean box.
With .NET 2 it works on a development box, but NOT a clean box (XP pro, SP
2, .NET 1.1 and 2, all updates to this date). If I install the .NET 2 SDK
on my clean box it will work.
When it fails the message lists all the types in the assembly, so I know the
assembly loaded.
Why does this work on a development box or a box with the .NET 2 SDK, but
not a clean box?
What do I do to make it work on a clean box?
Thanks,
Bill
Here is a code snippet:
Assembly MyAssembly = Assembly.LoadFrom( FileName );
Type[] MyTypes = null;
try
{
MyTypes = MyAssembly.GetTypes();
}
catch (ReflectionTypeLoadException ex)
{
string msg = "";
foreach (Exception e in ex.LoaderExceptions)
{
if (e.Message != null) msg += e.Message + Environment.NewLine;
}
msg = "GetMyTypes() threw a TypeLoadException" + Environment.NewLine +
msg;
MessageBox.Show( msg );
}
I have code that loads a strongly named assembly using "Assembly.LoadFrom()"
and then finds all the types in the assembly using "GetTypes()". The code
has worked flawlessly in .NET 1.1 both on a development box and a clean box.
With .NET 2 it works on a development box, but NOT a clean box (XP pro, SP
2, .NET 1.1 and 2, all updates to this date). If I install the .NET 2 SDK
on my clean box it will work.
When it fails the message lists all the types in the assembly, so I know the
assembly loaded.
Why does this work on a development box or a box with the .NET 2 SDK, but
not a clean box?
What do I do to make it work on a clean box?
Thanks,
Bill
Here is a code snippet:
Assembly MyAssembly = Assembly.LoadFrom( FileName );
Type[] MyTypes = null;
try
{
MyTypes = MyAssembly.GetTypes();
}
catch (ReflectionTypeLoadException ex)
{
string msg = "";
foreach (Exception e in ex.LoaderExceptions)
{
if (e.Message != null) msg += e.Message + Environment.NewLine;
}
msg = "GetMyTypes() threw a TypeLoadException" + Environment.NewLine +
msg;
MessageBox.Show( msg );
}