Environment.CurrentDirectory changes after error in custom Library

Scenario: When a custom activity (from a library) throws an error, the Environement.CurrentDirectory changes from the project folder that uses the custom activity to the library folder. This causes any subsequent use of Invoke Workflow File in the main project to crash with error “Could not find a part of the path…”.

Steps to reproduce: Create a library with a custom activity and use Throw activity to exit with error. Use the custom activity inside a project in a workflow. Use Invoke Workflow File to invoke the workflow with the custom activity, surround the Invoke Workflow File activity with Try Catch and on catch use another Invoke Workflow Activity.

Current Behavior: Invoke workflow File activity crashes with error “Could not find a part of the path…”.

Expected Behavior: Invoke workflow File should work normally.

Studio/Robot/Orchestrator Version: 2018.3.2

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

1 Like

I have found a workaround. Surround the custom activity with a Try Catch activity and on catch use Rethrow activity.