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.
Nikola Stjelja
  • 3,659
  • 9
  • 37
  • 45
  • Try load the dll with dll dependeny walker. www.dependencywalker.com –  Aug 23 '10 at 15:10

2 Answers2

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.

Constantin
  • 27,478
  • 10
  • 60
  • 79
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.

Alex Dresko
  • 5,179
  • 3
  • 37
  • 57