0xc0000005 And HRESULT 0x80080005 Office Activities Crash

How to resolve 0xc0000005 And HRESULT 0x80080005 Office Activities Crash ?

Issue Description: Excel and Outlook activities fails with error code 0xc0000005System.Reflection.TargetInvocationException: An exception occurred at the target of the invocation. --->
System.Runtime.InteropServices.COMException: The COM class generator for the component with CLSID {0006F03A -00-0000-C000-000000000046}
could not be retrieved due to the following error: 80080005 Server execution failed ( Exception from HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILURE)

Resolution:
Approach #1 - Set memory clear at the beginning at the flow.

Approach #2 - (Using UiPath)

  1. Get the process details using Process.GetProcessesByName
  2. Make the comparison between process owner username and current logged in username and comparing them
  3. Kill the process for the current user
  4. Refer the below forum link for more details

Approach #3 - (Using Powershell)

  1. Use Powershell script to get the user specific process and then delete them.
  2. Refer the below link for development ideas
  1. Use Garbage collector to free up the memory.
  2. Call the Garbage Collector Explicitly. In order to do so, please add the below activities:

1.png

The method name in the second activity is "WaitForPendingFinalizers".