AnsweredAssumed Answered

.Net Core Addin with EF Core throwing initialize error

Question asked by Cody Kirsch on Jun 24, 2020
Latest reply on Jul 1, 2020 by Cody Kirsch

I am making an addin that needs to connect to a database through a .NET Core class library that uses Entity Framework Core. The addin is also a .NET Core project. The addin will need to read from the database when drawings are opened,  update custom properties from the data, and write to the database after the drawing is closed.


The addin is registered with SolidWorks but when running regsvr32 I get a "dllregisterserver error 0x80131604". The ConnectToSW function does get called by SolidWorks and the DbContext object can be created but an exception is thrown when tables are querying. I have tried querying data before and after

 

The message is "The type initializer for 'Microsoft.Data.SqlClient.SqlConnection' threw an exception."

The exception stack is

'System.PlatformNotSupportedException' in System.Configuration.ConfigurationManager.dll
'System.Configuration.ConfigurationErrorsException' in System.Configuration.ConfigurationManager.dll
'System.Configuration.ConfigurationErrorsException' in System.Configuration.ConfigurationManager.dll
'System.InvalidOperationException' in Microsoft.Data.SqlClient.dll
'System.TypeInitializationException' in Microsoft.Data.SqlClient.dll
'System.TypeInitializationException' in Microsoft.EntityFrameworkCore.Relational.dll

Outcomes