System.IO.DirectoryNotFoundException: Could not find a part of the path

Scenario: Invoke Workflow breaks if previous invoke had an exception

Steps to reproduce:

Current Behavior:

Expected Behavior:

Studio/Robot/Orchestrator Version:

Last stable behavior:
Last stable version: 2019.3.0
OS Version: Windows 10
Others if Relevant: (workflow, logs, .net version, service pack, etc):

In my flow I use a lot of library items. My automation works with portals. Current library version is 1.0.7036.28896. I have an invoke which breaks if one of the portals is offline. If so, It should skip it and continue to the next portal. The invoke path is defined as “Portals\XXXXXXXXXXXX.xaml”, its the path you get if .xaml is selected from root folder. Now, if it previous call breaks, I get a try catch exception on invoke

System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Users\user.nuget\packages…\1.0.7036.28896\lib\net45\Portals\XXXXXXXXXXXX.xaml

This path is different to the folder where I have the file. I do not save files or library to this folder. But it has the name of a library I use. Can anyone explain what is going on?

P.S. If I change relative path to absolute it works fine, but this is obviously not what I want.

Hi @Ancher

Could you be a bit more visual in your description? I am not sure I follow the structure of your project.

I am having a similiar issue,
I am using the Enterprise Framework, and i have created some libraries that I published on orchestrator that i am callling on the Process.xaml, when something in my library encounters an error it throws a made-up Exception, then obviously it enter into the catch section for the invoke workflow for the Process, then my main workflow for some reason, when it tries to call SetTransaction.xaml it can’t, and sends me this error
SetTransactionStatus.xaml failed: Could not find a part of the path ‘C:\Users\90876\.nuget\packages\sap_va02selectlineitem\1.0.1\lib\net45\Framework\SetTransactionStatus.xaml’. at Source: mscorlib

and the process goes on with this fatal errors until it ends the process

Applications failed to close normally. Could not find a part of the path ‘C:\Users\90876\.nuget\packages\sap_va02selectlineitem\1.0.1\lib\net45\Framework\CloseAllApplications.xaml’. at Source: mscorlib

Invoke KillAllProcesses workflow: Could not find a part of the path ‘C:\Users\90876\.nuget\packages\sap_va02selectlineitem\1.0.1\lib\net45\Framework\KillAllProcesses.xaml’.

any idea why??, my best guess it maybe the library is not properly link or uiPath is not linking it properly, idk, any help is good

Hi @Josua_Amador

Does it happen on Studio Community Edition 2019.4?

I have the UiPath 2018.3.3 Enterprise Editon

As much as I like solving the issues on the Forum for public use, please do contact our technical support given your Enterprise edition:

They will be able to assist here much better, and if the issue is on the product side they will be able to escalate it further for our team to eventually fix it :slight_smile:

I have:

  1. Components of a master workflow starting off as a library, bundled up into a package called “Components Library”
  2. Main flow where I import Components Library via manage packages.
  3. Main flow using activities from Components Library instead of invokes.

Hope it makes sense.

Hi Ancher,

Usually if from the library is thrown an exception, this issue does not reproduce.

Interesting fact, the issue happens only when you have file of extensions other than .xaml in the library project folder. I had to add inside the library a folder with a .txt file and the issue was reproducing.

At runtime, when the library code executes, the current path is the one from C:\users<username>.nuget ( After the exception is thrown, and the code to execute is the current project code, still the current directory remained set to that value (in this particular case when you have other resources in the library).

In case you can not remove the other resources from the library, the workaround for fixing the issue would be to:

  1. create a variable in which we save the current directory path, before invoking Process.xaml where you use the library ( SavedCurrentDirectoryVariable =Directory.GetCurrentDirectory)

  2. on the catch Exception of invoke Process.xaml , use Invoke Method activity for System.IO.Directory.SetCurrentDirectory(SavedCurrentDirectoryVariable ) -> this will reset the correct directory.

An incident was opened for this issue.



Hi Daniela, we are using a similar workaround at the moment, but would love to see it fixed properly! Thank you very much for your input.

Kind regards,

Having the same issue. UI Path 2019.4.2 EE.

What works for me is rethrowing exception again in Catch inside workflow that I am invoking. It resets current directory to correct value
It also happens when I am using activity from library (directly on the process - NOT invoked on another workflow) - and rethrowing exception also works

FYI . Bug fix is planned for 2019.10 release.

@DanielaD thx for the information