Im not sure if the behavior changed, you may already be aware of this, but it 
may help to turn on fusion logging:
HKLM\Software\Microsoft\Fusion
DWORD EnableLog=1
you can also run fuslogvw from a vs command prompt


-----Original Message-----
From: Charles Gamble <[EMAIL PROTECTED]>
Sent: Fri, 07 July 2006 14:12:26
To: [email protected]
Subject: [ADVANCED-DOTNET] Assembly.LoadFrom failing in .NET 2.0

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

-------------------------------------------------
 Sent using http://www.DWmail.net, a free service
 Check your email [any email, anytime, anywhere]
-------------------------------------------------
Disclaimer: DWmail.net is not responsible for the content sent via it's 
services.  Additional header information is included regarding the source of an 
email.  If you believe an email is junk you should look for the 'Originating 
IP' message header

===================================
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