Skip to content

Extra DebugPoint present for type provider static arguments #13219

@hyazinthh

Description

@hyazinthh

When using a provided type (e.g. HtmlProvider<Url>) in a type extension I get the following error:

FS0267 This is not a valid constant expression or custom attribute value

Seems to be a regression, this used to work with Visual Studio < 17.2.0 as far as I know.

Repro steps

Example project: Test.zip

module Test

open FSharp.Data

[<Literal>]
let url = "https://en.wikipedia.org/wiki/F_Sharp_(programming_language)"

// Works
let html = new HtmlProvider<url>()

type System.Object with

    // Works
    member x.Html = new HtmlProvider<"https://en.wikipedia.org/wiki/F_Sharp_(programming_language)">()

    // Error: FS0267 This is not a valid constant expression or custom attribute value
    member x.Html = new HtmlProvider<url>()

Expected behavior

Should compile.

Actual behavior

Fails with error above.

Known workarounds

Use the literal directly as parameter.

  • Windows 10
  • .NET 6
  • Visual Studio 17.2.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-Compiler-CheckingType checking, attributes and all aspects of logic checkingBugImpact-Medium(Internal MS Team use only) Describes an issue with moderate impact on existing code.ReadyRegression

    Type

    No type

    Projects

    Status

    Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions