Cannot create unknown type - KB - KB

System.Xaml.XamlObjectWriterException: Cannot create unknown type

On cases where an external application like Jenkins, Azure CI-CD is used for publishing of projects, due to the way the application is setup, it might corrupt the NuGet packages leading to this error. Quick way to verify this is by publishing the project without the intermediate application and see if you still get the error.

Proceed to below steps if the issue still persists or if there is no intermediate application used for publishing.

UiPath Robot automatically installs/ resolves all the required dependencies when the Process is Executed from Robot Tray or Orchestrator. The robot looks to download the Packages from the below feeds by default:
1. Robot Location - C:\Users{user profile} \ .nuget\packages
2. Orchestrator feed -  ~/NuGetPackages/Activities
3. MyGet feed

As you are facing this issue, it is not available in 1st & 2nd location, also it is not able to fetch the required package from Myget feed or the package is not available in Myget feed [might be a custom one] as well.

Permanent solution Approach: 
To auto download  the missing packages we need to whiltelist the web address
Kindly white-list the below 2 host addresses mentioned in the Robot page -
MyGet.org
NuGet.org

Reference here

Also configured Robot needs to have admin privileges on the system to perform all operation i.e. download of required packages . 

Immediate Fix : 

Error : 
Cannot create unknown type 

All the missing packages need to be moved to the Orchestrator location or Robot local feed. 
Also verify the event viewer logs to identify all the missing additional packages which is required to be moved with the help of dependencies mentioned in project.json file.

The process is working fine because the studio has successfully downloaded the packages and used in development of the process whereas Robot is not able to as Host Addresses is/are not whitelisted.

Please follow the below steps : 

Copy the identified nupkg %localappdata% \ uipath \ Activities location[Applicable for UiPath v lower than 2018.3.x] and C:\Users{user profile} \ .nuget\packages\ [Applicable for UiPath v 2018.3.x onward] from development environment where the process is working &  paste the missing packages inside Activities folder that is present in
C:\Program Files (x86)\UiPath\Orchestrator\NuGetPackages\Activities path in orchestrator server. 

In order to identify the missing packages from Event viewer logs, we should try enabling low level tracing logs : 
Steps to Enable Logging: 
Step 1: Open command Prompt 
Step 2: Change directory to UiPath installation Folder cd C:\Program Files (x86)\UiPath\Studio
Step 3: UiRobot.exe --enableLowLevel
Step 4: Execute the Job from Robot Tray or Orchestrator. 
Step 5: UiRobot.exe --disableLowLevel

Step 3, should start generating the Low level Logs in Event Viewer. The Event Viewer will capture any failures with dependency like "Package Version Not found" in the Sources configured. 

Note 1 : copy only the nupkg file and directly place in ~/NuGetPackages/Activities 

Note 2 : Post 2019.4.x, we have Legacy and Composite repository. So above location will work fine for Legacy repository, but for Composite : If there is any new location provided for packages Storage.Location needs to be considered.

Version: 2018.2.3 onward