locked
catching vc++ runtime error [Exe / COM / MFC-DLL] RRS feed

  • Question

  • My vc++ SDI application is using some dynamic dlls(LoadLibrary()), some COM components. Sometmes there is a vc++ runtime error(abnormal program termination) when the application doing something with related to COM components and/or DLLs. How to catch this runtime error? There is no entry added in system event log. How to  find out the cause for runtime error and where it is happening?

    Regards

    Thursday, September 16, 2010 7:26 PM

Answers

  • Running the application under the debugger will help, as will using WinDbg. Personally, I usually troubleshoot this by determining under what conditions I can reliably reproduce the  error. Once I know that, I can find out exactly which routine throws the exception. A common source of this type of problem is calling the COM method or property incorrectly; the incorrect coding can be either on the client side or the server side.

    Example:

    BSTR tempStr = L"This is not a legal bstring";

    The above line will cause your program an unpleasant death at some unknown execution point later on.

     

    • Marked as answer by Jesse Jiang Thursday, September 23, 2010 2:27 AM
    Friday, September 17, 2010 12:10 AM

All replies

  • Running the application under the debugger will help, as will using WinDbg. Personally, I usually troubleshoot this by determining under what conditions I can reliably reproduce the  error. Once I know that, I can find out exactly which routine throws the exception. A common source of this type of problem is calling the COM method or property incorrectly; the incorrect coding can be either on the client side or the server side.

    Example:

    BSTR tempStr = L"This is not a legal bstring";

    The above line will cause your program an unpleasant death at some unknown execution point later on.

     

    • Marked as answer by Jesse Jiang Thursday, September 23, 2010 2:27 AM
    Friday, September 17, 2010 12:10 AM
  •  

    Hi,

     

    I'm very interested your issue, did you solve your problem?

    If so please share the solution with us and mark the right answer.

    If not please let me know.

     

    Have a nice day!

    Jesse


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Tuesday, September 21, 2010 3:20 AM