Skip to content

Discriminated union .Is* properties causing compile time error #18263

@p5ych08illy

Description

@p5ych08illy

Compile time error since Visual Studio update: "Error in pass2 for type Foo, error: duplicate entry 'get_IsSZ' in method table."

Repro steps

Create blank F# class library

namespace FSharpClassLibrary4

module Say =
    let hello name =
        printfn "Hello %s" name

    type Foo = 
    | SZ
    | STZ
    | ZS
    | ASZ

Expected behavior

The example compiles successfully.

Actual behavior

Compile time error:
"A problem occurred writing the binary 'C:...\FSharpClassLibrary4\FSharpClassLibrary4\obj\Debug\net6.0\FSharpClassLibrary4.dll': Error in pass2 for type FSharpClassLibrary4.Say, error: Error in pass2 for type Foo, error: duplicate entry 'get_IsSZ' in method table"

Known workarounds

  1. Use Language version 8
  2. Rename SZ type not to begin with SZ

Related information

.NET SDK: 9.0.102
Visual Studio: 17.12.4

Metadata

Metadata

Assignees

Labels

Area-Compiler-CodeGenIlxGen, ilwrite and things at the backendBugImpact-High(Internal MS Team use only) Describes an issue with extreme impact on existing code.

Type

No fields configured for Bug.

Projects

Status

New

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions