Odd Win 2K Server Behavior When Loading Referenced Assemblies

R

Rob

Environment:

..NET 1.1
VS 2003

Scenario:

I have an app that is deployed with no-touch deployment. The initial
footprint of the app should be as small as possible,
loading/downloading assemblies only when they are needed.

The app (app.exe) consists only of a login form. When the user is
authenticated from the login form, then MyObject in MyDll.dll should
be loaded.

Sample code:

'Login() lives in app.exe, and MyDll.dll is referenced in the app.exe
project.
Private Sub Login()

...

If bUserIsAuthenticated Then
LoadMethod1()
Else
'Do something else
End If

...
End Sub


'LoadMethod1() also lives in app.exe
Private Sub LoadMethod1()

...

Dim myObj As New MyDll.MyObject 'MyDll should get loaded here.

...

End Sub


If I instantiate myObj in the Login method, then the class loader
loads the MyDll assembly, regardless of whether that line ever gets
executed. If I put it into its own method, then the class loader
defers the load until LoadMethod1 method is actually loaded. This is
expected.

So my issue is this: the above scenario works as expected when the
code is compiled on Win 2K Pro or XP machines (I can verify this by
looking in the download cache as the assemblies are downloaded during
NTD). When I compile it on Win 2K Server machines and run the
application, MyDll is loaded no matter what. The OS is seemingly the
biggest differentiating factor.

Thoughts?

Thanks,
Rob
 
R

Rob

UPDATE:

This behavior has nothing to do with the OS; it is determined by the
build configuration. If I build in debug mode, I get the desired
behavior. If I build in release mode, I get the undesired behavior.
Why would the build configuration affect the class loader?

Thanks,
Rob
 

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