MongoDB_CollectionToDataTable: Exception has been thrown by the target of an invocation

Error to execute Sequence:
MongoDB_CollectionToDataTable: Exception has been thrown by the target of an invocation.

image

The problem:

@Optimus_Prime

Please openthe locals panel and check the exception details which would actually give more details about the error

Cheers

this is message Output panel

image

@Optimus_Prime

Please check the locals panel and not the output panel…when you run in debug and when error is throw…please open the locals panel and expand exception details

Cheers

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. —> System.TypeLoadException: Could not load type ‘MongoDB.Shared.ApplicationNameHelper’ from assembly ‘MongoDB.Driver, Version=2.19.2.0, Culture=neutral, PublicKeyToken=null’. at MongoDB.Driver.MongoServerSettings.set_ApplicationName(String value)
at MongoDB.Driver.MongoServerSettings.FromClientSettings(MongoClientSettings clientSettings)
at MongoDB.Driver.MongoClientExtensions.GetServer(MongoClient client)
at UiPath.CodeRunner.UiPathCodeRunner_fe21c482deac43d387f5292874fa1c27.Run(String MongoDbConnectionString, String DatabaseName, String CollectionName, DataTable& dt)
— End of inner exception stack trace —
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object parameters, Object arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object parameters, CultureInfo culture)
at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object providedArgs, ParameterModifier modifiers, CultureInfo culture, String namedParams)
at UiPath.Activities.System.Utilities.InvokeCode.CompilerRunner.Run(Object args)
at UiPath.Activities.System.Utilities.InvokeCode.NetCodeInvoker.Run(String userCode, List1 inArgs, IEnumerable1 imps, Object args)
at UiPath.Core.Activities.InvokeCode.Execute(CodeActivityContext context)
at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.ActivityInstance.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)
— End of stack trace from previous location where exception was thrown —
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at UiPath.Executor.BaseRunner.EndExecute(IAsyncResult result)
at UiPath.Executor.InProcessRunner.EndExecute(IAsyncResult result)
at UiPath.Core.Activities.ExecutorInvokeActivity.EndExecute(AsyncCodeActivityContext context, IAsyncResult result)
at System.Activities.AsyncCodeActivity.System.Activities.IAsyncCodeActivity.FinishExecution(AsyncCodeActivityContext context, IAsyncResult result)
at System.Activities.AsyncCodeActivity.CompleteAsyncCodeActivityData.CompleteAsyncCodeActivityWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)

@Optimus_Prime

Looks like a reference is missing

please change the version and check if it works

or go to c:\users\<username>\.nuget\packages and delete the mongo db related package folder and then re open the project which will redownload the dependency again or re add the dependency through manage packages

cheers