dotnet / dotnet/fsharp

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

Open
#15,510 1 comment 0 reactions 0 assignees View on GitHub
Area-Compiler-ImportAndInterop Feature Request
Dominant language
F#
Stars
4.3k
Forks
876
Avg merge
4d 11h
Merged PRs (30d)
131

Description

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](https://github.com/dotnet/fsharp/files/11886782/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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.