Skip to content

Marten failure with Npgsql 4.1.0: System.MissingMethodException #2642

Closed

Description

@senzacionale

After upgrade I am getting strange error:

System.Exception: Error trying to fetch w/ sql 'SELECT schemaname, relname FROM pg_stat_user_tables WHERE relname LIKE ? AND schemaname = ANY(?);'
 ---> System.MissingMethodException: Method not found: 'Npgsql.NpgsqlDataReader Npgsql.NpgsqlCommand.ExecuteReader()'.
   at Marten.Util.CommandExtensions.Fetch[T](NpgsqlCommand cmd, String sql, Func`2 transform, Object[] parameters)
   at Marten.Storage.TenantExtensions.<>c__DisplayClass4_0`1.<Fetch>b__0(NpgsqlConnection conn)
   --- End of inner exception stack trace ---
   at Marten.Storage.TenantExtensions.<>c__DisplayClass4_0`1.<Fetch>b__0(NpgsqlConnection conn)
   at Marten.Storage.TenantExtensions.execute[T](ITenant tenant, Func`2 func)
   at Marten.Storage.TenantExtensions.Fetch[T](ITenant tenant, String sql, Func`2 transform, Object[] parameters)
   at Marten.Schema.DbObjects.SchemaTables()
   at Marten.Schema.DocumentCleaner.CompletelyRemoveAll()
   at CryptoAnalysis.Auth.Api.Startup.InitializeDatabase() in /src/CryptoAnalysis.Auth.Api/Startup.cs:line 207
   at CryptoAnalysis.Auth.Api.Startup.Configure(IApplicationBuilder app, IWebHostEnvironment env) in /src/CryptoAnalysis.Auth.Api/Startup.cs:line 179
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at Microsoft.AspNetCore.Hosting.ConfigureBuilder.Invoke(Object instance, IApplicationBuilder builder)
   at Microsoft.AspNetCore.Hosting.ConfigureBuilder.<>c__DisplayClass4_0.<Build>b__0(IApplicationBuilder builder)
   at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.Configure(IApplicationBuilder app)
   at Microsoft.AspNetCore.Mvc.Filters.MiddlewareFilterBuilderStartupFilter.<>c__DisplayClass0_0.<Configure>g__MiddlewareFilterBuilder|0(IApplicationBuilder builder)
   at Microsoft.AspNetCore.HostFilteringStartupFilter.<>c__DisplayClass0_0.<Configure>b__0(IApplicationBuilder app)
   at Microsoft.AspNetCore.Hosting.WebHost.BuildApplication()

Any ideas why?

Activity

  1. manigandham commented on Sep 27, 2019

    @manigandham

    The stack trace tells you exactly what's wrong:

     ---> System.MissingMethodException: Method not found: 'Npgsql.NpgsqlDataReader Npgsql.NpgsqlCommand.ExecuteReader()'.
       at Marten.Util.CommandExtensions.Fetch[T](NpgsqlCommand cmd, String sql, Func`2 transform, Object[] parameters)
       at Marten.Storage.TenantExtensions.<>c__DisplayClass4_
    

    The ExecuteReader() method doesn't exist. What did you upgrade? npgsql? Which version? Looks like Marten isn't compatible with it. You should post your issue there with more details on versions: https://github.com/JasperFx/marten

  2. YohDeadfall commented on Sep 27, 2019

    @YohDeadfall
    Contributor

    Closing in favor of #2626.

  3. added a commit that references this issue on Sep 30, 2019
    ae07a80
  4. reopened this on Sep 30, 2019
  5. changed the title [-]System.Exception: Error trying to fetch w/ sql 'SELECT schemaname, relname FROM pg_stat_user_tables WHERE relname LIKE ? AND schemaname = ANY(?);' [/-] [+]Marten failure with Npgsql 4.1.0: System.MissingMethodException[/+] on Sep 30, 2019
  6. self-assigned this
    on Sep 30, 2019
  7. added this to the 4.1.1 milestone on Sep 30, 2019
  8. added a commit that references this issue on Sep 30, 2019
    8c563a7
  9. added theissue type on Jun 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions