How to resolve the error thrown by MS Word Application Scope - Application is busy ?
Resolution: Similar events may occur when UiPath accessing the word application MS office word exceeds the processing capacity. Below are some countermeasures to approach this problem.
The Exception error message HRESULT: 0x8001010A indicates the Word Application Scope being invoked is busy and the RPC call to system cannot be processed on the given time.
Things to be Validated:
- Debug workflow and check after the Word application scope closes, open Task Manager and check whether WINWORD.exe is still running or not
- Ensure all the COM add-ins are disabled in this scenario.
- Enclose the activities in a "Retry scope" activity ( leave the condition empty in retry scope activity as demonstrated below) so it will retry whenever it failed.
Workflow Changes:
- Implement Retry Scope to eliminate the intermittent failures
- Use the Kill Process activity (at the user level) to ensure that no orphaned Word process exists in the system after the Word Application Scope is closed. You can follow either of the two approaches:-
Approach #1: (Using UiPath)
- Get the process details using Process.GetProcessesByName
- Make the comparison between process owner username and current logged in username.
- Kill the process for the current user
Approach #2: (Using Powershell)
- Use Powershell script to get the user specific process and then delete them. Please refer for development ideas to Kill A Process Running Under A Certain User
- Try calling the activity in an Invoke Workflow with Isolated option checked so the execution carries in a different thread.
- Call the garbage collectors explicitly in the code in the places where the crash was encountered and also at the end of the code
- Use Invoke Method activity - Set target type as - System.GC, Use Method Name - Collect
- Use Invoke Method activity - Set target type as - System.GC, Use Method Name - WaitForPendingFinalizers
- Use Invoke Method activity - Set target type as - System.GC, Use Method Name - Collect
- Add some "Delay" between activities where this issue is encountered, by placing/setting an appropriate "Delay" before and after the target activity .