none
How do I interpret HRESULTS? (e.g., 0x800A03EC) RRS feed

  • Question

  • I'm writing a C# program that uses excel to generate a chart, using a template file. I keep finding myself stuck though when a call to excel fails with an obscure COMException from HResult.

    The HResult I see most often is "0x800A03EC." But this is used for a wide variety of errors (e.g., file not found raises this exception, as does calling WorkSheet.ChartObjects() with an index that doesn't exist. I've also found many other examples).

    Most recently I'm struggling with an issue where my program will run fine as long as I haven't modified the template file it uses, but if I open the template file in excel, add text to an empty cell, delete that text, save the workbook, and run my program again, ChartObject.Copy() fails (with `Exception from HRESULT: 0x00A03EC`, of course). 

    I'm beginning to think that  HRESULT: 0x00A03EC simply means "excel."

    My question is: How do I get more information from this HResult, so I can figure out what's going wrong?

    Wednesday, March 6, 2013 8:53 PM

Answers

  • Get Exchange Error Lookup tool from http://www.microsoft.com/en-us/download/details.aspx?id=985

    Despite its name, it aggregates errors and their symbolic names from just about every header file imaginable.

    For 0x800A03EC, it returns

    # as an HRESULT: Severity: FAILURE (1), Facility: 0xa, Code 0x3ec
    # for hex 0x3ec / decimal 1004 :
      INVALID_RESOURCETYPE_LOOKSALIVE                               clusvmsg.h
      JET_wrnColumnNull                                             esent98.h
    # /* Column is NULL-valued */
      NMERR_BLOB_ENTRY_DOES_NOT_EXIST                               netmon.h
      SQL_1004_severity_16                                          sql_err
    # Invalid column prefix '%.*ls': No table name specified
      SCEEVENT_ERROR_POLICY_QUEUE                                   uevents.mc
    # Notification of policy change from LSA/SAM failed to be
    # added to policy queue.
    # %1
      ERROR_INVALID_FLAGS                                           winerror.h
    # Invalid flags.
      EVENT_MAN_PROFILE_NO_FILE_ACCESS                              wlevents.mc
    # The user %1 does not have access to the mandatory profile
    # located at %2.
      EVENT_UAE_VERIFICATION_FAILURE                                wlevents2.mc
    # Verification of an automatically enrolled certificate has
    # failed. (%1) %2
      WPA_MUST_ACTIVATE_NOW_EVENT                                   wpaevent.mc
    # This copy of Windows must be activated with Microsoft
    # before you can continue. To activate Windows, please
    # contact a customer service representative.
    # 9 matches found for "0x800A03EC"


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.4 is now available!

    • Marked as answer by ForeverWintr Thursday, March 14, 2013 5:01 PM
    Friday, March 8, 2013 9:42 PM

