Skip to content

[Inheritance] [protected] Cannot derive from NpgsqlTypeMappingSource beause of inability to override #15510

Open
@xperiandri

Description

@xperiandri

If I override all the methods F# complains about I get
System.TypeLoadException: 'Return type in method 'Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal.NpgsqlDiscriminatedUnionEnumTypeMappingSource.FindMapping(System.Type)' on type 'Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal.NpgsqlDiscriminatedUnionEnumTypeMappingSource' from assembly 'NpgsqlDiscriminatedUnionEnumTypeMappingSourceRepro, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' is not compatible with base type method 'Microsoft.EntityFrameworkCore.Storage.RelationalTypeMappingSource.FindMapping(System.Type)'.'

Repro steps

NpgsqlDiscriminatedUnionEnumTypeMappingSourceRepro.zip

  1. Extract the attached sample
  2. Run
  3. See exception
  4. Try removing lines 71-79 from NpgsqlDiscriminatedUnionEnumTypeMapping.fs
  5. See that the compiler complaints about protected members

Expected behavior

Lines 71-79 in NpgsqlDiscriminatedUnionEnumTypeMapping.fs are not required and the file successfully builds

Actual behavior

F# complaints about not implemented methods that are actually implemented

Known workarounds

No

Related information

  • .NET SDK 7.0.400-preview.23274.1
  • Visual Studio 2022 17.7 Preview 2.0
  • Visual F# Tools from @vzarytovskii OneDrive

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions