Hi,


We have an application that generates .NET assembly DLLs at runtime and
executes them. It normally generates the assembly DLL once per user task and
any time the same user task is done again it simply loads the already
existing DLL and executes it.

We are using the .NET Code DOM to compile the .NET DLLs and then using
reflection to call them.

This is working fine in .NET 1.1, however on a machine with .NET 2.0
installed we are getting different behaviour.



The code does the following:

            Call Assembly.LoadFrom() to determine if DLL is generated

            If (call Failed)

{

                        Generate DLL and save to hard disk

                        Get Assembly from CompilerResults.CompiledAssembly

            }

            Execute method on generated Assembly DLL



When using .NET 2.0 the Assembly.LoadFrom() call fails correctly the first
time and then generates the DLL successfully. However, the assignment of
CompilerResults.CompiledAssembly fails even though the DLL is now created.
Any further calls to Assembly.LoadFrom() for the same DLL in the same
process also fail, they return the error "Failed to load DLL or one of it's
dependencies".

However, when I then stop and start the process the Assembly.LoadFrom()
calls work.



It seems that the fact that the first Assembly.LoadFrom() call failed is
cached in the current process and any subsequent calls to load the same DLL
automatically fail.

Is this a change in .NET 2.0?

Is there a way around this?



Thanks for any help you can give,

                                    Charles Gamble.









________________________________________________________________________
This e-mail has been scanned for all viruses by MessageLabs.
________________________________________________________________________

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to