Invoke vb.net code exception

I am getting the following exception with invoke code vb
Please help. Thank you,

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

RemoteException wrapping System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. —> RemoteException wrapping System.ComponentModel.Win32Exception: Access is denied
at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId,
Int32 access,
Boolean throwIfExited)
at System.Diagnostics.Process.GetProcessHandle(Int32 access,
Boolean throwIfExited)
at System.Diagnostics.Process.Kill()
at UiPathCodeRunner_cf4413ce22b34d6ca5ee8c28c153860e.Run(String In_aug_cFull_Output_Path,

@A_Learner

the error is clear that access is denied to perform whatever you are trying in invoke code

looks like you are trying to kill something but you dont have enough permissions

cheers

1 Like

will check on it closely. thank you @Anil_G

This is invoke code (vb). So are you suggesting that the vb code is trying to kill something?

thank you,

@A_Learner

It might be…what are you doing inside it?

But access denied comes for varied reason like if you want to open a file and not able to access etc

Cheers

@Anil_G
The issue re-surfaced.
Inside the vb.net code, there is an Excel kill, I guess, this is what is giving the access denied error, may be? What can I do about this? Thank you,

'Remove any Excel process still in memory…
Dim nPos As Integer
For Each prog As Process In Process.GetProcesses
nPos = InStr(prog.ProcessName.ToUpper, “EXCEL”)
If nPos > 0 Then
prog.Kill
End If
Next

@A_Learner

Use a try catch around … as the error is clear that it is no able to access the excel to kill

Cheers

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.