Steps to reproduce:
- Use the MongoDBDataSource as demonstrated in the following online example: Reporting for WinForms - Bind a Report to a MongoDB Instance.
- Update the MongoDB.Driver NuGet package to v3.0.0 or higher.
Current results:
The following exception is thrown:
Call StackDevExpress.DataAccess.MongoDB.DatabaseConnectionException
HResult=0x80131500
Message=Failed to connect to the database. To learn more, see the exception details.
Exception details:
Connection name: Connection
Error message:
The type initializer for 'DevExpress.DataAccess.Native.MongoDB.MongoDBClient' threw an exception.
Source=DevExpress.DataAccess.v24.2
StackTrace:
at DevExpress.DataAccess.MongoDB.MongoDBDataConnection.Open(CancellationToken token)
at DevExpress.DataAccess.Native.MongoDB.QueryExecutor.ExecuteQueries(MongoDBDataConnection connection, IEnumerable\\\`1 queriesToFill, IList\\\`1 sourceParameters, Int32 schemaDiscoveryMaxItemCount, Boolean includeData, CancellationToken cancellationToken)
at DevExpress.DataAccess.MongoDB.MongoDBDataSource.FillCore(String[] queriesToFill, IList\\\`1 sourceParameters, Boolean includeData, CancellationToken cancellationToken)
at DevExpress.DataAccess.MongoDB.MongoDBDataSource.RebuildResultSchema()
at Bind_a_Report_to_a_MongoDB_Instance.Form1.Form1_Load(Object sender, EventArgs e) in Form1.cs:line 55
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
This exception was originally thrown at this call stack:
DevExpress.Xpo.Helpers.XPTypeActivator.GetType(string, string, bool)
DevExpress.DataAccess.Native.MongoDB.MongoDBClient.MongoDBClient()
Inner Exception 1:
TypeInitializationException: The type initializer for 'DevExpress.DataAccess.Native.MongoDB.MongoDBClient' threw an exception.
Inner Exception 2:
TypeLoadException: Could not find assembly 'MongoDB.Driver.Core'.