You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The simple stupid error but I can't find any solution on internet.
I get a error with a simple project .NETFramework v4.6.1 with NuGet PackageReference.
Did I forget a specific reference?
Rider Database works well:
DBMS: PostgreSQL (ver. 12.3)
Case sensitivity: plain=lower, delimited=exact
Driver: PostgreSQL JDBC Driver (ver. 42.2.5, JDBC4.2)
Ping: 15 ms
SSL: no
The simple code in the test method:
var host = "localhost";
var port = 5432
var database = "postgres";
var username = "postgres";
var password = "password";
var connectionString = $"Host={host};Port={port};Database={database};Username={username};Password={password};";
var connection = new NpgsqlConnection(connectionString);
try
{
connection.Open();
}
catch (Exception ex)
{
var rtle = ex.InnerException as ReflectionTypeLoadException;
var exceptions = rtle.LoaderExceptions;
// ^^^^^^^^^^
// list of 2items: System.TypeLoadException: The 'DisposeAsync' method of type 'Npgsql.NpgsqlBinaryExporter' of assembly 'Npgsql, Version=4.1.3.1, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7' has no implementation.
}
System.TypeInitializationException: Une exception a été levée par l'initialiseur de type pour 'Npgsql.TypeMapping.GlobalTypeMapper'. ---> System.Reflection.ReflectionTypeLoadException: Impossible de charger un ou plusieurs des types requis. Extrayez la propriété LoaderExceptions pour plus d'informations.
à System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
à System.Reflection.RuntimeModule.GetTypes()
à System.Reflection.Assembly.GetTypes()
à Npgsql.TypeMapping.GlobalTypeMapper.SetupGlobalTypeMapper() dans C:\projects\npgsql\src\Npgsql\TypeMapping\GlobalTypeMapper.cs:ligne 161
à Npgsql.TypeMapping.GlobalTypeMapper..cctor() dans C:\projects\npgsql\src\Npgsql\TypeMapping\GlobalTypeMapper.cs:ligne 32
--- Fin de la trace de la pile d'exception interne ---
à Npgsql.TypeMapping.GlobalTypeMapper.get_Instance()
à Npgsql.TypeMapping.ConnectorTypeMapper..ctor(NpgsqlConnector connector) dans C:\projects\npgsql\src\Npgsql\TypeMapping\ConnectorTypeMapper.cs:ligne 60
à Npgsql.NpgsqlConnector.<LoadDatabaseInfo>d__149.MoveNext() dans C:\projects\npgsql\src\Npgsql\NpgsqlConnector.cs:ligne 431
--- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a été levée ---
à System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
à System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
à System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
à System.Runtime.CompilerServices.TaskAwaiter.GetResult()
à Npgsql.NpgsqlConnector.<Open>d__148.MoveNext() dans C:\projects\npgsql\src\Npgsql\NpgsqlConnector.cs:ligne 423
--- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a été levée ---
à System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
à System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
à System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
à System.Runtime.CompilerServices.TaskAwaiter.GetResult()
à Npgsql.ConnectorPool.<AllocateLong>d__28.MoveNext() dans C:\projects\npgsql\src\Npgsql\ConnectorPool.cs:ligne 249
--- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a été levée ---
à System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
à System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
à System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
à System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
à System.Threading.Tasks.ValueTask`1.get_Result()
à System.Runtime.CompilerServices.ValueTaskAwaiter`1.GetResult()
à Npgsql.NpgsqlConnection.<>c__DisplayClass32_0.<<Open>g__OpenLong|0>d.MoveNext() dans C:\projects\npgsql\src\Npgsql\NpgsqlConnection.cs:ligne 297
--- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a été levée ---
à System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
à System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
à System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
à System.Runtime.CompilerServices.TaskAwaiter.GetResult()
à Npgsql.NpgsqlConnection.Open() dans C:\projects\npgsql\src\Npgsql\NpgsqlConnection.cs:ligne 119
à Postgresql.Tests.Queries.Test() dans C:\Git\Postgresql.Tests\Queries.cs:ligne 20
The text was updated successfully, but these errors were encountered:
what is confusing me is that the <PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="1.1.1" /> reference (needed for IAsyncDisposable) was only added last month, but 4.1.3.1 is 4 months old ... so ... 😕
ah, duplicate: #2923 - there is some guidance in that other post, but the "real fix" kinda needs that addition. You could try adding the missing package reference locally, and hoping?
The simple stupid error but I can't find any solution on internet.
I get a error with a simple project .NETFramework v4.6.1 with NuGet PackageReference.
Did I forget a specific reference?
Rider Database works well:
DBMS: PostgreSQL (ver. 12.3)
Case sensitivity: plain=lower, delimited=exact
Driver: PostgreSQL JDBC Driver (ver. 42.2.5, JDBC4.2)
Ping: 15 ms
SSL: no
The simple code in the test method:
All PackageReference in the project.csproj:
The exception:
The text was updated successfully, but these errors were encountered: