Invoke code "Could not find a part of the path" - Xaml is in the current folder project

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’)image

Any suggestions are welcomed.

@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”.

@alexandru I’m not using inside parallel scope, just a normal sequence.

I’ve tried calling it with the fullpath but it seems studio still concatenates the current project path at the begin, so it doesn’t work.

Here is another screenshot of the process, note that the first invoke (“1 - CBC”) works, but the second (“2 - CCDA”) doesn’t.

Hi @jonathan_peixoto,

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.

Best,
Daniela

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 :confused:
image

Thanks in advance.

Hi @jonathan_peixoto,

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?

Best,
Daniela

No @Daniela_Colina, the project path is not that '.nuget\packages' and at that folder there is any file called CCDA.xaml.

The question for me is why studio tries to find this file there? at the project the path is just “WorkFlows\CCDA.xaml”

@jonathan_peixoto can you try to print in a log message the Environment.CurrentDirectory before the invoke wf file that is failing?

Also please try to indicate the xaml via browse for file to make sure the path is correct.
image

What is the activity Volta Menu Legado doing? Can you share the xaml for that file?

@alexandru I logged the current directory before the invoke of the file and look this:
image
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.
image

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?

I cannot share the whole project but, inside pick branch it does just some TypeInto, assign and throw activities

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

This is exactly as I asked in the first post. Looks like you have activities originating from libraries. This can change the current directory.
image

My suggestion is to save the current directory to a variable when execution starts and in the invoke wf file to call CurrentPathVar+PathToXaml.

2 Likes

@alexandru thanks, this way it works

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 ?!

Well, thanks for the support!

The library activities are doing a context change when they are expected. And this combined with parallel can lead to the error you are seeing.

This is a known issue on our side that we plan to address in a future release.

Hello,

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?

Thanks!

1 Like

Hello Mr. Roman,

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.

Hi @Akshay_More

I would advise you to contact our technical support via this form to discuss the issue further:

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.

1 Like

Hi,

@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

image

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

A hacky workaround but a working one nontheless

1 Like