Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.net VS2015:迁移的项目已编译,但不会运行(“调试断言失败!”)_.net_C++ Cli_Visual Studio 2015 - Fatal编程技术网

.net VS2015:迁移的项目已编译,但不会运行(“调试断言失败!”)

.net VS2015:迁移的项目已编译,但不会运行(“调试断言失败!”),.net,c++-cli,visual-studio-2015,.net,C++ Cli,Visual Studio 2015,我有一个最初在VS2013中编译的程序。现在我已经安装了VS2015,我甚至在编译应用程序时都遇到了问题。它是用C++/CLI编写的。它最初的目标是v120_xp工具集。我试着用目标工具集和我的程序使用的所有C++库编译,这些图形库是图形化的和LBBISHISH。如果它以那个工具集为目标,它甚至不会编译。所以我试着瞄准v140_xp,我的程序的一些用户仍然使用Windows xp。那也没用 所以我决定只针对v140工具集,而.NETFramework版本4.5.2最初针对的是4.0 它编译成功

我有一个最初在VS2013中编译的程序。现在我已经安装了VS2015,我甚至在编译应用程序时都遇到了问题。它是用C++/CLI编写的。它最初的目标是v120_xp工具集。我试着用目标工具集和我的程序使用的所有C++库编译,这些图形库是图形化的和LBBISHISH。如果它以那个工具集为目标,它甚至不会编译。所以我试着瞄准v140_xp,我的程序的一些用户仍然使用Windows xp。那也没用

所以我决定只针对v140工具集,而.NETFramework版本4.5.2最初针对的是4.0

它编译成功

但现在我的程序甚至不能启动。我调试了它,得到了以下结果:

Exception thrown at 0x77751ed2 in PathCreator.exe: 0xC0000005: Access violation reading location 0x23462c5f.
Debug Assertion Failed!

Program: ...Visual Studio 2015\Projects\PathCreator\Debug\PathCreator.exe
File: minkernel\crts\ucrt\src\appcrt\heap\debug_heap.cpp
Line: 1037

Expression: _CrtIsValidHeapPointer(block)

For information on how your program can cause an assertion
failure, see the Visual C++ documentation on asserts.

(Press Retry to debug the application)
'PathCreator.exe': Loaded 'C:\Windows\syswow64\dwmapi.dll', Cannot find or open the PDB file.
PathCreator.exe has triggered a breakpoint

Exception thrown at 0x53cb6866 in PathCreator.exe: 0xC0000005: Access violation reading location 0x23462c70.
Exception thrown at 0x76d23e28 in PathCreator.exe: Microsoft C++ exception: [rethrow] at memory location 0x00000000.
An unhandled exception of type 'System.TypeInitializationException' occurred in Unknown Module.
Additional information: The type initializer for '<Module>' threw an exception.

An unhandled exception of type 'System.TypeInitializationException' occurred in Unknown Module.
Additional information: The type initializer for '<Module>' threw an exception.

The program '[4156] PathCreator.exe: Managed (v4.0.30319)' has exited with code -1 (0xffffffff).
The program '[4156] PathCreator.exe: Native' has exited with code -1 (0xffffffff).
我不知道为什么会这样。我几乎准备好卸载VS2015并返回VS2013


有什么想法吗?非常感谢您的帮助和指点。

到目前为止,我通过更改程序的入口点成功地解决了这个问题。在项目的属性页面中,在Linker->Advanced下,我清除了入口点选项main。然后,我将最初由早期版本的Visual Studio定义为int mainarray ^args的main方法更改为int WinMainvoid*var1、未签名的long var2、void*var3

根据VS帮助,让编译器选择入口点,允许它确保C运行库被正确初始化,并且执行静态对象的C++构造函数。听起来像是我们一直遇到的问题


我不确定这个问题现在是否出现,因为微软不再支持管理C++中的WiFrm,或者是与CRT的重新架构或完全不同的东西有关。我也不确定这是否是正确的解决方案,但它似乎对我目前正在开发的程序有效。

您是否清理并重新编译了整个项目?我最近也转到了2015年,在升级我的项目后没有出现这样的问题。第一个例外可能是被发现并在内部处理,这导致了第二个例外。表达式:_CrtIsValidHeapPointerblock表示内存已损坏,可能是由于写入超过缓冲区的结尾或写入超过类的结尾,因为编写器假定类比分配的类大,就像它期望派生类并获取基类或其他类的对象时一样。将异常设置更改为在最初抛出0xC0000005错误时停止,以便您可以看到最初的问题。@KompjoeFriek是的,我清理了整个项目并重新编译。我还重新编译了GraphicsMagick和libsquish,以v140工具集为目标,它编译得很好。@1201程序谢谢,我会试试的。当抛出0xC0000005时,如何更改异常设置以停止?我不是很擅长调试,虽然我应该是,但这是我必须要做的事情。从调试菜单,windows子菜单,异常设置。展开Win32 exceptions部分并选中0xC0000005异常旁边的框。