none
VS 2019 Premature Exit RRS feed

  • Question

  • Recently upgraded to VS 2019 Build 16.1.1 & have an issue where the app I am developing starts to run & then prematurely terminates.

    The offending lines of code are:

    IntPtr ptrStruct = Marshal.AllocHGlobal(Marshal.SizeOf(ti));
    Marshal.StructureToPtr(ti, ptrStruct, true);         
    SendMessage(
    	    m_tool.Handle, 
    	    TTM_ADDTOOL, 
    	    0, 
    	    ptrStruct);

    If I set a breakpoint on IntPtr prtStruct …….. , single step the next 2 lines and then press F5 the app executes fine.

    Without the breakpoint, the app starts to execute, pops the Diagnostic Tools window for about 3 seconds and then terminates.

    This same code executes perfectly fine using VS Community 2015. To state the obvious - something is not right inside VS 2019. Both VS 2015 & VS 2019 have the same warning about hiding a Dispose inherited member which clearly is not the root problem.

    TIA, Joe

    Sunday, May 26, 2019 11:45 PM

Answers

All replies

  • What happens if you use false instead of true?

    • Marked as answer by jbm417 Monday, May 27, 2019 3:30 PM
    Monday, May 27, 2019 4:42 AM
  • Hi, 

    Since this forum is for discussing General Windows Desktop Development Issues. 
    But this thread is more related to Visual Studio. I will move it to Visual Studio Diagnostics.
    Thanks for your understanding.

    Best regards,

    Drake


    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.


    Monday, May 27, 2019 10:01 AM
  • False definitely fixes the problem - thanks Viorel.

    Ugh! - now I have to fix some legacy code that contains other instances. More work than just changing true to false because with false there will be memory leaks.  C'est la vie

    Monday, May 27, 2019 3:35 PM
  • Hi jbm417,

    I’m glad to hear that you got it working.

    If you have issues about VS IDE, please feel free to contact us. We will try our best to give you a solution.

    Best Regards,

    Dylan


    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

    Wednesday, May 29, 2019 10:04 AM