Terminal Session Activity Throws "Job Stopped With An Unexpected Exit Code: 0xC0000005"

How to troubleshoot error ("Job stopped with an unexpected exit code: 0xC0000005") thrown from the terminal activities?

Issue Description

Error "Job stopped with an unexpected exit code: 0xC0000005" occurs while executing a process that contains terminal activities.

Root Cause

In the Event viewer, the following event is generally registered around the same time frame when the above error is observed: (version number in the error message might differ)
Faulting application name: UiPath.Executor.exe, version: 20.10.2.0, time stamp: 0xae86a8f8
Faulting module name: ttermdotnet.dll, version: 2.0.0.10428, time stamp: 0x60f7bab1
Exception code: 0xc0000005
Fault offset: 0x0053b185
Faulting process id: 0x1758
Faulting application start time: 0x01d80d2e74eab54b
Faulting application path: C:\Program Files (x86)\UiPath\Studio\UiPath.Executor.exe
Faulting module path: C:\Users\\.nuget\packages\uipath.terminal.activities\2.4.0\build\x86\ttermdotnet.dll
  • Security defending software like anti-virus or others installed in the machine might block ttermdotnet.dll and its dependencies causing the terminal activities to fail.
  • Also, if any of the below-mentioned dependencies (most of them are from Microsoft) of ttermdotnet.dll is not loaded or corrupted, the error is thrown.
    • KERNEL32.dll
    • USER32.dll
    • GDI32.dll
    • SHELL32.dll
    • ole32.dll
    • OLEAUT32.dll
    • ADVAPI32.dll
    • MSVCP140.dll
    • bcrypt.dll
    • VCRUNTIME140.dll
    • api-ms-win-crt-runtime-l1-1-0.dll
    • api-ms-win-crt-stdio-l1-1-0.dll
    • api-ms-win-crt-string-l1-1-0.dll
    • api-ms-win-crt-heap-l1-1-0.dll
    • api-ms-win-crt-locale-l1-1-0.dll
    • api-ms-win-crt-time-l1-1-0.dll
    • api-ms-win-crt-convert-l1-1-0.dll
    • api-ms-win-crt-environment-l1-1-0.dll
    • api-ms-win-crt-filesystem-l1-1-0.dll
    • api-ms-win-crt-utility-l1-1-0.dll
    • WS2_32.dll

Resolution

  1. To repair the terminal activity and its dependencies,
    1. Remove all the existing package version folders from %userprofile%\.nuget\packages\uipath.terminal.activities directory
    2. Open Manage Packages in UiPath Studio and reinstall the latest version of UiPath.Terminal.Activities.
    3. Retry to establish the terminal connection or execute the process.
  2. Check if the above-mentioned dependency dlls exists using the command:
  • dumpbin /DEPENDENTS ttermdotnet.dll