title: Entity Framework Core SaveChanges causes error on Mac
body: <p>I'm currently trying to build an EF core project, but when I call db.SaveChanges() I get the following error:</p>
  
  <pre><code>System.TypeInitializationException: The type initializer for 'Microsoft.Data.SqlClient.InOutOfProcHelper' threw an exception. ---&gt; System.EntryPointNotFoundException: GetModuleHandle assembly:&lt;unknown assembly&gt; type:&lt;unknown type&gt; member:(null)
    at (wrapper managed-to-native) Microsoft.Data.Common.SafeNativeMethods.GetModuleHandle(string)
    at Microsoft.Data.SqlClient.InOutOfProcHelper..ctor () [0x00006] in &lt;a1c8e16fd44948ee8c6a463f125e71f0&gt;:0 
    at Microsoft.Data.SqlClient.InOutOfProcHelper..cctor () [0x00000] in &lt;a1c8e16fd44948ee8c6a463f125e71f0&gt;:0 
     --- End of inner exception stack trace ---
    at Microsoft.Data.SqlClient.SqlConnectionString..ctor (System.String connectionString) [0x0000d] in &lt;a1c8e16fd44948ee8c6a463f125e71f0&gt;:0 
    at Microsoft.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions (System.String connectionString, Microsoft.Data.Common.DbConnectionOptions previous) [0x00000] in &lt;a1c8e16fd44948ee8c6a463f125e71f0&gt;:0 
    at Microsoft.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup (Microsoft.Data.Common.DbConnectionPoolKey key, Microsoft.Data.ProviderBase.DbConnectionPoolGroupOptions poolOptions, Microsoft.Data.Common.DbConnectionOptions&amp; userConnectionOptions) [0x0003e] in &lt;a1c8e16fd44948ee8c6a463f125e71f0&gt;:0 
    at Microsoft.Data.SqlClient.SqlConnection.ConnectionString_Set (Microsoft.Data.Common.DbConnectionPoolKey key) [0x00008] in &lt;a1c8e16fd44948ee8c6a463f125e71f0&gt;:0 
    at Microsoft.Data.SqlClient.SqlConnection.set_ConnectionString (System.String value) [0x0006b] in &lt;a1c8e16fd44948ee8c6a463f125e71f0&gt;:0 
    at Microsoft.Data.SqlClient.SqlConnection..ctor (System.String connectionString, Microsoft.Data.SqlClient.SqlCredential credential) [0x00006] in &lt;a1c8e16fd44948ee8c6a463f125e71f0&gt;:0 
    at Microsoft.Data.SqlClient.SqlConnection..ctor (System.String connectionString) [0x00000] in &lt;a1c8e16fd44948ee8c6a463f125e71f0&gt;:0 
    at (wrapper remoting-invoke-with-check) Microsoft.Data.SqlClient.SqlConnection..ctor(string)
    at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerConnection.CreateDbConnection () [0x00006] in &lt;5c775909c1cf40629fd2452310cf8cc1&gt;:0 
    at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.get_DbConnection () [0x0000a] in &lt;5314a29febc14288a1bc53bf7b46d725&gt;:0 
    at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.CreateCommand (Microsoft.EntityFrameworkCore.Storage.RelationalCommandParameterObject parameterObject, System.Guid commandId, Microsoft.EntityFrameworkCore.Diagnostics.DbCommandMethod commandMethod) [0x0005c] in &lt;5314a29febc14288a1bc53bf7b46d725&gt;:0 
    at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReader (Microsoft.EntityFrameworkCore.Storage.RelationalCommandParameterObject parameterObject) [0x00027] in &lt;5314a29febc14288a1bc53bf7b46d725&gt;:0 
    at Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable`1+Enumerator[T].InitializeReader (Microsoft.EntityFrameworkCore.DbContext _, System.Boolean result) [0x00050] in &lt;5314a29febc14288a1bc53bf7b46d725&gt;:0 
    at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerExecutionStrategy.Execute[TState,TResult] (TState state, System.Func`3[T1,T2,TResult] operation, System.Func`3[T1,T2,TResult] verifySucceeded) [0x00011] in &lt;5c775909c1cf40629fd2452310cf8cc1&gt;:0 
    at Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable`1+Enumerator[T].MoveNext () [0x00193] in &lt;5314a29febc14288a1bc53bf7b46d725&gt;:0 
    at System.Linq.Enumerable.SingleOrDefault[TSource] (System.Collections.Generic.IEnumerable`1[T] source) [0x00041] in /Users/builder/jenkins/workspace/build-package-osx-mono/2019-10/external/bockbuild/builds/mono-x64/external/corefx/src/System.Linq/src/System/Linq/Single.cs:104 
    at (wrapper dynamic-method) System.Object.lambda_method(System.Runtime.CompilerServices.Closure,Microsoft.EntityFrameworkCore.Query.QueryContext)
    at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.Execute[TResult] (System.Linq.Expressions.Expression query) [0x00075] in &lt;a3dbe48366454fdbb51dfeeb0b5c4997&gt;:0 
    at Microsoft.EntityFrameworkCore.Query.Internal.EntityQueryProvider.Execute[TResult] (System.Linq.Expressions.Expression expression) [0x00000] in &lt;a3dbe48366454fdbb51dfeeb0b5c4997&gt;:0 
    at System.Linq.Queryable.FirstOrDefault[TSource] (System.Linq.IQueryable`1[T] source) [0x0000e] in /Users/builder/jenkins/workspace/build-package-osx-mono/2019-10/external/bockbuild/builds/mono-x64/external/corefx/src/System.Linq.Queryable/src/System/Linq/Queryable.cs:729 
    at GenericEFIAPI.RTATenantsDatabaseHelper.convertTenant (System.String tenantId, GenericEFIAPI.configObject config, GenericEFIAPI.models.TenantDatabase db) [0x002d2] in /Users/jft/projects/GenericAPI/GenericEFIAPI/RTATenantsDatabaseHelper.cs:108 
    at GenericEFIAPI.Program+&lt;&gt;c__DisplayClass1_0.&lt;Main&gt;b__0 (GenericEFIAPI.Program+Options o) [0x000c1] in /Users/jft/projects/GenericAPI/GenericEFIAPI/Program.cs:78 
    at CommandLine.ParserResultExtensions.WithParsed[T] (CommandLine.ParserResult`1[T] result, System.Action`1[T] action) [0x00011] in &lt;68c69d6559fd42bc897efd2a474dfda9&gt;:0 
    at GenericEFIAPI.Program.Main (System.String[] args) [0x00013] in /Users/jft/projects/GenericAPI/GenericEFIAPI/Program.cs:38 
  </code></pre>
  
  <p>I've tried looking around on google for some help, but have come up empty so far... Anybody have any ideas?  I'm trying to connect to sql server and using DbContextOptionsBuilder().UseSqlServer() for the underlying connection.</p>
  
  <p>I'm currently getting my old windows laptop up and running to see if it is because I'm on a Mac or not, but I thought I would get this question out there in the mean time.</p>