In Debug Mode I am getting a "Could not load file or assembly" error when I try to run my Visual C++ CLI application in debug. Release works

1

We're working on a programme for an internship but lacking an expert in C++/CLI. The programme compiles and works in release. The programme compiles in debug but on launch crashes with this error:

Additional information: Could not load file or assembly ', Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Could not find or load a type. (Exception from HRESULT: 0x80131522).

In the Disassembly window it shows it stops at _NtWaitForSingleObject@12. The project uses managed and unmanaged code. The project uses boost and armadillo. Build configuration targets win32 only.

These are the last few lines of the output window before crash:

First-chance exception at 0x75524598 (KernelBase.dll) in hydro_stats.exe: Microsoft C++ exception: EETypeLoadException at memory location 0x00d3e278.

First-chance exception at 0x75524598 (KernelBase.dll) in .exe: Microsoft C++ exception: [rethrow] at memory location 0x00000000.

First-chance exception at 0x75524598 (KernelBase.dll) in .exe: Microsoft C++ exception: [rethrow] at memory location 0x00000000.

First-chance exception at 0x75524598 (KernelBase.dll) in .exe: Microsoft C++ exception: [rethrow] at memory location 0x00000000.

First-chance exception at 0x75524598 (KernelBase.dll) in .exe: Microsoft C++ exception: EEFileLoadException at memory location 0x00d3d5c8.

An unhandled exception of type 'System.IO.FileLoadException' occurred in Unknown Module.

  • String pooling is enabled with /GF.
  • We've tried clean solution many times.
  • We had clues from fuslog.exe saying system.dll and system.core.dll did not load properly.
  • We've tried updating to .NET framework 4.6.1.
  • Sometimes individually we can stop the error with undo in team explorer, continue to code with the debug working but when work is committed to SVN, the error comes back.
  • Tried Tools -> Options -> Debugging -> General -> Enable Just My Code.

Sometimes we think its our code sometimes we think its the project configuration. Thank-you for your time, more info will be provided upon request.

EDIT: fuslogvw says system and system.core are not binding correctly: * Assembly Binder Log Entry (2016-06-14 @ 1:33:02 PM) *

The operation failed. Bind result: hr = 0x80070002. The system cannot find the file specified.

Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll Running under executable C:\Program Files (x86)\MSBuild\12.0\bin\MSBuild.exe --- A detailed error log follows.

=== Pre-bind state information ===

LOG: DisplayName = System
 (Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: System | Domain ID: 1
WRN: A partial bind occurs when only part of the assembly display name is       provided.
WRN: This might result in the binder loading an incorrect assembly.
WRN: It is recommended to provide a fully specified textual identity for the assembly,
WRN: that consists of the simple name, version, culture, and public key token.
WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue.
LOG: Appbase = file:///C:/Program Files (x86)/MSBuild/12.0/bin/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = MSBuild.exe

Calling assembly : Microsoft.Build.Tasks.v12.0, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a.

LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Program Files   (x86)\MSBuild\12.0\bin\MSBuild.exe.Config
LOG: Using host configuration file: 
LOG: Using machine configuration file from   C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom,  partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Program Files (x86)/MSBuild/12.0/bin/System.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/MSBuild/12.0/bin/System/System.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/MSBuild/12.0/bin/System.EXE.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/MSBuild/12.0/bin/System/System.EXE.
LOG: All probing URLs attempted and failed.

If i understand well i have to give more specifics for the name, version, culture, and public key token but i'm not sure where in the .vcxproj or MSBuild.exe.config

.net
dll
c++-cli
asked on Stack Overflow Jun 10, 2016 by Meatball • edited Jun 14, 2016 by Meatball

1 Answer

1

You might be missing a dll from the debug folder. Or perhaps you need to register a component. Try copying the content of the release folder to debug and see if they still run.

answered on Stack Overflow Jun 10, 2016 by A Sal

User contributions licensed under CC BY-SA 3.0