All replies

  • I think the below blogs can help you.

    http://blogs.msdn.com/b/yizhang/archive/2010/12/17/interpreting-hresults-returned-from-net-clr-0x8013xxxx.aspx

    Thursday, March 7, 2013 1:37 AM
  • Hi ForeverWintr,

    Thank you for posting in the MSDN Forum.

    As you've mentioned

    this is used for a wide variety of errors

    We need to see your code for further research.

    Since you have ChartObject.Copy() in your code, you can check whether your issue is caused by

    calling WorkSheet.ChartObjects() with an index that doesn't exist.

    Hope it helps.

    Best regards,


    Quist Zhang [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, March 7, 2013 9:48 AM
    Moderator
  • Thanks @Learning Hard, but that blog seems to be specific to CLR, and my HResult isn't listed. Am I misunderstanding?
    Thursday, March 7, 2013 7:53 PM
  • Unfortunately my code is fairly complex, but I'll try to include the relevant parts: 

    Excel.Application app = GlobalVars.excelApp; //an instance of Excel.Application();

    object missing = System.Type.Missing;
    Excel.Workbook workbook = app.Workbooks.Add(GlobalVars.excelTemplate()); //excelTemplate is a template file

    Excel.Worksheet sheet = (Excel.Worksheet)workbook.Worksheets.get_Item(label);

    //The following loop adds some data to some cells

    for (int i = 0; i < keyorder.Length; i++)
    {
        string k = keyorder[i];

        if (isMonth)
        {
            sheet.Cells[26, 2 + i] = GlobalVars.monthName(k);
        }
        else
        {
          sheet.Cells[26, 2 + i] = k;
        }
        List<double> data = boxData[k];

         for (int j = 0; j < data.Count; j++)
         {
            sheet.Cells[50 + j, 2 + i] = data[j];
         }

    }

    Excel.ChartObjects c = (Excel.ChartObjects)sheet.ChartObjects(missing); Excel.ChartObject chart = (Excel.ChartObject)c.Item(1); //I am able to use chart here successfully, so I don't think the index above is out of range try { chart.Copy(); //Exception from HRESULT: 0x800A03EC here after I edit and save the template } catch (COMException ex) { Debug.Print(ex.Message); }

    I don't think the error is calling chartObjects with an index that doesn't exist, because my code runs successfully until I modify the template file referenced in GlobalVars.excelTemplate(). If I open, add text to any cell, delete that text, and save the template file, I start seeing the exeption on chart.copy().


    • Edited by ForeverWintr Thursday, March 7, 2013 8:07 PM typo
    Thursday, March 7, 2013 8:06 PM
  • After some more experimentation, it looks like adding `chart.Select(true)` before my copy command stops the exception from occuring, but it also steals focus from the user (which will cause my program to crash if the user enters text, for example).
    Thursday, March 7, 2013 8:46 PM
  • Get Exchange Error Lookup tool from http://www.microsoft.com/en-us/download/details.aspx?id=985

    Despite its name, it aggregates errors and their symbolic names from just about every header file imaginable.

    For 0x800A03EC, it returns

    # as an HRESULT: Severity: FAILURE (1), Facility: 0xa, Code 0x3ec
    # for hex 0x3ec / decimal 1004 :
      INVALID_RESOURCETYPE_LOOKSALIVE                               clusvmsg.h
      JET_wrnColumnNull                                             esent98.h
    # /* Column is NULL-valued */
      NMERR_BLOB_ENTRY_DOES_NOT_EXIST                               netmon.h
      SQL_1004_severity_16                                          sql_err
    # Invalid column prefix '%.*ls': No table name specified
      SCEEVENT_ERROR_POLICY_QUEUE                                   uevents.mc
    # Notification of policy change from LSA/SAM failed to be
    # added to policy queue.
    # %1
      ERROR_INVALID_FLAGS                                           winerror.h
    # Invalid flags.
      EVENT_MAN_PROFILE_NO_FILE_ACCESS                              wlevents.mc
    # The user %1 does not have access to the mandatory profile
    # located at %2.
      EVENT_UAE_VERIFICATION_FAILURE                                wlevents2.mc
    # Verification of an automatically enrolled certificate has
    # failed. (%1) %2
      WPA_MUST_ACTIVATE_NOW_EVENT                                   wpaevent.mc
    # This copy of Windows must be activated with Microsoft
    # before you can continue. To activate Windows, please
    # contact a customer service representative.
    # 9 matches found for "0x800A03EC"


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.4 is now available!

    • Marked as answer by ForeverWintr Thursday, March 14, 2013 5:01 PM
    Friday, March 8, 2013 9:42 PM
  • Get Exchange Error Lookup tool from http://www.microsoft.com/en-us/download/details.aspx?id=985

    Despite its name, it aggregates errors and their symbolic names from just about every header file imaginable.

    For 0x800A03EC, it returns:

    ...

    That's handy, thanks. Any insight into how I figure out which of those header files corresponds to my error though? I assume it's not all of them.

    Monday, March 11, 2013 4:30 PM