none
_CrtIsValidHeapPointer(block) exception on load RRS feed

  • Question

  • I am trying to migrate a VS2012 WinForm application to VS2015 as am getting an exception as soon as the the application starts to load.  I am hoping for some help in figuring out what the issue is.

    The basic application uses VS2012 C++/CLI with OpenCV, CUDA, and two other libraries.  When run in debug mode, things worked fine.

    Now, I am migrating the app to VS2015.  I upgraded the project and recompiled each library using VS2015 in debug mode.  Now, I get the following error as soon as the app tries to load:

    I have seen stuff saying that these kinds of errors can come about from mixing code compiled in Release and Debug modes.  I do not think that is the case because everything was compiled in debug mode specifying "multi-threaded debug dll" where appropriate.   Here is a screen shot of one of the library properties:

    So, my question is how can I figure out what the problem is?  I have also seen stuff mentioning mixing managed and unmanaged code.  However, I do not think that is it because the same code ran fine using VS2012.

    Any help appreciated.


    Thursday, June 1, 2017 11:32 PM

All replies

  • Hi James Pistorino,

    thanks for posting here.

    >>my question is how can I figure out what the problem is? 

    The Expression: _CrtIsValidHeapPointer(block) indicates that memory has corrupted, possibly due to writing past the end of a buffer or writing past the end of a class because the writer assumes the class is larger than was allocated (like when it is expecting a derived class and gets a base class, or object of a different class).
    Please open Debug->Windows->Exception Settings, change the exception settings to stop when the 0xC0000005 error is initially thrown so you could see the initial problem.

    For more information about how to manage exceptions, please refer to this document below.

    https://msdn.microsoft.com/en-us/library/x85tt0dd.aspx?f=255&MSPPError=-2147217396

    Hope this could be help of you.

    Best Regards,

    Sera Yu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, June 2, 2017 3:11 AM
  • Thanks.  Help with a couple of things:

    1) which exception corresponds to the 0xC000005 error?

    2) given that the code was not changed and I never had a problem with VS2012, why would compiling with VS105 cause a problem?

    Friday, June 2, 2017 3:54 AM
  • >>1) which exception corresponds to the 0xC000005 error?

    This error code is usually related to Access Violation exception. Click Debug->Windows->Exception Settings. In the Exception Settings window, expand the node for a category of exceptions -> Common Language Runtime Exceptions( meaning .NET exceptions), and select the check box for a specific exception within that category System.AccessViolationException. You could also select an entire category of exceptions if you don't know which exception to choose.

    >>2) given that the code was not changed and I never had a problem with VS2012, why would compiling with VS105 cause a problem?

    How do you upgrade your project to vs 2015?

    When you first open a Visual C++ project that was created in an earlier version of Visual Studio, you might be prompted to update the project. The message asks whether you want to upgrade to the most recent version of the Visual C++ compiler and libraries. If you decline the update when you're first prompted, you can update the project later by choosing Update VC++ project on the Project menu.

    Follow this document below to check if you have upgraded your project properly.

    https://msdn.microsoft.com/en-us/library/hh690665.aspx

    Hope this could be help of you.

    Best Regards,
    Sera Yu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Proposed as answer by Baron Bi Friday, June 16, 2017 9:18 AM
    Tuesday, June 6, 2017 5:45 AM