dotnet / fsharp

The F# compiler, F# core library, F# language service, and F# tooling integration for Visual Studio
https://dotnet.microsoft.com/languages/fsharp
MIT License
3.87k stars 779 forks source link

"Internal error or badly formatted metadata" #5608

Closed matthid closed 2 years ago

matthid commented 6 years ago

Continuation of https://github.com/ionide/ionide-vscode-fsharp/issues/912

Ionide: image

VS 2017: image

open Microsoft.Extensions.Logging
open System

let provider =
    { new ILoggerProvider with
        member x.Dispose() = ()
        member x.CreateLogger name =
            { new ILogger with
                member x.Log<'TState>(logLevel: LogLevel, eventId : EventId, state: 'TState, exception: exn, formatter: Func<'TState, exn, string>) =
                    ()
                member x.IsEnabled (logLevel:LogLevel ) = true
                member x.BeginScope<'TState> (State: 'TState) =
                    { new IDisposable with
                        member x.Dispose() = () } } }

Repro steps

Paste the above code into your project and install the Microsoft.Extensions.Logging NuGet package

Expected behavior

Only "exception" should be underlined and the error message should be:

image

Actual behavior

"Internal error" is shown to the user

Known workarounds

None. Notice that you used an keyword.

Related information

Provide any related information

cartermp commented 6 years ago

Thanks, agreed on what the error should be.

Hey @TIHan image

dsyme commented 2 years ago

This is niche enough that I'm going to close this - exception is rarely used and the awkward diagnostic hasn't been seen in other cases.