Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.NET 6 Minimal Api with F# doesn't suggest the correct 'open' #1454

Closed
lucas-zimerman opened this issue Feb 1, 2022 · 5 comments
Closed

Comments

@lucas-zimerman
Copy link
Collaborator

lucas-zimerman commented Feb 1, 2022

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

@bruno-garcia
Copy link
Member

This method is defined on:

namespace Microsoft.AspNetCore.Hosting;

@bruno-garcia
Copy link
Member

Quick win here is to add the open Microsoft.AspNetCore.Hosting // Make sure to open this namespace to the install wizard and docs

@bruno-garcia
Copy link
Member

More generally, this issue would be resolved if we had extended the generic host: #1015

@bruno-garcia
Copy link
Member

@lucas-zimerman by any chance did you fix it already?

image

@lucas-zimerman
Copy link
Collaborator Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

No branches or pull requests

4 participants