Extra DebugPoint present for type provider static arguments
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
This appears to be a regression, it compiles with VS2019
The problem is the incorrect presence of a debug point on url in this situation is affecting the analysis of the type provider argument
If you need a workaround you can do this odd thing:
member x.Html = new HtmlProvider<url>() |> id
``