none
This application has requested the Runtime to terminate it in an unusual way

    Question

  • Hello,

    We have an application developed in VS 2008. (Though, the exact same problem occurred in VS 2003)

    After our application runs for a while, 6-24 hours or so, we get the error Dialog:

    "Microsoft Visual C++ Runtime Library"

    "This application has requested the Runtime to terminate it in an unusual way."
    (etc)

    If I try to suppress the error dialog, by using:
     
    _set_abort_behavior(0, _WRITE_ABORT_MSG);

    The dialog is sometimes, but not always, suppressed.

    However, this is not helpful anyway, because this merely causes our application to exit quietly, which is unacceptable.  I need to know what is causing this.  I would like whatever it is in the MS runtime library to break in the debugger, so I can understand the problem.

    It would be nice if nothing in the Microsoft Runtime Libraries called abort(), or at least if they did, there was some way to control it.


    Any ideas?

    Thanks,
    - Randy 

    Tuesday, March 03, 2009 6:41 AM

All replies

  • Exception filters and exception handlers will help you.
    _try {
    do any processing here.
    }

    _except( EXCEPTION_EXECUTE_HANDLER) {

    ...................
    }
    Tuesday, March 03, 2009 2:44 PM
  • I can't do that.  That's what the MS C++ runtime library needs to do.  It's not in my code anywhere.
    Tuesday, March 03, 2009 4:36 PM
  • Let me clarify.

    I have no idea where this error is coming from, so I have no way to guard against it.

    It is occuring somewhere in the MS VC++ runtime.

    If I put a break point in abort(), it never breaks there, yet the dialog will still display if I don't prevent it from doing so, by doing  _set_abort_behavior(0, _WRITE_ABORT_MSG).

    So, I have no way to catch it in the debugger, so that I can see what is causing it.

    Does that make sense?

    - Randy
    Tuesday, March 03, 2009 6:56 PM
  • Debug + Exceptions, turn on the Thrown flags.
    Hans Passant.
    Wednesday, March 04, 2009 1:37 AM
  • what?
    Wednesday, March 04, 2009 6:22 AM
  • "It would be nice if nothing in the Microsoft Runtime Libraries called abort(), or at least if they did, there was some way to control it." 

    abort() is by default called by std::terminate() which is part of the C++ specification. If the runtime did not call terminate() when the language specification required it to then it wouldn't be C++. You can change the behavior by calling set_terminate(),  however it's usually too late then. Hans's suggestion lets you catch the error at the point it occurs, which is much more helpful.
    Wednesday, March 04, 2009 7:00 PM
  • >> abort() is by default called by std::terminate() which is part of the C++ specification.
    Exactly.  Yet it is not doing that.  That's (part of) the problem.  I have no idea what/why is calling abort(), or some abort()-like function.  I originally assumed it was abort() that was being called because of the "This application has requested the Runtime to terminate it in an unusual way" dialog.

    However, like I previously stated, if I put a break point in abort(), it never breaks.  So there is some other mysterious place where this is happening.

    Furthermore, the C++ langugage specification does not require undocumented parts of the MS C++ runtime call a undocumented proprietary version of abort().


    >>Hans's suggestion lets you catch the error at the point it occurs, which is much more helpful.
    I guess you are not understanding the problem.  I have nothing to "try". I have no idea where the MS runtime psuedo-abort is occuring.
    Wednesday, March 04, 2009 8:18 PM
  • Well, sorry to be late but Google is very poluted with old stuff these days

    I have the exact same error but with a C# application that doesn't even have a single reference or line to a C++
    I'm very confused.


    Marcheur extrême...

    Wednesday, May 23, 2012 4:43 PM