XML Loop Elements With LINQ - XNamespace

Dear, I’m a beginner in uipath and also in LINQ language and I’m trying to loop all the elements of this xml to get the value of the element “numeroGuiaPrestado” using LINQ, however in the activity “For Each” I get the following error:

“For Each: An ActivityContext can only be accessed within the scope of the function it was passed into.
Object name: ‘System.Activities.CodeActivityContext’.”

Could you help me to solve the problem?

My LINQ Query:

(From el In xDoc.Descendants(ans + “guiaMonitoramento”)
Select el.Element(ans + “numeroGuiaPrestador”)
)

Ok, Try.
First convert your LinqQuery expression in a List

(…youExpression…).ToList()