Invoke code exception has been thrown by the target of an invocation. in UiPath

Hi Friend,

I am developing an automation using Invoke code activity and i found no errors in my code, but when i run the program it shows the below error. Could someone please help me on this?

Invoke code exception has been thrown by the target of an invocation.

Hi @Jagadesh2494

Can you Share your error screeshot

Thanks

Hi,

Attached screenshot

@Jagadesh2494

Please check the arguments are passing correctly, If you specify any OUT Argument and it is not configured correctly then this will cause the exception

Hope this helps

Thanks

1 Like

I found the error, if i comment that particular block of code it is working without any errors. Now the error is if my excel is already in auto filter mode then i want to show all data else i want to apply filter. Could you please send the C# code for this?

My Code - image

Hi, I know this is very old now but did you happen to find a solution. I have tried several workarounds in invoke code to apply autofilter and all seem to give the same error.

Thank you.