Reputation: 493
I have a vb.net 3.5 application which references a dll (abc.dll, also in .net 3.5) This dll is accessed by the application from time to time. If at anytime during execution, if I delete the dll, I expect the application to throw an error the next time it tries to use a class from the dll. But, this is not the behaviour I see. If I delete the dll before startup, the application throws an error at startup. But not when the dll is deleted after startup.
Is this the standard behaviour, or am I doing something wrong? Can I get the app to throw an error if the dll is not found when it tries to use its classes?
Thanks in advance.
Upvotes: 1
Views: 115
Reputation: 16032
Error always occurs at the time when .NET framework tries to load assembly you are referencing. So it looks like for some reason CLR decided to load the assembly on the startup of the your App.
Upvotes: 0
Reputation: 755041
The short answer no. Once a DLL is loaded it is loaded until app AppDomain
instances using that DLL are unloaded from the process. Only then can you delete the original DLL.
Longer answer:
This is a complicated question because it depends on how the DLL is being loaded into the process. There are a couple of different ways this can occur
Upvotes: 3