sentry-dotnet
sentry-dotnet copied to clipboard
.NET 6 Minimal Api with F# doesn't suggest the correct 'open'
When using the following snippet
open System
open Microsoft.AspNetCore.Builder
open Microsoft.Extensions.Hosting
[<EntryPoint>]
let main args =
let builder = WebApplication.CreateBuilder(args)
builder.WebHost.UseSentry()
let app = builder.Build()
app.UseSentryTracing()
app.MapGet("/", Func<string>(fun () -> "Hello World!")) |> ignore
app.Run()
0 // Exit code
F# will complain that the type 'ConfigureWebHostBuilder' does not define the field, constructor or member 'UseSentry'.
Weirdly enough, the problem gets solved when including open Microsoft.AspNetCore.Hosting
This method is defined on:
https://github.com/getsentry/sentry-dotnet/blob/35b72f296ea000bfc5ee31a7264701cffff39437/src/Sentry.AspNetCore/SentryWebHostBuilderExtensions.cs#L9
Quick win here is to add the open Microsoft.AspNetCore.Hosting // Make sure to open this namespace to the install wizard and docs
More generally, this issue would be resolved if we had extended the generic host: https://github.com/getsentry/sentry-dotnet/pull/1015
@lucas-zimerman by any chance did you fix it already?

@bruno-garcia The doc got updated , Ideally we could create another issue to expand the generic host and close this one.