Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Sep 17 12:14
    devhb opened #55
  • Aug 28 12:18
    larsholm opened #54
  • Aug 24 20:05

    jeremydmiller on master

    fix for CheckEnvironment() with… (compare)

  • Jun 25 15:37

    jeremydmiller on master

    upgrading to Baseline 3.2. Bump… (compare)

  • May 27 13:00

    jeremydmiller on master

    bumping to 3.2 (compare)

  • May 27 12:58

    jeremydmiller on master

    Manually wait for IHost to unlo… (compare)

  • May 27 12:58
    jeremydmiller closed #53
  • May 27 12:58

    jeremydmiller on master

    Add code from Andrew Lock http… Apply fixes from Andrew Lock's … (compare)

  • May 27 12:58
    jeremydmiller closed #52
  • May 26 21:13
    bdukes opened #53
  • May 26 00:20
    TheFellow commented #51
  • May 15 18:39
    flipdoubt commented #51
  • May 11 21:23
    flipdoubt commented #51
  • May 06 10:43
    bitbonk opened #52
  • Apr 09 15:36
    yehudamakarov edited #51
  • Apr 09 15:35
    yehudamakarov opened #51
  • Apr 07 13:26
    lvermeulen commented #50
  • Apr 07 13:26
    lvermeulen commented #50
  • Apr 07 13:26
    lvermeulen commented #50
  • Apr 07 13:25
    lvermeulen commented #50
bitbonk
@bitbonk
This is super cool, this should be part of Oakton: https://andrewlock.net/viewing-overriden-configuration-values-in-aspnetcore/
Jeremy D. Miller
@jeremydmiller
@bitbonk It is in 4.1 just by dumping out the built in ConfigurationRoot diagnostics, but not as pretty as what he did. Sounds like a good PR:)
bitbonk
@bitbonk
especially the overwritten values view, this is a live saver
Jeremy D. Miller
@jeremydmiller
Yup. I added it specifically for a project at work for exactly that reason.
bitbonk
@bitbonk
I'll see if I can get a PR ready, just might need to ask if I may steal the code from that post
Jeremy D. Miller
@jeremydmiller
I don’t think he’d mind, and it should be a quick win. should
bitbonk
@bitbonk
@jeremydmiller So here we go: JasperFx/oakton#52
David Smith
@flipdoubt
After changing the standard CreateHostBuilder(args).Build().Run() to CreateHostBuilder(args).RunOaktonCommands(args), some of the our middleware get loggers without log sinks configured. All I have to do is change to code back to fix it, so Build().Run(args) does something RunOaktonCommands(args) does not do. Any clue what that might be and whether there is a work around? It's as if Oakton doesn't call IHostBuilder.Build, but it is hard to tell.
Jeremy D. Miller
@jeremydmiller
@flipdoubt I think it’s more likely that what Oakton is doing when it tries to set the log level dynamically is messing with you.
David Smith
@flipdoubt
@jeremydmiller , I'm "good" with that too, though still confused because it only affects some of our loggers. Do you have any suggestions for a work around? How/where can I help?
Jeremy D. Miller
@jeremydmiller
If there isn’t one already, could you raise a bug in GitHub?
In the Oakton codebase, do a find usages on the NetInput.LogLevelFlag and see where it might be using that too aggressively. I’m inclined to blame Oakton’s special sauce here.
Like it may be clearing logging when it shouldn’t be.
David Smith
@flipdoubt
Looks like the same issue as #51 . I will look into the code too. Thanks.
Jeremy D. Miller
@jeremydmiller
@flipdoubt Sigh, it’s overdue for me to look at it if you don’t find something
David Smith
@flipdoubt
image.png
NetCoreInput.cs line 44 would be my guess, but I'm not sure what the intent is behind the code.
Jeremy D. Miller
@jeremydmiller
The original idea was to be able to change the log level up or down based on the input flag
David Smith
@flipdoubt
I haven't stepped into what HostBuilder.ConfigureLogging does, but does that clear all the individual namespaced filters I've configured in Serilog? I will need to write a sample that uses Serilog.
Jeremy D. Miller
@jeremydmiller
I’m guessing so.
David Smith
@flipdoubt
I've spent a decent chunk of time on it and found that code in NetCoreInput never has a logger value and does not do anything out of the ordinary. Something that Oakton does while loading configuration from appsettings.json interferes with how Serilog configures sinks and forces Serilog to use a SilentLogger as described by serilog/serilog#562 and shown below.
image.png
I am able to correct this by configuring Serilog with the preserveStaticLogger: true parameter described here.
Essentially, Oakton and Serilog don't play nice together if your Serilog configuration does something fancy like load sinks from appsettings.
Jeremy D. Miller
@jeremydmiller
Or Serilog does something odd to locate the appsettings.json itself. I’ve had no reports of problems with Oakton plus IConfiguration, so that might actually be pointing the finger at Serilog itself.
David Smith
@flipdoubt
Agreed.
Brian Dukes
@bdukes
I'm setting up a new ASP.NET 5 app and when using the RunOaktonCommands (from Oakton 3.1.0 NuGet package), the site starts and then stops immediately.
❯ dotnet run
Building...
Searching 'Lamar.Diagnostics, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' for commands
info: Microsoft.Hosting.Lifetime[0]
Now listening on: https://localhost:5001
info: Microsoft.Hosting.Lifetime[0]
Now listening on: http://localhost:5000
info: Microsoft.Hosting.Lifetime[0]
Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
Hosting environment: Development
info: Microsoft.Hosting.Lifetime[0]
Content root path: C:\inetpub\wwwroot\iss.local\InnovativeStaffSolutions.EmployeeManagement.Web
info: Microsoft.Hosting.Lifetime[0]
Application is shutting down...
Brian Dukes
@bdukes
If I switch the PackageReference to Oakton.AspNetCore 3.0.0 and continue with using Oakton; then it seems to work, but if I use using Oakton.AspNetCore; running the web app works, but running commands gives null references or empty output 🤷🏻‍♂️
Jeremy D. Miller
@jeremydmiller
Oakton.AspNetCore is obsolete, and stuck back at .Net Core 3.1. I'll try it out tomorrow on a local app, but I haven't seen this behavior at all.
Brian Dukes
@bdukes
👍🏻
Brian Dukes
@bdukes
I found that it works with Oakton 3.0.0 (which is what I was getting when I referenced Oakton.AspNetCore), but not with 3.0.1, 3.0.2, or 3.1.0
Jeremy D. Miller
@jeremydmiller
@bdukes When you did that, did you get any Nuget warnings about version mismatches?
Brian Dukes
@bdukes
no, only when I tried to use Oakton 2.0.5
Brian Dukes
@bdukes

