I’m having an issue with an invoke code, in the Core.xaml I’ve drag’n’dropped some other files ‘.xaml’ that are in the same folder of the main project.
Unexpectedly, the first invoke code works but the second one doesn’t. The error occurs running on studio (didn’t tried to publish and run) and the error studio shows is
What I don’t understand is the path of the error, it is not the current path of the directory and it is mentioned nowhere in the project… actually it is a component used on the automation.
Here is the invoke code and it is correct (the file is inside a folder ‘WorkFlows’)
@jonathan_peixoto are you using the invoke workflow file inside parallel scope? Can you please share a screenshot of the process you are creating?
One workaround would be to save at the start of your workflow Environment.CurrentDirectory in a variable (InitialPath) and in invoke workflow to call InitialPath+“WorkFlows\CCDA.xaml”.
I see in your screenshot you have both / and \ to indicate the path to the workflows.
Make sure all of them use \ (e.g. “Workflows\CCDA.xaml”) and that those workflows are actually saved inside the folder Workflows in your project folder.
Hi @Daniela_Colina,
Thanks for the observation, I changed all paths to use “\” and yes, files are inside folder ‘WorkFlows’ as the print. But the error still occurs
Are you opening the project from the folder you showed in the error screenshot?
Can you copy the content of the folder net45 into another folder like Desktop and try to open the project from there and execute?
@alexandru I logged the current directory before the invoke of the file and look this:
That’s why it is not finding the “WorkFlows” folder neither the CCDA.xaml.
But, this is the strange thing: If i comment the first invoke code (WorkFlows\CBC.xaml) than the path is correct, look the print below.
How can the file CBC.xaml change the CurrentDirectory path of the project when it is runnning?
Here is a print of the major logic, it has some throws inside that sequences, assign’s to variables and arguments, but, nothing directly changes the Environment.CurrentDirectory.
Can you please share the files (the whole project)? I am almost sure you have some parallel/pick branch activities that are doing actions in a non-safe parallel way leading to current directory change.
At least what is the content of the pick branch sections?
Could you explain what is a non-safe parallel actions that may be the problem? Personaly I dont see any possible activitie that is manipulating the directory
That activitie ‘Espera algum dos textos…’ is a library I’ve created, and it uses Parallel For Each as you mentioned. Actually it doesn’t change any directory path but, may the way parallel is interpreted during execution has something to do with this behavior ?!
I ran into the same issue in my workflow. Indeed using a variable for the currentdirectory works, however after using this, the ‘Open Workflow’ button from the invoke doesn’t work anymore and it keeps showing warnings about the arguments, so it’s not a workable option for us. Is there any other alternative you can recommend?
I was thinking of building a check before the invokes that checks if the directory is the same as the current directory, but not sure how to go about that. How can I see what directory the robot is looking at?
Has you/ UiPath Team managed to fix this issue? Apparently, this issue persists even now as of 16.03.2022. I am using Enterprise Studio version 2021.10.5.
Using the current path is NOT an option as it makes maintenance more difficult as we can not use the open workflow button while debugging. Any help would be highly appreciated.
Thanks.
Hello. I can confirm that this keeps happening as for 20/05/2022.
Building a pick-branch with throws inside of it leads to a change on the global CurrentDirectory path, so if you call any file after that, the flow will crash.
@loginerror - yeah, as @pdelgadogp1 mentioned, the problem still exists (v22.4.4). Do you have any info on a timeline for the fix?
@pdelgadogp1, @Akshay_More, @EvelineL, @jonathan_peixoto
Instead of adding a variable to the workflow file name of the Invoke Workflow activity you can execute SetCurrentDirectory method via Invoke Method activity
It takes a string as an input parameter so you can pass the base directory if you capture it at the very beginning of the workflow.
One option to explore, which I havent tested yet, would be to take care of that in the global handler i.e. File path cannot be found, restore CurrentDirectory and retry