UiPath Stopped Working

Scenario:

During the execution of the process, UiPath stops working with the usual popup Window, “UiPath Executor has stopped working”. Looking on the windows logs I found out an error whose origin is .Net Runtime: in particular the error messages says “System.InvalidCastException
in System.StubHelpers.StubHelpers.GetCOMIPFromRCW(System.Object, IntPtr, IntPtr ByRef, Boolean ByRef)
in Microsoft.Office.Interop.Excel.ApplicationClass.set_SheetsInNewWorkbook(Int32)
in UiPath.Excel.WorkbookApplication.Dispose()
in UiPath.Excel.WorkbookApplication.Finalize()”

The xaml contains a lot of Excel Application Scope (around 20) but they are correctly closed with Close Workbook and the activity is out of the Excel Application Scope’s sequence

Steps to reproduce:

Current Behavior: UiPath stops working

Expected Behavior:End of the Process

Studio/Robot/Orchestrator Version: Studio’s Version 2018 , Orchestrator’s Version 2018 3.2

Last stable behavior:
Last stable version:
OS Version:
Others if Relevant: (workflow, logs, .net version, service pack, etc):

Hi @pveneziani1

I search for topics by your error message and filtered by the ones with a post marked as a solution:
https://forum.uipath.com/search?q=System.InvalidCastException%20status%3Asolved

As you can see, the issue can have multiple causes. Could you clarify a bit more what your process is about?

the process is quite simple: it opens a lot of excel documents and it uses write o reade range activities. In particular in a sequence, there is a For each activity which contains an Excel Application Scope and a Close Workbook: basically the same document is open and closed continuously. May it be the source of the anomaly?

It might be that processes are not cleaned fast enough. Have you tried introducing some delays just to see if it will fix the issue?