Re: Unmanaged DLL staying loaded in NUnit GUI

"Wayne Hartell" <[email protected]>
Newsgroups gmane.comp.windows.dotnet.nunit.user
Message-ID <003801c84276$9bc9ffe0$0277150a@whar9150>
I'm not sure how you can say that somehow the unmanaged dll is still loaded. :-) 

Unless it is explicitly unloaded using FreeLibrary it will be permanently loaded into the address space of the calling exe. I've not looked at the NUnit source (that kind of thing is on a need to know basis for me), but I would assume that NUnit isn't easily able to, or just isn't able to period, unload unmanaged dlls. I'm also not aware of any magical reflect-atronic voodoo that would allow NUnit to enumerate loaded unmanaged user dlls and explicitly unload them. Couldn't you, knowing the name and location of your unmanaged dll and knowing that the NUnit process would be the only exe to have that dll loaded, simply use [TestFixtureTearDown] to unload it using FreeLibrary?

Just a thought...
  ----- Original Message ----- 
  From: [email protected] 
  To: [email protected] 
  Sent: Thursday, December 20, 2007 5:16 AM
  Subject: Re: [Nunit-users] Unmanaged DLL staying loaded in NUnit GUI


  I have this same problem, but I always assumed it was somehow inherent to the domain.  If there is a solution, I would be extremely happy to have it implemented.



----------------------------------------------------------------------------
    From: [email protected] [mailto:[email protected]] On Behalf Of Nassar, Anthony
    Sent: Wednesday, December 19, 2007 11:36 AM
    To: [email protected]
    Subject: [Nunit-users] Unmanaged DLL staying loaded in NUnit GUI


    I'm having some trouble with a Visual Studio 2005 project consisting solely of unit tests. The code under test requires an unmanaged DLL (via P/Invoke declarations), which is copied to the output directory. Obviously, it's then copied to the test project's output directory, but if NUnit is open, and has just run those tests, then somehow the unmanaged DLL is still loaded, and I can't build the test project again w/o killing NUnit entirely (loading a different, unrelated test project into it doesn't solve the problem). Perhaps someone has seen this before? I could investigate in more detail, but perhaps someone knows what's going on here? I'm not suggesting that this is NUnit's problem; it may be that unmanaged DLLs are loaded into a process, not an AppDomain, and then not unloaded (I'm guessing). 

    The usual error message: "Unable to copy file "D:\trunk\CommonFunctionality\Third-Party\Bin\lpsolve55.dll" to "bin\Debug\lpsolve55.dll". The process cannot access the file 'bin\Debug\lpsolve55.dll' because it is being used by another process."


----------------------------------------------------------------------------

    Tony Nassar

    Cell: (703) 994-0954

    Blog: http://slideguitarist.blogspot.com/
    Music: http://www.soundclick.com/thecompletists



    "God love me, and I'm a hell of a fighter.." - Floyd Mayweather




------------------------------------------------------------------------------


  -------------------------------------------------------------------------
  SF.Net email is sponsored by:
  Check out the new SourceForge.net Marketplace.
  It's the best place to buy or sell services
  for just about anything Open Source.
  http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace


------------------------------------------------------------------------------


  _______________________________________________
  Nunit-users mailing list
  [email protected]
  https://lists.sourceforge.net/lists/listinfo/nunit-users

-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace

_______________________________________________
Nunit-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nunit-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.