That error was:

Determining projects to restore...
C:\inetpub\wwwroot\iss.local\InnovativeStaffSolutions.EmployeeManagement.Web\InnovativeStaffSolutions.EmployeeManagement.Web.csproj : error NU1605: Detected package downgrade: Oakton from 3.0.0 to 2.0.5. Reference the package directly from the project to select a different version.
C:\inetpub\wwwroot\iss.local\InnovativeStaffSolutions.EmployeeManagement.Web\InnovativeStaffSolutions.EmployeeManagement.Web.csproj : error NU1605: InnovativeStaffSolutions.EmployeeManagement.Web -> Lamar.Diagnostics 3.0.2 -> Oakton (>= 3.0.0 && < 4.0.0)
C:\inetpub\wwwroot\iss.local\InnovativeStaffSolutions.EmployeeManagement.Web\InnovativeStaffSolutions.EmployeeManagement.Web.csproj : error NU1605: InnovativeStaffSolutions.EmployeeManagement.Web -> Oakton (>= 2.0.5)
Failed to restore C:\inetpub\wwwroot\iss.local\InnovativeStaffSolutions.EmployeeManagement.Web\InnovativeStaffSolutions.EmployeeManagement.Web.csproj (in 792 ms).

Brian Dukes
@bdukes
@jeremydmiller were you able to take a look at that issue and replicate? let me know if there's any other info I can provide. Thanks!
Brian Dukes
@bdukes
Looking at the difference between 3.0.0 and 3.0.1, it looks like it's probably related to the RunCommand switching to OaktonAsyncCommand (or, rather, the changes to the body of the command when that change happened)
Brian Dukes
@bdukes
I've confirmed that reverting the code in RunCommand to the non-async version fixed the issue for me. I tried a few variations with the async version but couldn't get it to wait without the Unloading event handling. However, I also saw that the issue went away after I added Serilog. So it apparently has something to do with how the internals of ASP.NET 5 are being configured.
Jeremy D. Miller
@jeremydmiller
In that case, would you create a PR to move RunCommand back to being sync? I'd be lying if I said I remember why that changed.
Brian Dukes
@bdukes
👍🏻 can do
Brian Dukes
@bdukes
Just submitted #53
Steven T. Cramer
@StevenTCramer
async checks dont' report as an error for me.
image.png
image.png
switching to sync check and I get the above
Steven T. Cramer
@StevenTCramer
image.png
something like this but async checks don't seem to work.
Jeremy D. Miller
@jeremydmiller
Can you make sure you’re on the very, very latest Oakton?
And maybe just throw the exception out of that method?
Steven T. Cramer
@StevenTCramer
I am updating my blazor template to add Oakton I will try again when I get back to it and let you know.