I was using MongoDB.Entities and had this error.
After deleting the folder in
C:\Users\USERNAME.nuget\packages\mongodb.entities
I edited the file
MongoDB.Entities.csproj
from:
netstandard2.0
to:
netstandard2.0;net461
recompiling, and reinstalling the package in uipath, my error went away.
If using MongoDB Entities, this is how to initialize the connection:
DB.InitAsync(strDatabase,MongoClientSettings.FromConnectionString(strConnectionstring));