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.

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.

1 Like

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