NUnit unit test cannot find a unmanaged dll in the test class

2

I'have the following situation:

  1. I have a delphi dll (unmanaged) that works. I have a win forms application (a proof of concept application) that works. The dll (and all its dependencies) are copied in the Bin/Debug directory of the application.

  2. I've createad a .NET managed library which has a class that is a wrapper around the dll. all the dependencies of the dll and the dll are copied in the /Bin/Debug folder.

  3. In my unit test project for the managed library I've created a unit test for the wrapper class. When I run the unit test the following error is shown:

DAEcommerce.Logic.Tests.Infrastructure.L3.L3DatabaseConnectionTest.OpenClose_ProperParameters_ActiveSetToTrueAndFalse: System.DllNotFoundException : Unable to load DLL 'AttrbInterface.dll': A dynamic link library (DLL) initialization routine failed. (Exception from HRESULT: 0x8007045A)

The dll in question is copied in the Bin/Debug folder of the unit test project. I've tried also copying it to Windows/system32, adding it to the windows path and copying it in the folder where the NUnit exe is located. It just doesn't work.

I have the following questions:

  1. What is the problem?
  2. How can I found what is the problem?
  3. How can I fix it.
.net
nunit
pinvoke
asked on Stack Overflow Aug 23, 2010 by Nikola Stjelja

2 Answers

1

I had a similar issue with 7z.dll and SevenZipSharp on a 64-bit system. 7z.dll was 32-bit, so I had to make sure that nunit-x86.exe is used. I also had to turn off shadow copying in NUnit settings, not sure why, but it wouldn't load 7z.dll otherwise.

answered on Stack Overflow Jan 4, 2011 by Constantin
0

Try using the Fusion Log Viewer utility to from the Windows SDK to obtain more information about what's actually happening when your .NET assembly is loaded.

answered on Stack Overflow Aug 23, 2010 by Alex Dresko

User contributions licensed under CC BY-SA 3.0