How To Troubleshoot The Error Cannot Create Unknown Type?

The Attended Robot can not download a package, because it gets the error "Cannot create unknown type". Unable to run unattended job from Orchestrator, because it fails with "Cannot create unknown type"

System.Xaml.XamlObjectWriterException: Cannot create unknown type.

The error “Cannot create unknown type{followed by activity name}” is common and it is caused by unresolved dependencies (or packages) within the project that you try to publish to Orchestrator or execute with a UiPath Robot - be it Attended or Unattended. A dependency does not get resolved if it cannot be retrieved from the package source.

In order to troubleshoot this, follow the below approaches:

  1. If the Robot runs on a computer with protected Internet access, whitelist specific endpoints in the firewall/proxy solution. See advice on that on the "Services the Robot connects to" page.
    Also, route the Robot through the proxy, as explained on the Redirecting Robots Through a Proxy Server page.
    This will enable the Robot to download on its own whatever packages it needs from the sources, with no manual intervention.
  2. If the Robot runs on a restricted computer (with Internet access allowed only to Orchestrator), then manage the packages internally. Make sure that the Robot has full access to the location where the Nuget packages are stored and that the folder is populated with all the packages the Robot might need.
The default location is %userprofile%\.nuget\packages, but that can be changed, as advised on the Custom Package Folders and Network paths page.
So, if a custom location is used, check that one if it contains the packages the Robot needs.

If using multiple (Robot) computers and if noticed that the Robot has no execution issues on one of the other computers, then navigate to the Nuget package location on the working PC and copy the folder of the affected activity (you see which it is in the error message) and replace the same package folder into the computer of the failing Robot.

Alternatively, force the Robot to re-create the .nuget local package source. The steps on how to do this are explained in this article at "Approach #2" - Could not load file or assembly