How to get stack trace for access violation exception RRS feed

  • Question

  • <style type="text/css">p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px 'Helvetica Neue'; color: #454545} </style>

    HI All,

    I am making an application which has been written in .Net. It is accessing my Dll (implemented in managed C++). This DLL is further calling lib (lets say lib1) which is implemented in c++. This lib further call function of lib (lets say lib2) implemented in C. This lib1 and lib2 is also using lib implemented in C and built in gcc compiler in Msys environment.  My application , DLL , lib1 and lib 2 have been built in VS 2015 with /MD switch.

    Flow is Application -> DLL -> lib1 -> lib2

    My issue is I am getting Access violation exception in one flow but stack trace of my DLL is only printing up to the API of lib1 (implemented in c++). It is not printing API of lib2. However by do the logging in file, I can the exception is coming from API of lib2 which is internally called from lib1 API. 

    Now how can I exactly get which line is doing crash as I don't have access of source code of lib built in gcc. I have tried try / catch in lib1 but access violation exception is generic one which can be only caught in catch(...).

    I have tried to use c++ 11 std::exception_ptr and try to re-throw but it is not helpful. Using debug diagnosis tool is also not helpful as it is also giving stack trace until lib1 API.

    I can debug my code as this bug is reproducible only my test machine. On development machine it is working fine.

    Please guide me how can I get the full stack trace of exception or if there is any way to run memory profiler on test machine ?


    Monday, May 7, 2018 11:10 AM

All replies

  • Maybe you can find the exception record and the context record for the failure with the GetExceptionInformation API




    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

    Tuesday, May 8, 2018 6:22 AM