In SystemDataSqlServerAttributeReader.cs there is a static constructor which builds some arrays with types.
Oddly this seems to work perfectly when run in from my ide. When however doing a dotnet publish with single file output, the Type.GetType calls throw an exception, regardless of the bool parameter telling it to not throw.
Im using Microsoft.Data.SqlClient only, and have no reference on System.Data.SqlClient but still, the exception i get is:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
---> System.TypeInitializationException: The type initializer for 'LinqToDB.DataProvider.SqlServer.SqlServerMappingSchema' threw an exception.
---> System.TypeInitializationException: The type initializer for 'LinqToDB.Metadata.SystemDataSqlServerAttributeReader' threw an exception.
---> System.IO.FileLoadException: Could not load file or assembly 'System.Data.SqlClient, Culture=neutral, PublicKeyToken=null'. The parameter is incorrect. (0x80070057 (E_INVALIDARG))
File name: 'System.Data.SqlClient, Culture=neutral, PublicKeyToken=null'
---> System.ArgumentException: The path is empty. (Parameter 'path')
at System.IO.Path.GetFullPath(String path)
at System.Reflection.Assembly.LoadFromResolveHandler(Object sender, ResolveEventArgs args)
at System.Runtime.Loader.AssemblyLoadContext.InvokeResolveEvent(ResolveEventHandler eventHandler, RuntimeAssembly assembly, String name)
at System.Runtime.Loader.AssemblyLoadContext.OnAssemblyResolve(RuntimeAssembly assembly, String assemblyFullName)
at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, StackCrawlMarkHandle stackMark, ObjectHandleOnStack assemblyLoadContext, ObjectHandleOnStack type, ObjectHandleOnStack keepalive)
at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, StackCrawlMark& stackMark, AssemblyLoadContext assemblyLoadContext)
at System.RuntimeType.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase, StackCrawlMark& stackMark)
at System.Type.GetType(String typeName, Boolean throwOnError)
at LinqToDB.Metadata.SystemDataSqlServerAttributeReader..cctor()
--- End of inner exception stack trace ---
at LinqToDB.DataProvider.SqlServer.SqlServerMappingSchema..ctor()
at LinqToDB.DataProvider.SqlServer.SqlServerMappingSchema..cctor()
--- End of inner exception stack trace ---
...
In SystemDataSqlServerAttributeReader.cs there is a static constructor which builds some arrays with types.
Oddly this seems to work perfectly when run in from my ide. When however doing a dotnet publish with single file output, the Type.GetType calls throw an exception, regardless of the bool parameter telling it to not throw.
Im using Microsoft.Data.SqlClient only, and have no reference on System.Data.SqlClient but still, the exception i get is: