dotnet / runtimelab

This repo is for experimentation and exploring new ideas that may or may not make it into the main dotnet/runtime repo.
MIT License
1.42k stars 199 forks source link

[AOT7.0]A type initializer threw an exceptio #2280

Closed lozn00 closed 1 year ago

lozn00 commented 1 year ago

A type initializer threw an exception. To determine which type, inspect the InnerException's StackTrace property.

inspect the InnerException's StackTrace property. System.Collections.ListDictionaryInternal type:System.TypeInitializationException at System.Runtime.CompilerServices.ClassConstructorRunner.EnsureClassConstructorRun(StaticClassConstructionContext) + 0x159\r\n at System.Runtime.CompilerServices.ClassConstructorRunner.CheckStaticClassConstructionReturnNonGCStaticBase(StaticClassConstructionContext, IntPtr) + 0x1c\r\n at System.Data.SqlClient.TdsParser..ctor(Boolean MARS, Boolean fAsynchronous) + 0x28\r\n at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString connectionOptions, SqlCredential credential, TimeoutTimer timeout) + 0x20f\r\n at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer timeout, SqlConnectionString connectionOptions, SqlCredential credential, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance) + 0x29f\r\n at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, Boolean applyTransientFaultHandling, String accessToken) + 0x432\r\n at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions) + 0x541\r\n at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions) + 0x8d\r\n at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) + 0x45f\r\n at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) + 0xdb\r\n at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection) + 0x428\r\n at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) + 0xc9\r\n at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection) + 0x686\r\n at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource1 retry, DbConnectionOptions userOptions) + 0x17d\r\n at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource1 retry, DbConnectionOptions userOptions) + 0x39\r\n at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry) + 0x1e3\r\n at System.Data.SqlClient.SqlConnection.Open() + 0xff\r\n at webapi_mes.baseframework.SqlHelper.Open() + 0x199",

lozn00 commented 1 year ago
System.TypeInitializationException: A type initializer threw an exception. To determine which type, inspect the InnerException's StackTrace property.
 ---> System.TypeInitializationException: A type initializer threw an exception. To determine which type, inspect the InnerException's StackTrace property.
 ---> System.DllNotFoundException: Unable to load DLL 'sni.dll' or one of its dependencies: 找不到指定的模块。
   at System.Runtime.InteropServices.NativeLibrary.LoadLibErrorTracker.Throw(String) + 0xb1
   at Internal.Runtime.CompilerHelpers.InteropHelpers.FixupModuleCell(InteropHelpers.ModuleFixupCell*) + 0x1a7
   at Internal.Runtime.CompilerHelpers.InteropHelpers.ResolvePInvokeSlow(InteropHelpers.MethodFixupCell*) + 0x44
   at Internal.Runtime.CompilerHelpers.InteropHelpers.ResolvePInvoke(InteropHelpers.MethodFixupCell*) + 0x30
   at System.Data.SqlClient.SNINativeMethodWrapper.SNIInitialize(IntPtr pmo) + 0x2f
   at System.Data.SqlClient.SNINativeMethodWrapper.SNIInitialize() + 0x12
   at System.Data.SqlClient.SNILoadHandle..ctor() + 0xc6
   at System.Data.SqlClient.SNILoadHandle..cctor() + 0x2a
   at System.Runtime.CompilerServices.ClassConstructorRunner.EnsureClassConstructorRun(StaticClassConstructionContext*) + 0x16a
   --- End of inner exception stack trace ---
   at System.Runtime.CompilerServices.ClassConstructorRunner.EnsureClassConstructorRun(StaticClassConstructionContext*) + 0x26b
   at System.Runtime.CompilerServices.ClassConstructorRunner.CheckStaticClassConstructionReturnGCStaticBase(StaticClassConstructionContext*, Object) + 0x1c
   at System.Data.SqlClient.TdsParserStateObjectFactory.get_EncryptionOptions() + 0x22
   at System.Data.SqlClient.TdsParser..cctor() + 0x2b
   at System.Runtime.CompilerServices.ClassConstructorRunner.EnsureClassConstructorRun(StaticClassConstructionContext*) + 0x16a
   --- End of inner exception stack trace ---
   at System.Runtime.CompilerServices.ClassConstructorRunner.EnsureClassConstructorRun(StaticClassConstructionContext*) + 0x159
   at System.Runtime.CompilerServices.ClassConstructorRunner.CheckStaticClassConstructionReturnNonGCStaticBase(StaticClassConstructionContext*, IntPtr) + 0x1c
   at System.Data.SqlClient.TdsParser..ctor(Boolean MARS, Boolean fAsynchronous) + 0x28
   at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString connectionOptions, SqlCredential credential, TimeoutTimer timeout) + 0x20f
   at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer timeout, SqlConnectionString connectionOptions, SqlCredential credential, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance) + 0x29f
   at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, Boolean applyTransientFaultHandling, String accessToken) + 0x432
   at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions) + 0x541
   at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions) + 0x8d
   at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) + 0x45f
   at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) + 0xdb
   at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection) + 0x428
   at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) + 0xc9
   at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection) + 0x686
   at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) + 0x17d
   at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) + 0x39
   at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry) + 0x1e3
   at System.Data.SqlClient.SqlConnection.Open() + 0xff
   at webapi_mes.baseframework.SqlHelper.Open() + 0x199System.TypeInitializationException: A type initializer threw an exception. To determine which type, inspect the InnerException's StackTrace property.
 ---> System.TypeInitializationException: A type initializer threw an exception. To determine which type, inspect the InnerException's StackTrace property.
 ---> System.DllNotFoundException: Unable to load DLL 'sni.dll' or one of its dependencies: 找不到指定的模块。
   at System.Runtime.InteropServices.NativeLibrary.LoadLibErrorTracker.Throw(String) + 0xb1
   at Internal.Runtime.CompilerHelpers.InteropHelpers.FixupModuleCell(InteropHelpers.ModuleFixupCell*) + 0x1a7
   at Internal.Runtime.CompilerHelpers.InteropHelpers.ResolvePInvokeSlow(InteropHelpers.MethodFixupCell*) + 0x44
   at Internal.Runtime.CompilerHelpers.InteropHelpers.ResolvePInvoke(InteropHelpers.MethodFixupCell*) + 0x30
   at System.Data.SqlClient.SNINativeMethodWrapper.SNIInitialize(IntPtr pmo) + 0x2f
   at System.Data.SqlClient.SNINativeMethodWrapper.SNIInitialize() + 0x12
   at System.Data.SqlClient.SNILoadHandle..ctor() + 0xc6
   at System.Data.SqlClient.SNILoadHandle..cctor() + 0x2a
   at System.Runtime.CompilerServices.ClassConstructorRunner.EnsureClassConstructorRun(StaticClassConstructionContext*) + 0x16a
   --- End of inner exception stack trace ---
   at System.Runtime.CompilerServices.ClassConstructorRunner.EnsureClassConstructorRun(StaticClassConstructionContext*) + 0x26b
   at System.Runtime.CompilerServices.ClassConstructorRunner.CheckStaticClassConstructionReturnGCStaticBase(StaticClassConstructionContext*, Object) + 0x1c
   at System.Data.SqlClient.TdsParserStateObjectFactory.get_EncryptionOptions() + 0x22
   at System.Data.SqlClient.TdsParser..cctor() + 0x2b
   at System.Runtime.CompilerServices.ClassConstructorRunner.EnsureClassConstructorRun(StaticClassConstructionContext*) + 0x16a
   --- End of inner exception stack trace ---
   at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection) + 0x157
   at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) + 0xc9
   at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection) + 0x686
   at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) + 0x17d
   at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) + 0x39
   at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry) + 0x1e3
   at System.Data.SqlClient.SqlConnection.Open() + 0xff
   at webapi_mes.baseframework.SqlHelper.Open() + 0x199System.TypeInitializationException: A type initializer threw an exception. To determine which type, inspect the InnerException's StackTrace property.
 ---> System.TypeInitializationException: A type initializer threw an exception. To determine which type, inspect the InnerException's StackTrace property.
 ---> System.DllNotFoundException: Unable to load DLL 'sni.dll' or one of its dependencies: 找不到指定的模块。
   at System.Runtime.InteropServices.NativeLibrary.LoadLibErrorTracker.Throw(String) + 0xb1
   at Internal.Runtime.CompilerHelpers.InteropHelpers.FixupModuleCell(InteropHelpers.ModuleFixupCell*) + 0x1a7
   at Internal.Runtime.CompilerHelpers.InteropHelpers.ResolvePInvokeSlow(InteropHelpers.MethodFixupCell*) + 0x44
   at Internal.Runtime.CompilerHelpers.InteropHelpers.ResolvePInvoke(InteropHelpers.MethodFixupCell*) + 0x30
   at System.Data.SqlClient.SNINativeMethodWrapper.SNIInitialize(IntPtr pmo) + 0x2f
   at System.Data.SqlClient.SNINativeMethodWrapper.SNIInitialize() + 0x12
   at System.Data.SqlClient.SNILoadHandle..ctor() + 0xc6
   at System.Data.SqlClient.SNILoadHandle..cctor() + 0x2a
   at System.Runtime.CompilerServices.ClassConstructorRunner.EnsureClassConstructorRun(StaticClassConstructionContext*) + 0x16a
   --- End of inner exception stack trace ---
   at System.Runtime.CompilerServices.ClassConstructorRunner.EnsureClassConstructorRun(StaticClassConstructionContext*) + 0x26b
   at System.Runtime.CompilerServices.ClassConstructorRunner.CheckStaticClassConstructionReturnGCStaticBase(StaticClassConstructionContext*, Object) + 0x1c
   at System.Data.SqlClient.TdsParserStateObjectFactory.get_EncryptionOptions() + 0x22
   at System.Data.SqlClient.TdsParser..cctor() + 0x2b
   at System.Runtime.CompilerServices.ClassConstructorRunner.EnsureClassConstructorRun(StaticClassConstructionContext*) + 0x16a
   --- End of inner exception stack trace ---
   at System.Runtime.CompilerServices.ClassConstructorRunner.EnsureClassConstructorRun(StaticClassConstructionContext*) + 0x159
   at System.Runtime.CompilerServices.ClassConstructorRunner.CheckStaticClassConstructionReturnNonGCStaticBase(StaticClassConstructionContext*, IntPtr) + 0x1c
   at System.Data.SqlClient.TdsParser..ctor(Boolean MARS, Boolean fAsynchronous) + 0x28
   at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString connectionOptions, SqlCredential credential, TimeoutTimer timeout) + 0x20f
   at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer timeout, SqlConnectionString connectionOptions, SqlCredential credential, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance) + 0x29f
   at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, Boolean applyTransientFaultHandling, String accessToken) + 0x432
   at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions) + 0x541
   at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions) + 0x8d
   at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) + 0x45f
   at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) + 0xdb
   at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection) + 0x428
   at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) + 0xc9
   at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection) + 0x686
   at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) + 0x17d
   at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) + 0x39
   at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry) + 0x1e3
   at System.Data.SqlClient.SqlConnection.Open() + 0xff
   at webapi_mes.baseframework.SqlHelper.Open() + 0x199
lozn00 commented 1 year ago

why asp.net core needMicrosoft.Data.SqlClient?

lozn00 commented 1 year ago

i use dotnet is from C:\Program Files\dotnet why not use aot is normal work ,but dotnet throw exceptiondotnet publish -r win-x64 -c xxxx

lozn00 commented 1 year ago

i check the out dir ,sni.dll is with the exe at same dir, but why still throw sni.dll cannot load? image deug attach exe output information image

lozn00 commented 1 year ago

debug program , is connection.Open(); throw

lozn00 commented 1 year ago
A type initializer threw an exception. To determine which type, inspect the InnerException's StackTrace property.  System.Collections.ListDictionaryInternal   type:System.TypeInitializationException   at System.Runtime.CompilerServices.ClassConstructorRunner.EnsureClassConstructorRun(StaticClassConstructionContext*) + 0x26b
   at System.Runtime.CompilerServices.ClassConstructorRunner.CheckStaticClassConstructionReturnNonGCStaticBase(StaticClassConstructionContext*, IntPtr) + 0x1c
   at System.Data.SqlClient.TdsParser..ctor(Boolean MARS, Boolean fAsynchronous) + 0x28
   at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString connectionOptions, SqlCredential credential, TimeoutTimer timeout) + 0x20f
   at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer timeout, SqlConnectionString connectionOptions, SqlCredential credential, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance) + 0x29f
   at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, Boolean applyTransientFaultHandling, String accessToken) + 0x432
   at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions) + 0x541
   at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions) + 0x8d
   at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) + 0x45f
   at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) + 0xdb
   at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection) + 0x428
   at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) + 0xc9
   at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection) + 0x686
   at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) + 0x17d
   at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) + 0x39
   at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry) + 0x1e3
   at System.Data.SqlClient.SqlConnection.Open() + 0xff
   at webapi_mes.baseframework.SqlHelper.Open() + 0x199
A type initializer threw an exception. To determine which type, inspect the InnerException's StackTrace property.  System.Collections.ListDictionaryInternal   type:System.TypeInitializationException   at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection) + 0x157
   at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) + 0xc9
   at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection) + 0x686
   at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) + 0x17d
   at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) + 0x39
   at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry) + 0x1e3
   at System.Data.SqlClient.SqlConnection.Open() + 0xff
   at webapi_mes.baseframework.SqlHelper.Open() + 0x199
A type initializer threw an exception. To determine which type, inspect the InnerException's StackTrace property.  System.Collections.ListDictionaryInternal   type:System.TypeInitializationException   at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection) + 0x157
   at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) + 0xc9
   at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection) + 0x686
   at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) + 0x17d
   at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) + 0x39
   at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry) + 0x1e3
   at System.Data.SqlClient.SqlConnection.Open() + 0xff
   at webapi_mes.baseframework.SqlHelper.Open() + 0x199
A type initializer threw an exception. To determine which type, inspect the InnerException's StackTrace property.  System.Collections.ListDictionaryInternal   type:System.TypeInitializationException   at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection) + 0x157
   at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) + 0xc9
   at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection) + 0x686
   at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) + 0x17d
   at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) + 0x39
   at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry) + 0x1e3
   at System.Data.SqlClient.SqlConnection.Open() + 0xff
   at webapi_mes.baseframework.SqlHelper.Open() + 0x199
A type initializer threw an exception. To determine which type, inspect the InnerException's StackTrace property.  System.Collections.ListDictionaryInternal   type:System.TypeInitializationException   at System.Runtime.CompilerServices.ClassConstructorRunner.EnsureClassConstructorRun(StaticClassConstructionContext*) + 0x159
   at System.Runtime.CompilerServices.ClassConstructorRunner.CheckStaticClassConstructionReturnNonGCStaticBase(StaticClassConstructionContext*, IntPtr) + 0x1c
   at System.Data.SqlClient.TdsParser..ctor(Boolean MARS, Boolean fAsynchronous) + 0x28
   at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString connectionOptions, SqlCredential credential, TimeoutTimer timeout) + 0x20f
   at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer timeout, SqlConnectionString connectionOnOptionsnOptionsnOptions, SqlnOptinOptionOpnOnnnOnOnnOnOnnnnOptions, SqlCredential credential, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance) + 0x29f
   at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, Boolean applyTransientFaultHandling, String accessToken) + 0x432
   at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions) + 0x541
   at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions) + 0x8d
   at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) + 0x45f
   at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) + 0xdb
   at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection) + 0x428
   at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) + 0xc9
   at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection) + 0x686
   at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) + 0x17d
   at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) + 0x39
   at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry) + 0x1e3
   at System.Data.SqlClient.SqlConnection.Open() + 0xff
   at webapi_mes.baseframework.SqlHelper.Open() + 0x199
A type initializer threw an exception. To determine which type, inspect the InnerException's StackTrace property.  System.Collections.ListDictionaryInternal   type:System.TypeInitializationException   at System.Runtime.CompilerServices.ClassConstructorRunner.EnsureClassConstructorRun(StaticClassConstructionContext*) + 0x159
   at System.Runtime.CompilerServices.ClassConstructorRunner.CheckStaticClassConstructionReturnNonGCStaticBase(StaticClassConstructionContext*, IntPtr) + 0x1c
   at System.Data.SqlClient.TdsParser..ctor(Boolean MARS, Boolean fAsynchronous) + 0x28
   at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString connectionOptions, SqlCredential credential, TimeoutTimer timeout) + 0x20f
   at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer timeout, SqlConnectionString connectionOptions, SqlCredential credential, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance) + 0x29f
   at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, Boolean applyTransientFaultHandling, String accessToken) + 0x432
   at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions) + 0x541
   at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions) + 0x8d
   at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) + 0x45f
   at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) + 0xdb
   at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection) + 0x428
   at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) + 0xc9
   at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection) + 0x686
   at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) + 0x17d
   at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) + 0x39
   at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry) + 0x1e3
   at System.Data.SqlClient.SqlConnection.Open() + 0xff
   at webapi_mes.baseframework.SqlHelper.Open() + 0x199
lozn00 commented 1 year ago

Because there was a problem with the code running after AOT was compiled, I deleted many 7.0 folders on the computer and uninstalled it, resulting in this problem that cannot be fixed regardless of whether it is reinstalled or not.

I found this problem after my computer was reinstalled, which led me to start researching whether it was a version problem, and then repeatedly uninstall and install .net.7.0, so I violently deleted many net7.0 folders on the computer, and uninstalled, resulting in this problem has not been repaired whether it is reinstalled or not.
fatal error LNK1123: Failed during conversion to COFF: Invalid or corrupted file

lozn00 commented 1 year ago

the 8.0 error https://github.com/dotnet/runtimelab/issues/2278

Trying to uninstall the .NET 7.0 runtime got an error that was even more difficult for me to accept https://github.com/dotnet/runtimelab/issues/2281

jkotas commented 1 year ago

The native AOT projects lives in http://github.com/dotnet/runtime now. Please open any issues http://github.com/dotnet/runtime. Also, include steps to reproduce the issue.

Note that SqlClient is not yet compatible with AOT and trimming. This is tracked by https://github.com/dotnet/SqlClient/issues/1947.

lozn00 commented 1 year ago

测试提及 https://github.com/dotnet/SqlClient/issues/1947

lozn00 commented 1 year ago

dotnet/SqlClient/issues#1947 test

lozn00 commented 1 year ago

How should I reinstall the relevant environment?, I used Visual Studio to re-check 143 related C++ libraries, nothing worked, I also tried to re-download the dotnet package installation still has no effect, but I tested the demo mentioned on runtimelab, I 6.0 7.0 net compiled this simple demo is no problem @jkotas

lozn00 commented 1 year ago

clear bin obj Folder? Succeeded again, but again this problem arises because I currently have 7.0.5 installed again, I think 7.0.5 has some bugs, is not compatible

https://github.com/dotnet/runtime/issues/86493

https://github.com/dotnet/runtime/issues/86493

jkotas commented 1 year ago

Can you please try to publish a small project that opens SqlClient connection with native aot:

  1. dotnet new console
  2. dotnet add package System.Data
  3. Copy & paste fhe following into Program.cs:
    
    using System.Data.SqlClient;

SqlConnection connection = new SqlConnection("Data Source=ServerName"); connection.Open();


5. `dotnet publish /p:PublishAot=true`

Does the native AOT binary fail to sni.dll on your machine?
lozn00 commented 1 year ago

我现在测试demo是正常的,但是我还要确认下现在真实项目是什么情况,为了解决这些问题,我升级 或者降级得到了不同的错误,8.0的aot错误更为严重 I am currently testing the demo as normal, but I also need to confirm the actual project situation. In order to address these issues, I upgraded or downgraded .net version and got different errors. The 8.0 AOT error is even more severe

https://github.com/qssq1/aotest

lozn00 commented 1 year ago

I just uninstalled 7.0.5 and 8.0 which caused this annoying error again sproj] VTRES : fatal error CVT1103: 无法读取文件 [D:\dev\company_project\webapi\webapi_mes\webapi_mes.csproj] LINK : fatal error LNK1123: 转换到 COFF 期间失败: 文件无效或损坏 [D:\dev\company_project\webapi\webapi_mes\webapi_mes.csproj] C:\Program Files\dotnet\sdk\7.0.302\Sdks\Microsoft.DotNet.ILCompiler\build\Microsoft.NETCore.Native.targets(350,5): err or MSB3073: 命令“"D:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\bin\Hostx64\x64\link. exe" @"obj\YTLSX_R\net7.0\win-x64\native\link.rsp"”已退出,代码为 1123。 [D:\dev\company_project\webapi\webapi_mes\webapi_mes.c sproj] https://github.com/qssq1/aotest But this little demo is normal and compiles AOT 6.0 and 7.0 normally

lozn00 commented 1 year ago

I think I upgrade to 7.0.5 will get SQL client error, upgrade to 8.0 will get swagger error, this is the result of my previous test, 8.0 config manager I changed to write files directly, but there are more errors waiting for me to solve, I have to downgrade, and in the case of 8.0 I did not do AOT compilation, just run with Visual Studio and got that error

.InvalidOperationException: A suitable constructor for type 'Swashbuckle.AspNetCore.Filters.AddResponseHeadersFilter' could not be located. Ensure the type is concrete and all parameters of a public constructor are either registered as services or passed as arguments. Also ensure no extraneous arguments are provided.
         at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.FindApplicableConstructor(Type, Type[], ConstructorInfo&, Nullable`1[]&) + 0xa7
         at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.CreateInstance(IServiceProvider, Type, Object[]) + 0x28f
         at Swashbuckle.AspNetCore.SwaggerGen.ConfigureSwaggerGeneratorOptions.CreateFilter[TFilter](FilterDescriptor) +    0x    0 0x 0 0x 0x1e 0x 0x 0x1     0  0 0x 0         0x1e
lozn00 commented 1 year ago

So I think what I can do at the moment is downgrading below 7.0.5 can solve more problems, but my computer in the company seems to be unable to fix CVTRES: fatal error CVT1103: Error, I have reinstalled these nets, those small demos can run normally, my home computer compiles very slowly, but successfully makes the project not report errors, my company's computer was also used before the 7.0 lower version was also solved by me The error has been running stably for several months

lozn00 commented 1 year ago

5. dotnet publish /p:PublishAot=true

i just run dotnet publish webapi_mes.csproj -r win-x64 -c XXX_R

lozn00 commented 1 year ago

> > 5. dotnet publish /p:PublishAot=true
> 
> i just run `dotnet publish webapi_mes.csproj -r win-x64 -c XXX_R`

webapi_mes.csproj
true net7.0 enable enable False AnyCPU;x64 37c2da8e-4c70-4b1a-b525-dc02325e9e4c Exe embedded x64 send false False VIPCHANNEL;YM_RELEASE;YM_DEBUG;AL_DEBUG;AL_RELEASE;CMJ_DEBUG;CMJ_RELEASE;LS_DEBUG;LS_RELEASE;SONGFU_DEBUG;SONGFU_RELEASE;RLKM_DEBUG;RLKM_RELEASE;YTLSX_D;YTLSX_R;YXG_D;YXG_R;AILIAN_D;AILIAN_R;KZ_D;KZ_R;DL_R;DL_D $(DefineConstants)TRACE;LOGIN;DEV; portable False $(DefineConstants)TRACE;DEBUG;DEV;UPDATE;LOGIN;SWAGGER;JDBC;INCOMMINGNEW;UPMATERIAL; portable False $(DefineConstants)TRACE;DEV;UPDATE;LOGIN;SWAGGER;DEBUG;JDBC;PRODUCT;INCOMMINGNEW;UPMATERIAL;STEEL;SOLIDERNEW;HUMIDITY; portable False $(DefineConstants)TRACE;DEV;UPDATE;LOGIN;SWAGGER;DEBUG;JDBC;PRODUCT; portable False $(DefineConstants)TRACE;DEBUG;DEV;SOLIDER;STEEL;HUMIDITY;UPDATE;SWAGGER;LOGIN; portable False $(DefineConstants)TRACE;DEBUG;DEV;UPDATE;SWAGGER;LOGIN;JDBC;IPQC portable False $(DefineConstants)TRACE;UPDATE;SWAGGER;LOGIN;PUSH portable False $(DefineConstants)TRACE;DEBUG;DEV;UPDATE;SWAGGER;LOGIN;JDBC;PUSH portable False DEV;$(DefineConstants)TRACE;DEV;DEBUG;CLIP;UPDATE;LOGIN;SWAGGER;JDBC;INCOMMINGNEW;PRODUCT; portable False DEV;$(DefineConstants)TRACE;DEV;UPDATE;DEBUG;LOGIN;DEBUG;SWAGGER;JDBC;INCOMMINGNEW;UPMATERIAL;SOLIDERNEW;STEEL;HUMIDITY;PRODUCT; portable False DEV;$(DefineConstants)TRACE;DEV;UPDATE;DEBUG;LOGIN;DEBUG;SWAGGER;JDBC;INCOMMINGNEW;UPMATERIAL;SOLIDERNEW;STEEL;PRODUCT;HUMIDITY; portable False DEV;$(DefineConstants)TRACE;DEBUG;UPDATE;SOLIDER;STEEL;DEBUG;UPMATERIAL;INCOMMINGNEW;HUMIDITY;CLIP;JDBC;SWAGGER;LOGIN;DEBUG; portable False $(DefineConstants)TRACE;SWAGGER;LOGIN; portable False $(DefineConstants)TRACE;UPDATE;LOGIN;JDBC;INCOMMINGNEW;UPMATERIAL; portable False True $(DefineConstants)TRACE;UPDATE;LOGIN;JDBC;PRODUCT;INCOMMINGNEW;UPMATERIAL;SOLIDERNEW;STEEL;HUMIDITY; portable False True $(DefineConstants)TRACE;UPDATE;LOGIN;JDBC;PRODUCT; portable False True $(DefineConstants)TRACE;STEEL;SOLIDER;HUMIDITY;UPDATE;LOGIN; portable True False $(DefineConstants)TRACE;UPDATE;LOGIN;JDBC;IPQC; portable True False $(DefineConstants)TRACE;CLIP;UPDATE;LOGIN;JDBC;INCOMMINGNEW;PRODUCT; True portable False $(DefineConstants)TRACE;UPDATE;LOGIN;JDBC;INCOMMINGNEW;UPMATERIAL;SOLIDERNEW;STEEL;HUMIDITY;PRODUCT; True portable False $(DefineConstants)TRACE;UPDATE;LOGIN;JDBC;INCOMMINGNEW;UPMATERIAL;SOLIDERNEW;STEEL;PRODUCT;HUMIDITY; True portable False $(DefineConstants)TRACE;LOGIN;DEV; portable False $(DefineConstants)TRACE;DEBUG;DEV;UPDATE;LOGIN;SWAGGER;JDBC;INCOMMINGNEW;UPMATERIAL; portable False $(DefineConstants)TRACE;DEV;UPDATE;LOGIN;SWAGGER;DEBUG;JDBC;PRODUCT;INCOMMINGNEW;UPMATERIAL;STEEL;SOLIDERNEW;HUMIDITY; portable False $(DefineConstants)TRACE;DEV;UPDATE;LOGIN;SWAGGER;DEBUG;JDBC;PRODUCT; portable False $(DefineConstants)TRACE;DEBUG;DEV;SOLIDER;STEEL;HUMIDITY;UPDATE;SWAGGER;LOGIN; portable False $(DefineConstants)TRACE;DEBUG;DEV;UPDATE;SWAGGER;LOGIN;JDBC;IPQC portable False $(DefineConstants)TRACE;UPDATE;SWAGGER;LOGIN;PUSH portable False $(DefineConstants)TRACE;DEBUG;DEV;UPDATE;SWAGGER;LOGIN;JDBC;PUSH portable False DEV;$(DefineConstants)TRACE;DEV;DEBUG;CLIP;UPDATE;LOGIN;SWAGGER;JDBC;INCOMMINGNEW;PRODUCT; portable False DEV;$(DefineConstants)TRACE;DEV;UPDATE;DEBUG;LOGIN;DEBUG;SWAGGER;JDBC;INCOMMINGNEW;UPMATERIAL;SOLIDERNEW;STEEL;HUMIDITY;PRODUCT; portable False DEV;$(DefineConstants)TRACE;DEV;UPDATE;DEBUG;LOGIN;DEBUG;SWAGGER;JDBC;INCOMMINGNEW;UPMATERIAL;SOLIDERNEW;STEEL;PRODUCT;HUMIDITY; portable False DEV;$(DefineConstants)TRACE;DEBUG;UPDATE;SOLIDER;STEEL;DEBUG;UPMATERIAL;INCOMMINGNEW;HUMIDITY;CLIP;JDBC;SWAGGER;LOGIN;DEBUG; portable False $(DefineConstants)TRACE;SWAGGER;LOGIN; portable False $(DefineConstants)TRACE;UPDATE;LOGIN;JDBC;INCOMMINGNEW;UPMATERIAL; portable False True $(DefineConstants)TRACE;UPDATE;LOGIN;JDBC;PRODUCT;INCOMMINGNEW;UPMATERIAL;SOLIDERNEW;STEEL;HUMIDITY; portable False True $(DefineConstants)TRACE;UPDATE;LOGIN;JDBC;PRODUCT; portable False True $(DefineConstants)TRACE;STEEL;SOLIDER;HUMIDITY;UPDATE;LOGIN; portable True False $(DefineConstants)TRACE;UPDATE;LOGIN;JDBC;IPQC portable True False $(DefineConstants)TRACE;CLIP;UPDATE;LOGIN;JDBC;INCOMMINGNEW;PRODUCT; True portable False $(DefineConstants)TRACE;UPDATE;LOGIN;JDBC;INCOMMINGNEW;UPMATERIAL;SOLIDERNEW;STEEL;HUMIDITY;PRODUCT; True portable False $(DefineConstants)TRACE;UPDATE;LOGIN;JDBC;INCOMMINGNEW;UPMATERIAL;SOLIDERNEW;STEEL;PRODUCT;HUMIDITY; True portable False True $(DefineConstants)TRACE;UPDATE;LOGIN;JDBC;PRODUCT;INCOMMINGNEW;UPMATERIAL;SOLIDER;STEEL;HUMIDITY; full True $(DefineConstants)TRACE;UPDATE;LOGIN;JDBC;PRODUCT;INCOMMINGNEW;UPMATERIAL;SOLIDER;STEEL;HUMIDITY; full True $(DefineConstants)TRACE;UPDATE;LOGIN;JDBC;UPMATERIAL;SOLIDER;STEEL;HUMIDITY; full True $(DefineConstants)TRACE;UPDATE;LOGIN;JDBC;UPMATERIAL;SOLIDER;STEEL;HUMIDITY; full $(DefineConstants)TRACE;DEBUG;UPDATE;LOGIN;JDBC;UPMATERIAL;SOLIDER;STEEL;HUMIDITY;PUSH $(DefineConstants)TRACE;DEBUG;UPDATE;LOGIN;JDBC;UPMATERIAL;SOLIDER;STEEL;HUMIDITY;PUSH $(DefineConstants)TRACE;DEBUG;UPDATE;LOGIN;JDBC;PRODUCT;INCOMMINGNEW;UPMATERIAL;SOLIDER;STEEL;HUMIDITY; full $(DefineConstants)TRACE;DEBUG;UPDATE;LOGIN;JDBC;PRODUCT;INCOMMINGNEW;UPMATERIAL;SOLIDER;STEEL;HUMIDITY; full True True Resources.resx ResXFileCodeGenerator Resources.Designer.cs ```
lozn00 commented 1 year ago

Small demos are fine, but real projects are still this throw error

A type initializer threw an exception. To determine which type, inspect the InnerException's StackTrace property.  System.Collections.ListDictionaryInternal   type:System.TypeInitializationException   at System.Runtime.CompilerServices.ClassConstructorRunner.EnsureClassConstructorRun(StaticClassConstructionContext*) + 0x167
   at System.Runtime.CompilerServices.ClassConstructorRunner.CheckStaticClassConstructionReturnNonGCStaticBase(StaticClassConstructionContext*, IntPtr) + 0xd
   at System.Data.SqlClient.TdsParser..ctor(Boolean MARS, Boolean fAsynchronous) + 0x11
   at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString connectionOptions, SqlCredential credential, TimeoutTimer timeout) + 0x14d
   at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer timeout, SqlConnectionString connectionOptions, SqlCredential credential, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance) + 0x1b8
   at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, Boolean applyTransientFaultHandling, String accessToken) + 0x354
   at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions) + 0x30e
   at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions) + 0x33
   at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) + 0x2e0
   at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) + 0x5e
   at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection) + 0x39b
   at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCo
lozn00 commented 1 year ago

small demo is work


D:\dev\git_project\testaot>dotnet publish helloworld7.0.csproj --no-self-contained true -r win-x64 -c release
MSBuild version 17.6.1+8ffc3fe3d for .NET
  正在确定要还原的项目…
  已还原 D:\dev\git_project\testaot\helloworld7.0.csproj (用时 214 ms)。
  helloworld7.0 -> D:\dev\git_project\testaot\bin\release\net7.0\win-x64\helloworld7.0.dll
  Generating native code
C:\Users\Administrator\.nuget\packages\system.data.sqlclient\4.8.3\runtimes\win\lib\netcoreapp2.1\System.Data.SqlClient
.dll : warning IL2104: Assembly 'System.Data.SqlClient' produced trim warnings. For more information see https://aka.ms
/dotnet-illink/libraries [D:\dev\git_project\testaot\helloworld7.0.csproj]
C:\Users\Administrator\.nuget\packages\runtime.win-x64.microsoft.dotnet.ilcompiler\7.0.5\framework\System.Private.Xml.d
ll : warning IL3053: Assembly 'System.Private.Xml' produced AOT analysis warnings. [D:\dev\git_project\testaot\hellowor
ld7.0.csproj]
ello World!
Unhandled exception. System.Data.SqlClient.SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
 ---> System.ComponentModel.Win32Exception (53): 找不到网络路径。
   at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, Boolean applyTransientFaultHandling, String accessToken)
   at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)   at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions)
   at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
   at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
   at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)
   at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)
   at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
   at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
   at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
   at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
   at System.Data.SqlClient.SqlConnection.Open()
   at Program.<Main>$(String[] args) in D:\dev\git_project\testaot\test.cs:line 6
ClientConnectionId:00000000-0000-0000-0000-000000000000
lozn00 commented 1 year ago

uninstall 8.0 dotnet-sdk-7.0.203-win-x64 (1) 7.0.5 all package ,delete all 7.0.5 folder by dotnet --info show all 7.0.5 folder

这次没有出现编译错误了,sql 错误也没有出现了,因此问题就是7.0.5导致的 There were no compilation errors or SQL errors this time, so the problem was caused by 7.0.5

lozn00 commented 1 year ago

Due to some errors in 7.0.5 and 8.0 that I cannot solve, I have to downgrade to 7.0.4. However, I am worried about the future and will definitely need to upgrade. How can I solve these problems in the future? For example, in 8.0, the swagger was abnormal

jkotas commented 1 year ago

You need to pay attention to warnings like "Assembly 'System.Data.SqlClient' produced trim warnings.". These warnings tell you that the code is not trimming or AOT compatible, and it can break unexpectedly.

There is no trimming and AOT compatible replacement of swagger at this time.

lozn00 commented 1 year ago

@jkotas Thank you. I noticed those compilation warnings, but because the previous version was able to run and the error this time is different from when I was using the previous. net7.0 version, I don't know how to modify rd.xml or source generation to solve this problem

lozn00 commented 1 year ago

@jkotas Thank you. I noticed those compilation warnings, but because the previous version was able to run and the error this time is different from when I was using the previous. net7.0 version, I don't know how to modify rd.xml or source generation to solve this problem

lozn00 commented 1 year ago

@jkotas Thank you. I noticed those compilation warnings, but because the previous version was able to run and the error this time is different from when I was using the previous. net7.0 version, I don't know how to modify rd.xml or source generation to solve this problem

lozn00 commented 1 year ago
  Generating native code
C:\Users\Administrator\.nuget\packages\newtonsoft.json\13.0.3\lib\net6.0\Newtonsoft.Json.dll : warning IL2104: Assembly
 'Newtonsoft.Json' produced trim warnings. For more information see https://aka.ms/dotnet-illink/libraries [D:\dev\comp
any_project\webapi\webapi_mes\webapi_mes.csproj]
C:\Users\Administrator\.nuget\packages\system.data.sqlclient\4.8.3\runtimes\win\lib\netcoreapp2.1\System.Data.SqlClient
.dll : warning IL2104: Assembly 'System.Data.SqlClient' produced trim warnings. For more information see https://aka.ms
/dotnet-illink/libraries [D:\dev\company_project\webapi\webapi_mes\webapi_mes.csproj]
C:\Users\Administrator\.nuget\packages\swashbuckle.aspnetcore.swaggerui\6.5.0\lib\net7.0\Swashbuckle.AspNetCore.Swagger
UI.dll : warning IL3053: Assembly 'Swashbuckle.AspNetCore.SwaggerUI' produced AOT analysis warnings. [D:\dev\company_pr
oject\webapi\webapi_mes\webapi_mes.csproj]
C:\Users\Administrator\.nuget\packages\swashbuckle.aspnetcore.swaggerui\6.5.0\lib\net7.0\Swashbuckle.AspNetCore.Swagger
UI.dll : warning IL2104: Assembly 'Swashbuckle.AspNetCore.SwaggerUI' produced trim warnings. For more information see h
ttps://aka.ms/dotnet-illink/libraries [D:\dev\company_project\webapi\webapi_mes\webapi_mes.csproj]
D:\dev\company_project\webapi\webapi_mes\Program.cs(512): Trim analysis warning IL2026: Program.<Main>$(String[]): Usin
g member 'Microsoft.AspNetCore.Builder.EndpointRouteBuilderExtensions.MapPost(IEndpointRouteBuilder,String,Delegate)' w
hich has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. This API may perfo
rm reflection on the supplied delegate and its parameters. These types may be trimmed if not directly referenced. [D:\d
ev\company_project\webapi\webapi_mes\webapi_mes.csproj]
D:\dev\company_project\webapi\webapi_mes\Program.cs(513): Trim analysis warning IL2026: Program.<Main>$(String[]): Usin
g member 'Microsoft.AspNetCore.Builder.EndpointRouteBuilderExtensions.MapPut(IEndpointRouteBuilder,String,Delegate)' wh
ich has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. This API may perfor
m reflection on the supplied delegate and its parameters. These types may be trimmed if not directly referenced. [D:\de
v\company_project\webapi\webapi_mes\webapi_mes.csproj]
D:\dev\company_project\webapi\webapi_mes\Program.cs(514): Trim analysis warning IL2026: Program.<Main>$(String[]): Usin
g member 'Microsoft.AspNetCore.Builder.EndpointRouteBuilderExtensions.MapDelete(IEndpointRouteBuilder,String,Delegate)'
 which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. This API may per
form reflection on the supplied delegate and its parameters. These types may be trimmed if not directly referenced. [D:
\dev\company_project\webapi\webapi_mes\webapi_mes.csproj]
D:\dev\company_project\webapi\webapi_mes\Program.cs(515): Trim analysis warning IL2026: Program.<Main>$(String[]): Usin
g member 'Microsoft.AspNetCore.Builder.EndpointRouteBuilderExtensions.MapMethods(IEndpointRouteBuilder,String,IEnumerab
le`1<String>,Delegate)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application
 code. This API may perform reflection on the supplied delegate and its parameters. These types may be trimmed if not d
irectly referenced. [D:\dev\company_project\webapi\webapi_mes\webapi_mes.csproj]
C:\Users\Administrator\.nuget\packages\system.configuration.configurationmanager\7.0.0\lib\net7.0\System.Configuration.
ConfigurationManager.dll : warning IL2104: Assembly 'System.Configuration.ConfigurationManager' produced trim warnings.
 For more information see https://aka.ms/dotnet-illink/libraries [D:\dev\company_project\webapi\webapi_mes\webapi_mes.c
sproj]
D:\dev\company_project\webapi\webapi_mes\utils\LogUtil.cs(50): Trim analysis warning IL2026: webapi_test.utils.LogUtil.
getStackFrameLocationInfo(): Using member 'System.Diagnostics.StackFrame.GetMethod()' which has 'RequiresUnreferencedCo
deAttribute' can break functionality when trimming application code. Metadata for the method might be incomplete or rem
oved. [D:\dev\company_project\webapi\webapi_mes\webapi_mes.csproj]
D:\dev\company_project\webapi\webapi_mes\utils\MyUtil.cs(285): Trim analysis warning IL2026: webapi_test.utils.MyUtil.G
etLastThreeStackFrames(): Using member 'System.Diagnostics.StackFrame.GetMethod()' which has 'RequiresUnreferencedCodeA
ttribute' can break functionality when trimming application code. Metadata for the method might be incomplete or remove
d. [D:\dev\company_project\webapi\webapi_mes\webapi_mes.csproj]
D:\dev\company_project\webapi\webapi_mes\utils\MyUtil.cs(318): Trim analysis warning IL2026: webapi_test.utils.MyUtil.G
etLastThreeStackFrames(): Using member 'System.Diagnostics.StackFrame.GetMethod()' which has 'RequiresUnreferencedCodeA
ttribute' can break functionality when trimming application code. Metadata for the method might be incomplete or remove
d. [D:\dev\company_project\webapi\webapi_mes\webapi_mes.csproj]
D:\dev\company_project\webapi\webapi_mes\utils\SotrunJSONUtil.cs(1465): Trim analysis warning IL2072: webapi_test.utils
.SotrunJSONUtil.MergeAndDistinctTables1(List`1<DataTable>,String[]): 'type' argument does not satisfy 'DynamicallyAcces
sedMemberTypes.PublicFields', 'DynamicallyAccessedMemberTypes.PublicProperties' in call to 'System.Data.DataColumnColle
ction.Add(String,Type)'. The return value of method 'System.Collections.Generic.KeyValuePair`2<String,Type>.Value.set'
does not have matching annotations. The source value must declare at least the same requirements as those declared on t
he target location it is assigned to. [D:\dev\company_project\webapi\webapi_mes\webapi_mes.csproj]
D:\dev\company_project\webapi\webapi_mes\jdbc\SQLRequestControl.cs(67): Trim analysis warning IL2026: webapi_mes.jdbc.S
QLRequestControl.ShowName3(Object): Using member 'Microsoft.CSharp.RuntimeBinder.Binder.GetIndex(CSharpBinderFlags,Type
,IEnumerable`1<CSharpArgumentInfo>)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimmin
g application code. Using dynamic types might cause types or members to be removed by trimmer. [D:\dev\company_project\
webapi\webapi_mes\webapi_mes.csproj]
D:\dev\company_project\webapi\webapi_mes\jdbc\SQLRequestControl.cs(67): Trim analysis warning IL2026: webapi_mes.jdbc.S
QLRequestControl.ShowName3(Object): Using member 'Microsoft.CSharp.RuntimeBinder.Binder.GetIndex(CSharpBinderFlags,Type
,IEnumerable`1<CSharpArgumentInfo>)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimmin
g application code. Using dynamic types might cause types or members to be removed by trimmer. [D:\dev\company_project\
webapi\webapi_mes\webapi_mes.csproj]
D:\dev\company_project\webapi\webapi_mes\baseframework\SQLHelper.cs(1034): Trim analysis warning IL2026: webapi_mes.bas
eframework.SqlHelper.FilterDataTable(DataTable,DataTable&,String,String): Using member 'System.Data.DataTable.Select(St
ring,String)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. Mem
bers of types used in the filter expression might be trimmed. [D:\dev\company_project\webapi\webapi_mes\webapi_mes.cspr
oj]
C:\Users\Administrator\.nuget\packages\microsoft.identitymodel.tokens\6.15.1\lib\netstandard2.0\Microsoft.IdentityModel
.Tokens.dll : warning IL2104: Assembly 'Microsoft.IdentityModel.Tokens' produced trim warnings. For more information se
e https://aka.ms/dotnet-illink/libraries [D:\dev\company_project\webapi\webapi_mes\webapi_mes.csproj]
C:\Users\Administrator\.nuget\packages\microsoft.aspnetcore.mvc.newtonsoftjson\7.0.4\lib\net7.0\Microsoft.AspNetCore.Mv
c.NewtonsoftJson.dll : warning IL2104: Assembly 'Microsoft.AspNetCore.Mvc.NewtonsoftJson' produced trim warnings. For m
ore information see https://aka.ms/dotnet-illink/libraries [D:\dev\company_project\webapi\webapi_mes\webapi_mes.csproj]
C:\Users\Administrator\.nuget\packages\microsoft.aspnetcore.app.runtime.win-x64\7.0.4\runtimes\win-x64\lib\net7.0\Micro
soft.AspNetCore.Mvc.ViewFeatures.dll : warning IL2104: Assembly 'Microsoft.AspNetCore.Mvc.ViewFeatures' produced trim w
arnings. For more information see https://aka.ms/dotnet-illink/libraries [D:\dev\company_project\webapi\webapi_mes\weba
pi_mes.csproj]
C:\Users\Administrator\.nuget\packages\microsoft.aspnetcore.app.runtime.win-x64\7.0.4\runtimes\win-x64\lib\net7.0\Micro
soft.AspNetCore.Mvc.DataAnnotations.dll : warning IL2104: Assembly 'Microsoft.AspNetCore.Mvc.DataAnnotations' produced
trim warnings. For more information see https://aka.ms/dotnet-illink/libraries [D:\dev\company_project\webapi\webapi_me
s\webapi_mes.csproj]
C:\Users\Administrator\.nuget\packages\microsoft.aspnetcore.app.runtime.win-x64\7.0.4\runtimes\win-x64\lib\net7.0\Micro
soft.AspNetCore.Mvc.ViewFeatures.dll : warning IL3053: Assembly 'Microsoft.AspNetCore.Mvc.ViewFeatures' produced AOT an
alysis warnings. [D:\dev\company_project\webapi\webapi_mes\webapi_mes.csproj]
C:\Users\Administrator\.nuget\packages\microsoft.aspnetcore.mvc.newtonsoftjson\7.0.4\lib\net7.0\Microsoft.AspNetCore.Mv
c.NewtonsoftJson.dll : warning IL3053: Assembly 'Microsoft.AspNetCore.Mvc.NewtonsoftJson' produced AOT analysis warning
s. [D:\dev\company_project\webapi\webapi_mes\webapi_mes.csproj]
C:\Users\Administrator\.nuget\packages\microsoft.aspnetcore.jsonpatch\7.0.4\lib\net7.0\Microsoft.AspNetCore.JsonPatch.d
ll : warning IL2104: Assembly 'Microsoft.AspNetCore.JsonPatch' produced trim warnings. For more information see https:/
/aka.ms/dotnet-illink/libraries [D:\dev\company_project\webapi\webapi_mes\webapi_mes.csproj]
C:\Users\Administrator\.nuget\packages\microsoft.aspnetcore.jsonpatch\7.0.4\lib\net7.0\Microsoft.AspNetCore.JsonPatch.d
ll : warning IL3053: Assembly 'Microsoft.AspNetCore.JsonPatch' produced AOT analysis warnings. [D:\dev\company_project\
webapi\webapi_mes\webapi_mes.csproj]
C:\Users\Administrator\.nuget\packages\swashbuckle.aspnetcore.swaggergen\6.5.0\lib\net7.0\Swashbuckle.AspNetCore.Swagge
rGen.dll : warning IL2104: Assembly 'Swashbuckle.AspNetCore.SwaggerGen' produced trim warnings. For more information se
e https://aka.ms/dotnet-illink/libraries [D:\dev\company_project\webapi\webapi_mes\webapi_mes.csproj]
C:\Users\Administrator\.nuget\packages\swashbuckle.aspnetcore.swaggergen\6.5.0\lib\net7.0\Swashbuckle.AspNetCore.Swagge
rGen.dll : warning IL3053: Assembly 'Swashbuckle.AspNetCore.SwaggerGen' produced AOT analysis warnings. [D:\dev\company
_project\webapi\webapi_mes\webapi_mes.csproj]
C:\Users\Administrator\.nuget\packages\microsoft.aspnetcore.app.runtime.win-x64\7.0.4\runtimes\win-x64\lib\net7.0\Micro
soft.AspNetCore.Mvc.ApiExplorer.dll : warning IL2104: Assembly 'Microsoft.AspNetCore.Mvc.ApiExplorer' produced trim war
nings. For more information see https://aka.ms/dotnet-illink/libraries [D:\dev\company_project\webapi\webapi_mes\webapi
_mes.csproj]
C:\Users\Administrator\.nuget\packages\microsoft.openapi\1.3.1\lib\netstandard2.0\Microsoft.OpenApi.dll : warning IL210
4: Assembly 'Microsoft.OpenApi' produced trim warnings. For more information see https://aka.ms/dotnet-illink/libraries
 [D:\dev\company_project\webapi\webapi_mes\webapi_mes.csproj]
C:\Users\Administrator\.nuget\packages\microsoft.openapi\1.3.1\lib\netstandard2.0\Microsoft.OpenApi.dll : warning IL305
3: Assembly 'Microsoft.OpenApi' produced AOT analysis warnings. [D:\dev\company_project\webapi\webapi_mes\webapi_mes.cs
proj]
D:\dev\company_project\webapi\webapi_mes\jdbc\SQLRequestControl.cs(232): Trim analysis warning IL2026: webapi_mes.jdbc.
SQLRequestControl.<>c__DisplayClass8_0.<execProc>b__0(SqlHelper): Using member 'System.Data.DataTable.Load(IDataReader)
' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. Members from ty
pes used in the expression column to be trimmed if not referenced directly. [D:\dev\company_project\webapi\webapi_mes\w
ebapi_mes.csproj]
D:\dev\company_project\webapi\webapi_mes\jdbc\SQLRequestControl.cs(327): Trim analysis warning IL2026: webapi_mes.jdbc.
SQLRequestControl.<>c__DisplayClass9_0.<execPrc1>b__0(SqlHelper): Using member 'System.Data.DataTable.Load(IDataReader)
' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. Members from ty
pes used in the expression column to be trimmed if not referenced directly. [D:\dev\company_project\webapi\webapi_mes\w
ebapi_mes.csproj]
C:\Users\Administrator\.nuget\packages\newtonsoft.json\13.0.3\lib\net6.0\Newtonsoft.Json.dll : warning IL3053: Assembly
 'Newtonsoft.Json' produced AOT analysis warnings. [D:\dev\company_project\webapi\webapi_mes\webapi_mes.csproj]
C:\Users\Administrator\.nuget\packages\microsoft.aspnetcore.app.runtime.win-x64\7.0.4\runtimes\win-x64\lib\net7.0\Micro
soft.AspNetCore.Mvc.Core.dll : warning IL3053: Assembly 'Microsoft.AspNetCore.Mvc.Core' produced AOT analysis warnings.
 [D:\dev\company_project\webapi\webapi_mes\webapi_mes.csproj]
C:\Users\Administrator\.nuget\packages\microsoft.aspnetcore.app.runtime.win-x64\7.0.4\runtimes\win-x64\lib\net7.0\Micro
soft.AspNetCore.Mvc.Core.dll : warning IL2104: Assembly 'Microsoft.AspNetCore.Mvc.Core' produced trim warnings. For mor
e information see https://aka.ms/dotnet-illink/libraries [D:\dev\company_project\webapi\webapi_mes\webapi_mes.csproj]
C:\Users\Administrator\.nuget\packages\microsoft.aspnetcore.app.runtime.win-x64\7.0.4\runtimes\win-x64\lib\net7.0\Micro
soft.AspNetCore.Mvc.Abstractions.dll : warning IL2104: Assembly 'Microsoft.AspNetCore.Mvc.Abstractions' produced trim w
arnings. For more information see https://aka.ms/dotnet-illink/libraries [D:\dev\company_project\webapi\webapi_mes\weba
pi_mes.csproj]
C:\Users\Administrator\.nuget\packages\microsoft.aspnetcore.app.runtime.win-x64\7.0.4\runtimes\win-x64\lib\net7.0\Micro
soft.AspNetCore.Mvc.Abstractions.dll : warning IL3053: Assembly 'Microsoft.AspNetCore.Mvc.Abstractions' produced AOT an
alysis warnings. [D:\dev\company_project\webapi\webapi_mes\webapi_mes.csproj]
C:\Users\Administrator\.nuget\packages\microsoft.aspnetcore.app.runtime.win-x64\7.0.4\runtimes\win-x64\lib\net7.0\Micro
soft.AspNetCore.Http.Abstractions.dll : warning IL3053: Assembly 'Microsoft.AspNetCore.Http.Abstractions' produced AOT
analysis warnings. [D:\dev\company_project\webapi\webapi_mes\webapi_mes.csproj]
C:\Users\Administrator\.nuget\packages\runtime.win-x64.microsoft.dotnet.ilcompiler\7.0.4\framework\System.Linq.Expressi
ons.dll : warning IL3053: Assembly 'System.Linq.Expressions' produced AOT analysis warnings. [D:\dev\company_project\we
bapi\webapi_mes\webapi_mes.csproj]
C:\Users\Administrator\.nuget\packages\swashbuckle.aspnetcore.filters\7.0.6\lib\net5.0\Swashbuckle.AspNetCore.Filters.d
ll : warning IL2104: Assembly 'Swashbuckle.AspNetCore.Filters' produced trim warnings. For more information see https:/
/aka.ms/dotnet-illink/libraries [D:\dev\company_project\webapi\webapi_mes\webapi_mes.csproj]
C:\Users\Administrator\.nuget\packages\swashbuckle.aspnetcore.filters\7.0.6\lib\net5.0\Swashbuckle.AspNetCore.Filters.d
ll : warning IL3053: Assembly 'Swashbuckle.AspNetCore.Filters' produced AOT analysis warnings. [D:\dev\company_project\
webapi\webapi_mes\webapi_mes.csproj]
C:\Users\Administrator\.nuget\packages\scrutor\3.3.0\lib\netcoreapp3.1\Scrutor.dll : warning IL2104: Assembly 'Scrutor'
 produced trim warnings. For more information see https://aka.ms/dotnet-illink/libraries [D:\dev\company_project\webapi
\webapi_mes\webapi_mes.csproj]
C:\Users\Administrator\.nuget\packages\scrutor\3.3.0\lib\netcoreapp3.1\Scrutor.dll : warning IL3053: Assembly 'Scrutor'
 produced AOT analysis warnings. [D:\dev\company_project\webapi\webapi_mes\webapi_mes.csproj]
C:\Users\Administrator\.nuget\packages\microsoft.identitymodel.tokens\6.15.1\lib\netstandard2.0\Microsoft.IdentityModel
.Tokens.dll : warning IL3053: Assembly 'Microsoft.IdentityModel.Tokens' produced AOT analysis warnings. [D:\dev\company
_project\webapi\webapi_mes\webapi_mes.csproj]
C:\Users\Administrator\.nuget\packages\microsoft.aspnetcore.app.runtime.win-x64\7.0.4\runtimes\win-x64\lib\net7.0\Micro
soft.AspNetCore.dll : warning IL3053: Assembly 'Microsoft.AspNetCore' produced AOT analysis warnings. [D:\dev\company_p
roject\webapi\webapi_mes\webapi_mes.csproj]
C:\Users\Administrator\.nuget\packages\microsoft.aspnetcore.app.runtime.win-x64\7.0.4\runtimes\win-x64\lib\net7.0\Micro
soft.AspNetCore.Components.dll : warning IL2104: Assembly 'Microsoft.AspNetCore.Components' produced trim warnings. For
 more information see https://aka.ms/dotnet-illink/libraries [D:\dev\company_project\webapi\webapi_mes\webapi_mes.cspro
j]
C:\Users\Administrator\.nuget\packages\microsoft.identitymodel.logging\6.15.1\lib\netstandard2.0\Microsoft.IdentityMode
l.Logging.dll : warning IL2104: Assembly 'Microsoft.IdentityModel.Logging' produced trim warnings. For more information
 see https://aka.ms/dotnet-illink/libraries [D:\dev\company_project\webapi\webapi_mes\webapi_mes.csproj]
C:\Users\Administrator\.nuget\packages\microsoft.aspnetcore.app.runtime.win-x64\7.0.4\runtimes\win-x64\lib\net7.0\Micro
soft.AspNetCore.Components.dll : warning IL3053: Assembly 'Microsoft.AspNetCore.Components' produced AOT analysis warni
ngs. [D:\dev\company_project\webapi\webapi_mes\webapi_mes.csproj]
C:\Users\Administrator\.nuget\packages\runtime.win-x64.microsoft.dotnet.ilcompiler\7.0.4\framework\System.Private.Xml.d
ll : warning IL3053: Assembly 'System.Private.Xml' produced AOT analysis warnings. [D:\dev\company_project\webapi\webap
i_mes\webapi_mes.csproj]
C:\Users\Administrator\.nuget\packages\runtime.win-x64.microsoft.dotnet.ilcompiler\7.0.4\framework\Microsoft.CSharp.dll
 : warning IL3053: Assembly 'Microsoft.CSharp' produced AOT analysis warnings. [D:\dev\company_project\webapi\webapi_me
s\webapi_mes.csproj]
/_/src/libraries/System.Data.Common/src/System/Data/DataTable.cs(6721): Trim analysis warning IL2026: System.Data.DataT
able.System.Xml.Serialization.IXmlSerializable.WriteXml(XmlWriter): Using member 'System.Data.DataTable.WriteXmlInterna
l(XmlWriter)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. Dat
aTable.WriteXml uses XmlSerialization underneath which is not trimming safe. Members from serialized types may be trimm
ed if not referenced directly. [D:\dev\company_project\webapi\webapi_mes\webapi_mes.csproj]
/_/src/libraries/System.Data.Common/src/System/Data/DataSet.cs(3512): Trim analysis warning IL2026: System.Data.DataSet
.System.Xml.Serialization.IXmlSerializable.WriteXml(XmlWriter): Using member 'System.Data.DataSet.WriteXmlInternal(XmlW
riter)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. DataSet.W
riteXml uses XmlSerialization underneath which is not trimming safe. Members from serialized types may be trimmed if no
t referenced directly. [D:\dev\company_project\webapi\webapi_mes\webapi_mes.csproj]
/_/src/libraries/System.Data.Common/src/System/Data/DataTable.cs(6703): Trim analysis warning IL2026: System.Data.DataT
able.System.Xml.Serialization.IXmlSerializable.ReadXml(XmlReader): Using member 'System.Data.DataTable.ReadXmlSerializa
bleInternal(XmlReader)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application
 code. DataTable.ReadXml uses XmlSerialization underneath which is not trimming safe. Members from serialized types may
 be trimmed if not referenced directly. [D:\dev\company_project\webapi\webapi_mes\webapi_mes.csproj]
/_/src/libraries/System.Data.Common/src/System/Data/DataSet.cs(3490): Trim analysis warning IL2026: System.Data.DataSet
.System.Xml.Serialization.IXmlSerializable.ReadXml(XmlReader): Using member 'System.Data.DataSet.ReadXmlSerializableInt
ernal(XmlReader)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code.
 DataSet.ReadXml uses XmlSerialization underneath which is not trimming safe. Members from serialized types may be trim
med if not referenced directly. [D:\dev\company_project\webapi\webapi_mes\webapi_mes.csproj]
ILC : Trim analysis warning IL2026: Microsoft.Extensions.DependencyInjection.ServiceDescriptor.Singleton<IConfigureOpti
ons`1<JsonConsoleFormatterOptions>,ConsoleLoggerFormatterConfigureOptions`2<JsonConsoleFormatter,JsonConsoleFormatterOp
tions>>(): Using member 'Microsoft.Extensions.Logging.ConsoleLoggerFormatterConfigureOptions`2<JsonConsoleFormatter,Jso
nConsoleFormatterOptions>.ConsoleLoggerFormatterConfigureOptions`2<JsonConsoleFormatter,JsonConsoleFormatterOptions>(IL
oggerProviderConfiguration`1<ConsoleLoggerProvider>)' which has 'RequiresUnreferencedCodeAttribute' can break functiona
lity when trimming application code. TOptions's dependent types may have their members trimmed. Ensure all required mem
bers are preserved. [D:\dev\company_project\webapi\webapi_mes\webapi_mes.csproj]
ILC : Trim analysis warning IL2026: Microsoft.Extensions.DependencyInjection.ServiceDescriptor.Describe<IConfigureOptio
ns`1<JsonConsoleFormatterOptions>,ConsoleLoggerFormatterConfigureOptions`2<JsonConsoleFormatter,JsonConsoleFormatterOpt
ions>>(ServiceLifetime): Using member 'Microsoft.Extensions.Logging.ConsoleLoggerFormatterConfigureOptions`2<JsonConsol
eFormatter,JsonConsoleFormatterOptions>.ConsoleLoggerFormatterConfigureOptions`2<JsonConsoleFormatter,JsonConsoleFormat
terOptions>(ILoggerProviderConfiguration`1<ConsoleLoggerProvider>)' which has 'RequiresUnreferencedCodeAttribute' can b
reak functionality when trimming application code. TOptions's dependent types may have their members trimmed. Ensure al
l required members are preserved. [D:\dev\company_project\webapi\webapi_mes\webapi_mes.csproj]
ILC : Trim analysis warning IL2026: Microsoft.Extensions.DependencyInjection.ServiceDescriptor.Singleton<IConfigureOpti
ons`1<ConsoleFormatterOptions>,ConsoleLoggerFormatterConfigureOptions`2<SystemdConsoleFormatter,ConsoleFormatterOptions
>>(): Using member 'Microsoft.Extensions.Logging.ConsoleLoggerFormatterConfigureOptions`2<SystemdConsoleFormatter,Conso
leFormatterOptions>.ConsoleLoggerFormatterConfigureOptions`2<SystemdConsoleFormatter,ConsoleFormatterOptions>(ILoggerPr
oviderConfiguration`1<ConsoleLoggerProvider>)' which has 'RequiresUnreferencedCodeAttribute' can break functionality wh
en trimming application code. TOptions's dependent types may have their members trimmed. Ensure all required members ar
e preserved. [D:\dev\company_project\webapi\webapi_mes\webapi_mes.csproj]
ILC : Trim analysis warning IL2026: Microsoft.Extensions.DependencyInjection.ServiceDescriptor.Describe<IConfigureOptio
ns`1<ConsoleFormatterOptions>,ConsoleLoggerFormatterConfigureOptions`2<SystemdConsoleFormatter,ConsoleFormatterOptions>
>(ServiceLifetime): Using member 'Microsoft.Extensions.Logging.ConsoleLoggerFormatterConfigureOptions`2<SystemdConsoleF
ormatter,ConsoleFormatterOptions>.ConsoleLoggerFormatterConfigureOptions`2<SystemdConsoleFormatter,ConsoleFormatterOpti
ons>(ILoggerProviderConfiguration`1<ConsoleLoggerProvider>)' which has 'RequiresUnreferencedCodeAttribute' can break fu
nctionality when trimming application code. TOptions's dependent types may have their members trimmed. Ensure all requi
red members are preserved. [D:\dev\company_project\webapi\webapi_mes\webapi_mes.csproj]
ILC : Trim analysis warning IL2026: Microsoft.Extensions.DependencyInjection.ServiceDescriptor.Singleton<IConfigureOpti
ons`1<SimpleConsoleFormatterOptions>,ConsoleLoggerFormatterConfigureOptions`2<SimpleConsoleFormatter,SimpleConsoleForma
tterOptions>>(): Using member 'Microsoft.Extensions.Logging.ConsoleLoggerFormatterConfigureOptions`2<SimpleConsoleForma
tter,SimpleConsoleFormatterOptions>.ConsoleLoggerFormatterConfigureOptions`2<SimpleConsoleFormatter,SimpleConsoleFormat
terOptions>(ILoggerProviderConfiguration`1<ConsoleLoggerProvider>)' which has 'RequiresUnreferencedCodeAttribute' can b
reak functionality when trimming application code. TOptions's dependent types may have their members trimmed. Ensure al
l required members are preserved. [D:\dev\company_project\webapi\webapi_mes\webapi_mes.csproj]
ILC : Trim analysis warning IL2026: Microsoft.Extensions.DependencyInjection.ServiceDescriptor.Describe<IConfigureOptio
ns`1<SimpleConsoleFormatterOptions>,ConsoleLoggerFormatterConfigureOptions`2<SimpleConsoleFormatter,SimpleConsoleFormat
terOptions>>(ServiceLifetime): Using member 'Microsoft.Extensions.Logging.ConsoleLoggerFormatterConfigureOptions`2<Simp
leConsoleFormatter,SimpleConsoleFormatterOptions>.ConsoleLoggerFormatterConfigureOptions`2<SimpleConsoleFormatter,Simpl
eConsoleFormatterOptions>(ILoggerProviderConfiguration`1<ConsoleLoggerProvider>)' which has 'RequiresUnreferencedCodeAt
tribute' can break functionality when trimming application code. TOptions's dependent types may have their members trim
med. Ensure all required members are preserved. [D:\dev\company_project\webapi\webapi_mes\webapi_mes.csproj]
ILC : Trim analysis warning IL2026: Microsoft.Extensions.DependencyInjection.ServiceDescriptor.Singleton<IConfigureOpti
ons`1<ConsoleLoggerOptions>,LoggerProviderConfigureOptions`2<ConsoleLoggerOptions,ConsoleLoggerProvider>>(): Using memb
er 'Microsoft.Extensions.Logging.Configuration.LoggerProviderConfigureOptions`2<ConsoleLoggerOptions,ConsoleLoggerProvi
der>.LoggerProviderConfigureOptions`2<ConsoleLoggerOptions,ConsoleLoggerProvider>(ILoggerProviderConfiguration`1<Consol
eLoggerProvider>)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code
. TOptions's dependent types may have their members trimmed. Ensure all required members are preserved. [D:\dev\company
_project\webapi\webapi_mes\webapi_mes.csproj]
ILC : Trim analysis warning IL2026: Microsoft.Extensions.DependencyInjection.ServiceDescriptor.Describe<IConfigureOptio
ns`1<ConsoleLoggerOptions>,LoggerProviderConfigureOptions`2<ConsoleLoggerOptions,ConsoleLoggerProvider>>(ServiceLifetim
e): Using member 'Microsoft.Extensions.Logging.Configuration.LoggerProviderConfigureOptions`2<ConsoleLoggerOptions,Cons
oleLoggerProvider>.LoggerProviderConfigureOptions`2<ConsoleLoggerOptions,ConsoleLoggerProvider>(ILoggerProviderConfigur
ation`1<ConsoleLoggerProvider>)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming ap
plication code. TOptions's dependent types may have their members trimmed. Ensure all required members are preserved. [
D:\dev\company_project\webapi\webapi_mes\webapi_mes.csproj]
C:\Users\Administrator\.nuget\packages\microsoft.aspnetcore.app.runtime.win-x64\7.0.4\runtimes\win-x64\lib\net7.0\Micro
soft.AspNetCore.Http.Extensions.dll : warning IL3053: Assembly 'Microsoft.AspNetCore.Http.Extensions' produced AOT anal
ysis warnings. [D:\dev\company_project\webapi\webapi_mes\webapi_mes.csproj]
C:\Users\Administrator\.nuget\packages\microsoft.aspnetcore.app.runtime.win-x64\7.0.4\runtimes\win-x64\lib\net7.0\Micro
soft.AspNetCore.Http.Results.dll : warning IL2104: Assembly 'Microsoft.AspNetCore.Http.Results' produced trim warnings.
 For more information see https://aka.ms/dotnet-illink/libraries [D:\dev\company_project\webapi\webapi_mes\webapi_mes.c
sproj]
C:\Users\Administrator\.nuget\packages\microsoft.aspnetcore.app.runtime.win-x64\7.0.4\runtimes\win-x64\lib\net7.0\Micro
soft.AspNetCore.Http.Results.dll : warning IL3053: Assembly 'Microsoft.AspNetCore.Http.Results' produced AOT analysis w
arnings. [D:\dev\company_project\webapi\webapi_mes\webapi_mes.csproj]
C:\Users\Administrator\.nuget\packages\microsoft.aspnetcore.app.runtime.win-x64\7.0.4\runtimes\win-x64\lib\net7.0\Micro
soft.AspNetCore.Hosting.dll : warning IL3053: Assembly 'Microsoft.AspNetCore.Hosting' produced AOT analysis warnings. [
D:\dev\company_project\webapi\webapi_mes\webapi_mes.csproj]
/_/src/libraries/System.Private.Xml/src/System/Xml/Serialization/ReflectionXmlSerializationReader.cs(34): Trim analysis
 warning IL2026: System.Xml.Serialization.ReflectionXmlSerializationReader..cctor(): Using member 'System.Xml.Serializa
tion.TypeScope.GetTypeDesc(Type)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming a
pplication code. calls GetTypeDesc. [D:\dev\company_project\webapi\webapi_mes\webapi_mes.csproj]
/_/src/libraries/System.Private.Xml/src/System/Xml/Serialization/ReflectionXmlSerializationReader.cs(35): Trim analysis
 warning IL2026: System.Xml.Serialization.ReflectionXmlSerializationReader..cctor(): Using member 'System.Xml.Serializa
tion.TypeScope.GetTypeDesc(Type)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming a
pplication code. calls GetTypeDesc. [D:\dev\company_project\webapi\webapi_mes\webapi_mes.csproj]
/_/src/libraries/System.Data.Common/src/System/Data/DataTable.cs(6664): Trim analysis warning IL2026: System.Data.DataT
able.System.Xml.Serialization.IXmlSerializable.GetSchema(): Using member 'System.Data.DataTable.GetXmlSchema()' which h
as 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. DataTable.GetSchema uses
 TypeDescriptor and XmlSerialization underneath which are not trimming safe. Members from serialized types may be trimm
ed if not referenced directly. [D:\dev\company_project\webapi\webapi_mes\webapi_mes.csproj]
/_/src/libraries/System.Data.Common/src/System/Data/DataSet.cs(3456): Trim analysis warning IL2026: System.Data.DataSet
.System.Xml.Serialization.IXmlSerializable.GetSchema(): Using member 'System.Data.DataSet.WriteXmlSchema(DataSet,XmlWri
ter)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. DataSet.Get
Schema uses TypeDescriptor and XmlSerialization underneath which are not trimming safe. Members from serialized types m
ay be trimmed if not referenced directly. [D:\dev\company_project\webapi\webapi_mes\webapi_mes.csproj]
C:\Users\Administrator\.nuget\packages\microsoft.aspnetcore.app.runtime.win-x64\7.0.4\runtimes\win-x64\lib\net7.0\Micro
soft.AspNetCore.DataProtection.dll : warning IL3053: Assembly 'Microsoft.AspNetCore.DataProtection' produced AOT analys
is warnings. [D:\dev\company_project\webapi\webapi_mes\webapi_mes.csproj]
ILC : Trim analysis warning IL2026: System.Security.Cryptography.Xml.CryptoHelpers.CreateFromName<T>(String): Using mem
ber 'System.Security.Cryptography.CryptoConfig.CreateFromName(String)' which has 'RequiresUnreferencedCodeAttribute' ca
n break functionality when trimming application code. The default algorithm implementations might be removed, use stron
g type references like 'RSA.Create()' instead. [D:\dev\company_project\webapi\webapi_mes\webapi_mes.csproj]
C:\Users\Administrator\.nuget\packages\microsoft.aspnetcore.app.runtime.win-x64\7.0.4\runtimes\win-x64\lib\net7.0\Syste
m.Security.Cryptography.Xml.dll : warning IL2104: Assembly 'System.Security.Cryptography.Xml' produced trim warnings. F
or more information see https://aka.ms/dotnet-illink/libraries [D:\dev\company_project\webapi\webapi_mes\webapi_mes.csp
roj]