Loading assembly from AppDomain not working anymore

G

Guest

I have a .NET 2.0 application divided in two assemblies; the exe and a dll.

The application generates a plugin-dll which is then loaded in a separate
AppDomain (along with a second instance of my application dll).

It's been working for months and now the it's not working from my
application exe anymore but still working from NUnit when testing the dll.

What could have changed in my exe? Some configuration thing in my VS2005
project?

The Fusion log from the failing load-attempt is dumped below and thereafter
a successful load from NUnit.

Notice the "Where-ref bind" in the failing attempt; C:\*** !!! - why is it
trying to load from there and not in the two directories setup in the
AppDomain?

Cheers,
Jan


****** FAILING LOAD ******

*** Assembly Binder Log Entry (08-02-2007 @ 16:37:48) ***

The operation failed.
Bind result: hr = 0x80070002. The system cannot find the file specified.

Assembly manager loaded from:
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll
Running under executable
D:\User\repos\MyApplication\trunk\Bin\SZStudio.vshost.exe
--- A detailed error log follows.

=== Pre-bind state information ===
LOG: User = SHIPMATE\JAJ
LOG: Where-ref bind. Location = C:\MyApplicationCore.dll
LOG: Appbase = file:///D:/User/repos/MyApplication/trunk/Bin
LOG: Initial PrivatePath = D:\User\repos\MyApplication\trunk\Bin\Runtime\
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = MyApplicationCore Runtime
Calling assembly : (Unknown).
===
LOG: This bind starts in LoadFrom load context.
WRN: Native image will not be probed in LoadFrom context. Native image will
only be probed in default load context, like with Assembly.Load().
LOG: No application configuration file found.
LOG: Using machine configuration file from
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Attempting download of new URL file:///C:/MyApplicationCore.dll.
LOG: All probing URLs attempted and failed.


****** WORKING - FROM NUnit ******

*** Assembly Binder Log Entry (08-02-2007 @ 16:57:00) ***

The operation was successful.
Bind result: hr = 0x0. The operation completed successfully.

Assembly manager loaded from:
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll
Running under executable C:\Program Files\NUnit-Net-2.0
2.2.8\bin\nunit-gui.exe
--- A detailed error log follows.

=== Pre-bind state information ===
LOG: User = SHIPMATE\JAJ
LOG: Where-ref bind. Location =
D:\User\repos\MyApplication\trunk\Bin\MyApplicationCore.dll
LOG: Appbase = file:///D:/User/repos/MyApplication/trunk/Bin
LOG: Initial PrivatePath = D:\User\repos\MyApplication\trunk\Bin\Runtime\
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = MyApplicationCore Runtime
Calling assembly : (Unknown).
===
LOG: This bind starts in LoadFrom load context.
WRN: Native image will not be probed in LoadFrom context. Native image will
only be probed in default load context, like with Assembly.Load().
LOG: Download of application configuration file was attempted from
file:///D:/User/repos/MyApplication/trunk/Bin/nunit-gui.exe.config.
LOG: Configuration file
D:\User\repos\MyApplication\trunk\Bin\nunit-gui.exe.config does not exist.
LOG: No application configuration file found.
LOG: Using machine configuration file from
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Attempting download of new URL
file:///D:/User/repos/MyApplication/trunk/Bin/MyApplicationCore.dll.
LOG: Assembly download was successful. Attempting setup of file:
D:\User\repos\MyApplication\trunk\Bin\MyApplicationCore.dll
LOG: Entering run-from-source setup phase.
LOG: Assembly Name is: MyApplicationCore, Version=1.10.2595.28495,
Culture=neutral, PublicKeyToken=null
LOG: Re-apply policy for where-ref bind.
LOG: Where-ref bind Codebase matches what is found in default context. Keep
the result in default context.
LOG: The post-policy assembly reference requires probing again.
LOG: Switch from LoadFrom context to default context.
LOG: No application configuration file found.
LOG: Using machine configuration file from
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom,
partial, or location-based assembly bind).
LOG: Attempting download of new URL
file:///D:/User/repos/MyApplication/trunk/Bin/MyApplicationCore.DLL.
LOG: Assembly download was successful. Attempting setup of file:
D:\User\repos\MyApplication\trunk\Bin\MyApplicationCore.dll
LOG: Entering run-from-source setup phase.
LOG: Binding succeeds. Returns assembly from
D:\User\repos\MyApplication\trunk\Bin\MyApplicationCore.dll.
LOG: Assembly is loaded in default load context.
 
G

Guest

Yes, but WHY can't it find the file? The AppBase and PrivatePath are the same
in the two scenarios.

In the non-working scenario the log says "Where-ref bind. Location =
C:\MyApplicationCore.dll"

What does that mean? - and why is it looking in c:\ when the exe-file is
located in the same directory as the dll it is looking for
(D:\User\repos\MyApplication\trunk\Bin) ?

It has been working for a long time and I know the dll is there, but the exe
is for some reason looking the wrong place now.

Jan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top