3

During tests execution in Visual Studio 2013 (C# code) I have such error:

System.TypeInitializationException: System.TypeInitializationException: The type initializer for 'Teigha.Core.GlobalsPINVOKE' threw an exception. ---> System.TypeInitializationException: The type initializer for 'SWIGExceptionHelper' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'TD_SwigCore_4.00_10.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E). Aborting test execution.

My friend uses the same code branch on another computer. He has no such problems. All dll's are copied to TestResults\Deploy directory during build (TD_SwigCore_4.00_10.dll too).

I used

dependbin /DEPENDENTS TD_SwigCore_4.00_10.dll

to check dll dependents of this dll: KERNEL32.dll, USER32.dll, ole32.dll, TD_Ge_4.00_10.dll, TD_DbRoot_4.00_10.dll, TD_Gi_4.00_10.dll , TD_Gs_4.00_10.dll , TD_SpatialIndex_4.00_10.dll, TD_Br_4.00_10.dll, TD_Db_4.00_10.dll, TD_Root_4.00_10.dll, TD_Alloc_4.00_10.dll, MSVCP100.dll, MSVCR100.dll. I copied all this dlls to system32 folder so that all dlls would be loaded (https://msdn.microsoft.com/en-us/library/7d83bc18(v=vs.120).aspx). This doesn't help. Error still exists.

Zygmuntix
  • 339
  • 3
  • 13
  • 1
    Copying dependencies to system32 is a drastic mistake and very likely to cause other programs to malfunction. And doesn't work because a 32-bit process gets redirected to syswow64. You'll need to fix the damage, copy dependencies to the directory where the exe is stored. – Hans Passant Aug 30 '16 at 09:59
  • From what directory is test runner executed in Visual Studio 2013? I think this must be directory in which dlls are searched first? Or maybe in VSproject\bin\Debug? Normally I am using ClearCase View to launch the application (but now I am talking about running tests). – Zygmuntix Aug 30 '16 at 10:06

1 Answers1

3

Solution for this issue was to copy missing dlls to directory: {Visual_project_directory}\bin\Debug. Files cannot be hidden inside some directories, they have to be copied straight into this directory. Missing dlls can be found by using dumpbin (it is installed with Visual Studio, in one of its directories) or Dependency Walker.

Zygmuntix
  • 339
  • 3
  • 13