-1

My C# project is referencing managed dll that has dependencies on a native dll. Therefore, before calling managed dll function I copy native dll to folder: Path.GetDirectoryName(Assembly.GetAssembly(typeof(ManagedDllClass)).Location).

I'm still, however, encountering the problem where while performing a native call my debugger is hanging. What can be the cause of this? What is the preferred way of dealing with the situation where referenced managed dll is depending on a native dll?

Thanks

user2864740
  • 60,010
  • 15
  • 145
  • 220
  • What version of Visual Studio are you debugging with? Also, if you have the option, do you have "Native Code Debugging" checked in the project debug settings? – Scott Chamberlain Aug 29 '14 at 21:24
  • I'm using VS 2013. Native code debugging doesn't do me any good because I don't have the source code for the native .dll I'm using. Can I somehow confirm that native .dll is found by VS? – user2775761 Aug 29 '14 at 21:55
  • If it was not finding it the program would not hang, it would throw a exception (unless you are already catching the exception and throwing it away somewhere in your code). Please update your question showing the call that hangs (and please include the code leading up to it too). – Scott Chamberlain Aug 29 '14 at 21:58

1 Answers1

0

"Native DLL" is actually misleading in this case.

.NET can only interface with COM server DLLs using COM Interop. In general, COM DLLs need to be registered with the OS in order to be accessible via .NET - they are not generally xcopy compatible like .NET assemblies.

If you don't know for sure that the COM server DLL has been registered, use regsvr32.exe to register the DLL again.

More instructions on how to use regsvr32.exe : How to use the Regsvr32 tool and troubleshoot Regsvr32 error messages

toadflakz
  • 7,764
  • 1
  • 27
  • 40