OpenRPA can't record for some applications on my machine
-
Hi Allan,
I'm new to OpenRPA. Today I found I can't record operation steps for "Control Panel" and "Resource Manager". And I can't even open Start Menu when recording. In Logging window, I saw the following exceptions.
Record on "Control Panel":
[14:13:32.333][Error] System.NullReferenceException: Object reference not set to an instance of an object.
at OpenRPA.Windows.WindowsSelectorItem..ctor(AutomationElement element, Boolean isRoot, Int32 IndexInParent)
at OpenRPA.Windows.WindowsSelector..ctor(AutomationElement element, WindowsSelector anchor, Boolean doEnum)
at OpenRPA.Windows.Plugin.<>c__DisplayClass25_0.<OnMouseUp>b__0()
[14:13:31.483][Information] Selector had 7 items to root, but traversing children only matched 4
[14:13:31.248][Error] System.NullReferenceException: Object reference not set to an instance of an object.
at OpenRPA.Windows.WindowsSelectorItem..ctor(AutomationElement element, Boolean isRoot, Int32 IndexInParent)
at OpenRPA.Windows.WindowsSelector..ctor(AutomationElement element, WindowsSelector anchor, Boolean doEnum)
at OpenRPA.Windows.Plugin.<>c__DisplayClass25_0.<OnMouseUp>b__0()
[14:13:30.403][Information] Selector had 7 items to root, but traversing children only matched 4
[14:13:29.995][Error] System.NullReferenceException: Object reference not set to an instance of an object.
at OpenRPA.Windows.WindowsSelectorItem..ctor(AutomationElement element, Boolean isRoot, Int32 IndexInParent)
at OpenRPA.Windows.WindowsSelector..ctor(AutomationElement element, WindowsSelector anchor, Boolean doEnum)
at OpenRPA.Windows.Plugin.<>c__DisplayClass25_0.<OnMouseUp>b__0()
[14:13:29.097][Information] Selector had 7 items to root, but traversing children only matched 4Record on "Resource Manager":
[14:14:53.602][Error] System.NullReferenceException: Object reference not set to an instance of an object.
at OpenRPA.Windows.WindowsSelectorItem..ctor(AutomationElement element, Boolean isRoot, Int32 IndexInParent)
at OpenRPA.Windows.WindowsSelector..ctor(AutomationElement element, WindowsSelector anchor, Boolean doEnum)
at OpenRPA.Windows.Plugin.<>c__DisplayClass25_0.<OnMouseUp>b__0()
[14:14:52.919][Error] System.NullReferenceException: Object reference not set to an instance of an object.
at OpenRPA.Windows.WindowsSelectorItem..ctor(AutomationElement element, Boolean isRoot, Int32 IndexInParent)
at OpenRPA.Windows.WindowsSelector..ctor(AutomationElement element, WindowsSelector anchor, Boolean doEnum)
at OpenRPA.Windows.Plugin.<>c__DisplayClass25_0.<OnMouseUp>b__0()
[14:14:52.748][Information] Selector had 10 items to root, but traversing children only matched 8
[14:14:52.073][Information] Selector had 10 items to root, but traversing children only matched 8
[14:14:50.923][Error] System.NullReferenceException: Object reference not set to an instance of an object.
at OpenRPA.Windows.WindowsSelectorItem..ctor(AutomationElement element, Boolean isRoot, Int32 IndexInParent)
at OpenRPA.Windows.WindowsSelector..ctor(AutomationElement element, WindowsSelector anchor, Boolean doEnum)
at OpenRPA.Windows.Plugin.<>c__DisplayClass25_0.<OnMouseUp>b__0()
[14:14:50.054][Information] Selector had 9 items to root, but traversing children only matched 7But it works fine for Calculator and "Microsoft Store". It seems to me OpenRPA can't work for classic applications, only work for new Windows 10 applications. Why is that?
I'm using OpenRPA 1.2.20 and 1.2.31, installed by using your msi installer files. Both have the same issue.
-
I debug the code and found it's WindowsSelectorItem constructor throwing exception.
I tried to solve the issue by adding info.Filename != null in the if clause. This exception is gone but there is another exception thrown in WorkflowTrackingParticipant.cs file when playing the recorded workflow.
So clicking Start button and launching an application still can't work on my machine.
-
Hey Bill
Thank you for taking your time to report and troubleshoot this.
So the last part about WorkflowTrackingParticipant.cs is clearly a mistake, I should not expect all activities to have a display name.
But regarding recording. Neither me, nor anyone i have done remote support with, have ever had issues finding things in the start menu or explorer. I'm also not able to reproduce issues with resource manager. Except if launching the resource manager from task manager, then it will not work. Openrpa should always run in the user context, and there fore it will not have permission to interact with task manager or resource manager launched from task manager, but if you launch resource manager from the start menu, it has no issues interacting with it. -
So clicking Start button and launching an application still can't work on my machine.
You are not suppose to launch things from the start menu, but use the "Open Application" activity.
-
Yes, it's very strange. One of my friends don't experience my issue. On his machine, OpenRPA can record all operations on Start button, on Control Panel, and on Resource Manager without any issue. We're using the same version of Windows 10, 2004. The only difference is I'm using 2 monitors. He is using one. But I unplug one of my monitors, the issue is still there.
-
Since you seem to be no stranger to C# and visual studio and already have the code base locally. Try adding a breakpoint to GetProcessInfo inside OpenRPA.Interfaces.Extensions and see why it's returning nothing.
My best guess is a permission issue ? -
Hi Allan,
Just now, I carefully debug the code and found the exception was actually thrown in the GetProcessInfo(), shown below:
And to avoid Filename is null, I added an additional line of code in 444 to set Filename to ProcessName, which seems solve the issue, as I know afterwards the Filename property will be used in multiple places. So set it to something is better leave it null.
But I still don't know why on my machine the Process.MainModule would throw exception for some applications. And my Windows account has administrator privilege indeed.
And actually, I installed OpenRPA on several other machines today. They all have no same issue as I met on my machine. It's really weird. I googled and found there were discussions about this kind of exception, like the following link.
https://social.msdn.microsoft.com/Forums/vstudio/en-US/4f946750-6c47-406c-810c-21a2b103b5c4/crash-in-processmainmodulequotonly-part-of-a-readprocessmemory-or-writeprocessmemory-request-was?forum=csharpgeneral
But still can't figure out what causes the exception on my machine.And meanwhile, to replay the recording, sometimes, Track() method of WorkflowTrackingParticipants class throws exception, as shown below:
Sometimes, All activities in the collection of Instance.Activities are null. So to avoid the exception I added another condition in the if clause, which seems solve the issue. Please help check if the change is necessary. -
Based on the links you found. Could you change the openrpa to x64 and see if that fixes the issue ?
Also, we should avoid nulls completely in the array, so try and change line 183 instead
-
If I google "Only part of a ReadProcessMemory or WriteProcessMemory request was completed" some posts say this error is specific to windows 10 ( you confirmed that ) but others are also blaming it defender.
Are you using some anti virus software besides Microsoft Defender ? If you are, are you will to try and disable/uninstall it for a short test, to see if that is the issue ? -
When I opened the project setting and found the platform target is already x64 by default. So this should not be a reason.
-
Oh, maybe we DID find the issue then.
On mine it's set too "Any CPU" and most posts mention that the fix is setting it to "any CPU" ( but I assumed yours already was, so I just recommended to test the opposite ) -
Yes, there is an anti-virus software running on my machine. But it should not be the reason, because as I said I tried on other machines, which have almost the same Windows and other software, including anti-virus one. Only my machine got that exception.
-
Makes sense, lets try the any cpu thing then.
-
I changed OpenRPA to Any CPU and rebuilt the whole solution, but the exception is still there as before.
-
Ok, that's a shame. I'm running out of good idea's then.
I came a cross some code on how to get the information using native windows dll's instead of .net, I will see if I can find it a little later. -