System.InvalidCastException

Hello

I got an error ‘stopped due to unexpected process termination’ in Orchestrator.
I checked the event log and found an error where the robot stopped.

Exception: System.InvalidCastException.
Place: System.StubHelpers.StubHelpers.GetCOMIPFromRCW(System.Object, IntPtr, IntPtr ByRef, Boolean ByRef)
Place: Microsoft.Office.Interop.Excel._Application.set_SheetsInNewWorkbook(Int32)
Place: UiPath.Excel.WorkbookApplication.Dispose()
Place: UiPath.Excel.WorkbookApplication.Finalize()

However, I have no idea how to identify what is wrong and where to fix from this event log. Could you help me to resolve this?

Cheers,

1 Like

You are trying to change vairable type at runtime in a wrong way

eg: String to Int

Where A = ‘1’ (String)

To Convert to int you should use

B= CInt(A)

Hi @9e389f79ff1549b677ac ,
YOur are trying to cast the value from one data type to other data type in a wrong way, please refer other posts from form where you will be able to get how to do conversion from one data type to other.

Let us know if this helps,
Regards,
Pavan H