Invoke Code (C#) UiPath.Core limitations

I want to execute a series of methods in C#, but the compiler tells me something is non-invocable. What is going on?

Invoke code: No compiled code to run
error CS1955: Non-invocable member ‘GetProcesses’ cannot be used like a method. At line 1

var processes = UiPath.Core.Activities.GetProcesses();
foreach (var process in processes) {
	Console.WriteLine(process);
}

Edit for clarification: Can I distinguish between methods and non-invokable activities in the UiPath namespace?

Hey @Tiramisu

Get Processes is not a method meaning you can’t do it like how you are doing it in the code.

Instead you can try this - Process.GetProcesses Method (System.Diagnostics) | Microsoft Learn

Thanks
#nK

1 Like

Thanks @Nithinkrishna. Is there anything beneath the UiPath namespaces that I can call as a method? Or can I only use the normal System.[…].

Assign activity:

arrProcesses = Process.GetProcesses()

Namespace: System.Diagnostics just add it to the imports

Thanks for the addition peter. I understand that I cannot use UiPath.Core.Activities.GetProcesses
as a method. Is the entire namespace out of the question?

may we ask you to reformulate the question as it is unclear to us, what you asked. Thanks

the usage of an activity within an invoke code would be different ( But for your case we suggest the Process.GetProcesses or Process.GetProcessesByName(…) )

intelisense gives us some details if class is offering a property / method

for code statements from the .Net / VB.Net base we can refer to intelisense or the Microsoft docs docu

Alright. I will use IntelliSense to probe for methods.


Thanks!
PS: I think it is clear by now, that .NET is not my primary development platform.

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