Skip to content

Declaration referenced in a method implementation cannot be a final method. Npgsql.NpgsqlBatchCommandCollection #3935

Closed

Description

@pbiggar

I get this exception when starting my app after upgrading to npgsql 6.0.0-preview7 with .NET6 RC1.

Unhandled exception. System.AggregateException: One or more errors occurred. (Declaration referenced in a method implementation cannot be a final method.  Type: 'Npgsql.NpgsqlBatchCommandCollection'.  Assembly: 'Npgsql, Version=6.0.0.0, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7'.)
 ---> System.TypeLoadException: Declaration referenced in a method implementation cannot be a final method.  Type: 'Npgsql.NpgsqlBatchCommandCollection'.  Assembly: 'Npgsql, Version=6.0.0.0, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7'.
   at Npgsql.PostgresDatabaseInfo.LoadBackendTypes(NpgsqlConnector conn, NpgsqlTimeout timeout, Boolean async)

Full stack trace:

Details Unhandled exception. System.AggregateException: One or more errors occurred. (Declaration referenced in a method implementation cannot be a final method. Type: 'Npgsql.NpgsqlBatchCommandCollection'. Assembly: 'Npgsql, Version=6.0.0.0, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7'.) ---> System.TypeLoadException: Declaration referenced in a method implementation cannot be a final method. Type: 'Npgsql.NpgsqlBatchCommandCollection'. Assembly: 'Npgsql, Version=6.0.0.0, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7'. at Npgsql.PostgresDatabaseInfo.LoadBackendTypes(NpgsqlConnector conn, NpgsqlTimeout timeout, Boolean async) at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine) at Npgsql.PostgresDatabaseInfo.LoadBackendTypes(NpgsqlConnector conn, NpgsqlTimeout timeout, Boolean async) at Npgsql.PostgresDatabaseInfo.LoadPostgresInfo(NpgsqlConnector conn, NpgsqlTimeout timeout, Boolean async) at Npgsql.PostgresDatabaseInfoFactory.Load(NpgsqlConnector conn, NpgsqlTimeout timeout, Boolean async) at Npgsql.Internal.NpgsqlDatabaseInfo.Load(NpgsqlConnector conn, NpgsqlTimeout timeout, Boolean async) at Npgsql.Internal.NpgsqlConnector.LoadDatabaseInfo(Boolean forceReload, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken) at Npgsql.Internal.NpgsqlConnector.Open(NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken) at Npgsql.ConnectorPool.OpenNewConnector(NpgsqlConnection conn, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken) at Npgsql.ConnectorPool.g__RentAsync|29_0(NpgsqlConnection conn, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken) at Npgsql.NpgsqlConnection.g__OpenAsync|45_0(Boolean async, CancellationToken cancellationToken) at Npgsql.FSharp.Sql.executeNonQueryAsync@477-3.Invoke(Unit unitVar0) at Ply.TplPrimitives.AwaitableContinuation`3.Invoke(Unit r) at Ply.TplPrimitives.combine@240.Invoke(AwaitableContinuation`3 this) at Ply.TplPrimitives.AwaitableContinuation`3.Invoke(Unit r) at Ply.TplPrimitives.tryFinally@257.Invoke(AwaitableContinuation`3 this) at Ply.TplPrimitives.ContinuationStateMachine`1.System-Runtime-CompilerServices-IAsyncStateMachine-MoveNext() at LibBackend.Db.Sql.executeStatementAsync@69-2.Invoke(Unit unitVar0) in /home/dark/app/fsharp-backend/src/LibBackend/Db.fs:line 69 at Ply.TplPrimitives.ContinuationStateMachine`1.System-Runtime-CompilerServices-IAsyncStateMachine-MoveNext() at Prelude.Task.map@1134-4.Invoke(Unit unitVar0) in /home/dark/app/fsharp-backend/src/Prelude/Prelude.fs:line 1134 at Ply.TplPrimitives.ContinuationStateMachine`1.System-Runtime-CompilerServices-IAsyncStateMachine-MoveNext() at LibBackend.Account.upsertAccount@143-4.Invoke(Unit unitVar0) in /home/dark/app/fsharp-backend/src/LibBackend/Account.fs:line 143 at Ply.TplPrimitives.ContinuationStateMachine`1.System-Runtime-CompilerServices-IAsyncStateMachine-MoveNext() at LibBackend.Account.initTestAccounts@352-6.Invoke(Unit unitVar0) in /home/dark/app/fsharp-backend/src/LibBackend/Account.fs:line 352 at Ply.TplPrimitives.ContinuationStateMachine`1.System-Runtime-CompilerServices-IAsyncStateMachine-MoveNext() --- End of inner exception stack trace --- at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken) at System.Threading.Tasks.Task.Wait() at Tests.All.main(String[] args) in /home/dark/app/fsharp-backend/tests/Tests/Tests.fs:line 17

Steps to reproduce

It can be reproduced pretty easily in our repo, using this commit: darklang/dark@6e3b151. If you want to check it out, running ./scripts/builder --watch --compile --test from a clean checkout should hit the error.

Further technical details

Npgsql version: 6.0.0-preview7
PostgreSQL version: 9.6
Operating system: Linux
.NET: 6.0.100-rc.1.21417.9"

Activity

  1. roji commented on Aug 20, 2021

    @roji
    Member

    @pbiggar there was a change to the batching API merged for rc1, which is most probably the source of this issue. Use Npgsql 6.0.0-preview7 with the corresponding dotnet SDK 6.0.0-preview7 - Npgsql 6.0.0-rc1 will be compatible with dotnet SDK 6.0.0-rc1.

  2. pbiggar commented on Aug 20, 2021

    @pbiggar
    Author

    Thanks for the clarification. Alas I can't use preview7 due to other dependency conflicts. Will look forward to npgsql rc1, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions