locked
Error while closing excel file:The message filter indicated that the application is busy. (Exception from HRESULT: 0x8001010A (RPC_E_SERVERCALL_RETRYLATER)) RRS feed

  • Question

  • Hi,

       I have developed winform application which is used to capture the current active application details and saved in database.Here for excel application I have used "AccessibleObjectFromWindow" method to capture current running excel application details(Workbook name,Sheet name,Macro names,Formula value).

      The data retrieve is successfull but when user clicks the close button of EXCEL application then the exception is raised as

    Exception:

    System.Runtime.InteropServices.COMException (0x8001010A): The message filter indicated that the application is busy. (Exception from HRESULT: 0x8001010A (RPC_E_SERVERCALL_RETRYLATER))
       at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
       at System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32 errorCode)
       at System.Dynamic.ComRuntimeHelpers.CheckIfMissingTypeInfoIsExpected(Int32 hresult, Boolean throwIfMissingExpectedTypeInfo)
       at System.Dynamic.ComRuntimeHelpers.GetITypeInfoFromIDispatch(IDispatch dispatch, Boolean throwIfMissingExpectedTypeInfo)
       at System.Dynamic.IDispatchComObject.EnsureScanDefinedMethods()
       at CallSite.Target(Closure , CallSite , ComObject , String )
       at CallSite.Target(Closure , CallSite , Object , String )

    Kindly help me where I am wrong.

    Regards,

    Meenakshi Kabali

    Tuesday, October 7, 2014 9:03 AM

Answers

  • Hello Meenakshi,

    Is it your winform application which got that exception message?

    If so, then that is because when your winform application capturing the data with the com object, that com object is being called to close, then it will get this exception. To avoid displaying this exception, I would recommend you consider using try catch to handle this exception like the following one.

     try
            {
               //... your task
            }
    
            catch (System.Runtime.InteropServices.COMException e)
            {
                if ((e.ErrorCode & 0xFFFF) == 0x10a)
                {   // Excel is busy
                    //...release the com object 
                }
                else
                {   // Re-throw!
                    throw e;
                }
            }
    

    If that is not the case, you could share the detailed code with us.

    Regards.

    Carl


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by Carl Cai Friday, October 17, 2014 8:45 AM
    Thursday, October 9, 2014 3:01 AM

All replies

  • Hi Meenakshi Kabali,

    Thanks for posting in MSDN forum.

    This forum is for developers discussing issues about Excel object model, since the issue is more relative to Windows Form, I would like to move it to Windows Form General forum.

    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us.

    Thanks for your understanding.

    Best regards

    Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, October 8, 2014 3:03 AM
  • Hello Meenakshi Kabali,

    In order to clarify this issue, we need to confirm the following tips with you.

    >>Here for excel application I have used "AccessibleObjectFromWindow" method to capture current running excel application details

    1. Did you mean using this method accessibleobjectfromwindow (oleacc) ?

    >>The data retrieve is successfull but when user clicks the close button of EXCEL application then the exception is raised as

    2.When you click the close button, was there any task dealing with that excel interop object finished?

    If that is the case, then I would recommend you capture whether there is any  interop object task finished inside the form close event to test.

    You could follow the way shared in the following thread to test.

    http://stackoverflow.com/questions/14467510/c-sharp-excel-interop-how-to-test-if-interop-object-is-still-working-and-perfo

    If still no helping, you could share more detailed code with us, we will check that to help you.

    Regards.

    Carl


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, October 8, 2014 3:19 AM
  • Hi Carl Cai,

    1.My winform application will be running in system tray and it will capture the active application running in user machine.

    2.When user using Excel file and if they navigating sheets  that time winform will call Interop object to get current active sheet name.

    3.When my winform application trying to retrieve details of excel file at same time user trying to close excel file I am getting exception as below

    Exception:

    System.Runtime.InteropServices.COMException (0x8001010A): The message filter indicated that the application is busy. (Exception from HRESULT: 0x8001010A (RPC_E_SERVERCALL_RETRYLATER))
       at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
       at System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32 errorCode)
       at System.Dynamic.ComRuntimeHelpers.CheckIfMissingTypeInfoIsExpected(Int32 hresult, Boolean throwIfMissingExpectedTypeInfo)
       at System.Dynamic.ComRuntimeHelpers.GetITypeInfoFromIDispatch(IDispatch dispatch, Boolean throwIfMissingExpectedTypeInfo)
       at System.Dynamic.IDispatchComObject.EnsureScanDefinedMethods()
       at CallSite.Target(Closure , CallSite , ComObject , String )
       at CallSite.Target(Closure , CallSite , Object , String )

    Please tel me how to avoid this exception.

    Thanks,

    Meenakshi

    Wednesday, October 8, 2014 12:01 PM
  • Hello Meenakshi,

    Is it your winform application which got that exception message?

    If so, then that is because when your winform application capturing the data with the com object, that com object is being called to close, then it will get this exception. To avoid displaying this exception, I would recommend you consider using try catch to handle this exception like the following one.

     try
            {
               //... your task
            }
    
            catch (System.Runtime.InteropServices.COMException e)
            {
                if ((e.ErrorCode & 0xFFFF) == 0x10a)
                {   // Excel is busy
                    //...release the com object 
                }
                else
                {   // Re-throw!
                    throw e;
                }
            }
    

    If that is not the case, you could share the detailed code with us.

    Regards.

    Carl


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by Carl Cai Friday, October 17, 2014 8:45 AM
    Thursday, October 9, 2014 3:01 AM