Public location reference error

uiautomation
java
p_dev

#1

Hi all,

Today in one of the projects we’ve encountered an interesting issue, which we haven’t seen before.

We can’t share the workflow. It’s a Java application, from which we use GetChildren(descendants) in one of the windows, afterwhich the IEnumerable(Of UiElement) is filtered with a .Where clause checking it’s position.

Error is below.

Any ideas what might be causing this?
We’ve already used these kind of constructs (find children, filter using position and iterate).
It seems like some issue with caching the metadata (maybe), but we’re a little stuck here…

test has thrown an exception Message: Activity '1.12: VisualBasicValue<String>' cannot access this public location reference because it is only valid for activity '1.17: VisualBasicValue<IEnumerable<UiElement>>'. Only the activity which obtained the public location reference is allowed to use it. Source: Message box Exception Type: InvalidOperationException System.InvalidOperationException: Activity '1.12: VisualBasicValue<String>' cannot access this public location reference because it is only valid for activity '1.17: VisualBasicValue<IEnumerable<UiElement>>'. Only the activity which obtained the public location reference is allowed to use it. at UiPath.Core.Activities.ScopeActivity.OnFaulted(NativeActivityFaultContext faultContext, Exception propagatedException, ActivityInstance propagatedFrom) at System.Activities.Runtime.FaultCallbackWrapper.Invoke(NativeActivityFaultContext faultContext, Exception propagatedException, ActivityInstance propagatedFrom) at System.Activities.Runtime.FaultCallbackWrapper.FaultWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)


#2

Just googled the error and found below. Pls ignore if already tried.


#3

Tried that, it changes the exception, but still it doesn’t work.

Message: Error HRESULT E_FAIL has been returned from a call to a COM component. Source: Assign Exception Type: ElementOperationException UiPath.Core.ElementOperationException: Error HRESULT E_FAIL has been returned from a call to a COM component. ---> System.Runtime.InteropServices.COMException: Error HRESULT E_FAIL has been returned from a call to a COM component. at UiPath.IUiNode.Get(String bstrAttr) at UiPath.Core.UiElement.Get(String attribute, Boolean refresh) --- End of inner exception stack trace --- at UiPath.Core.Activities.ScopeActivity.OnFaulted(NativeActivityFaultContext faultContext, Exception propagatedException, ActivityInstance propagatedFrom) at System.Activities.Runtime.FaultCallbackWrapper.Invoke(NativeActivityFaultContext faultContext, Exception propagatedException, ActivityInstance propagatedFrom) at System.Activities.Runtime.FaultCallbackWrapper.FaultWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)

BTW - the actual query used was:
testChildren.Where(Function(x) x.GetPosition.Rectangle.Value.X = cell14X).ToList().AsEnumerable()
cell14X is an Int variable with a value taken from individual search on cell1:1 via ID14.


#4

hi,
Did u resolve the above issue?

I’m getting a similar error message while filtering email from List from outlook activity.
Error message:

Message box : Activity ‘1.11: VisualBasicValue’ cannot access this public location reference because it is only valid for activity ‘1.16: VisualBasicValue<IEnumerable>’. Only the activity which obtained the public location reference is allowed to use it.

UIPATH:
IEnumerable = From x In mailMessages Where dt1.Equals(dt2);
Getting above error while looping the mailmessage in foreach activity.


#5

I wouldn’t say resolve, but worked around.

Instead of working on an IEnumerable<T> changed the variables to be Arrays<T> and ended the Linq with a .ToArray() call. Not ideal, as working with interfaces is IMHO cleaner (and also there’s no more delayed execution anymore, as well as allocations are different etc.), but it did the job.

So in your example it would look like:
MailMessage() = (From x In mailMessages Where dt1.Equals(dt2)).ToArray()