## Where communities thrive

• Join over 1.5M+ people
• Join over 100K+ communities
• Free without limits
##### Activity
• Jan 12 02:14
incoventures opened #59
• Nov 29 2021 18:32

github-actions[bot] on v4.1.0

• Nov 29 2021 18:27

jeremydmiller on master

added the AutoStart option for … (compare)

• Nov 29 2021 16:39

github-actions[bot] on v4.0.0

• Nov 29 2021 16:39

jeremydmiller on master

fixed version in Oakton.csproj (compare)

• Nov 29 2021 16:37

jeremydmiller on master

using .net 6 in the nuget publi… (compare)

• Nov 29 2021 16:33
jeremydmiller closed #50
• Nov 29 2021 16:33

jeremydmiller on master

enabling the usage of the opts … (compare)

• Nov 29 2021 16:33
jeremydmiller commented #50
• Nov 29 2021 16:06
jeremydmiller closed #54
• Nov 29 2021 16:06
jeremydmiller commented #54
• Nov 29 2021 16:05
jeremydmiller closed #58
• Nov 29 2021 16:05
jeremydmiller commented #58
• Nov 29 2021 16:05
jeremydmiller closed #56
• Nov 29 2021 16:05
jeremydmiller commented #56
• Nov 29 2021 16:05

jeremydmiller on master

removing obsolete warnings, lit… simple recipe for using minimal… run commands synchronously mode… and 1 more (compare)

• Nov 29 2021 15:03
jeremydmiller edited #56
• Nov 29 2021 15:03
jeremydmiller opened #58
• Nov 29 2021 14:59
jeremydmiller commented #54
• Nov 27 2021 23:31
jeremydmiller opened #57
Jeremy D. Miller
@jeremydmiller
the results of dotnet publish?
Or if it writes to a dll, you can run that through dotnet run [assembly file name]. It’s been awhile since I’ve done that, so it might be a flag of some sort
David Smith
@flipdoubt

In dotnet core, dotnet run app.exe or any file produces a response like the following:

Couldn't find a project to run. Ensure a project exists in C:\code\publish\App, or pass the path to the project using --project.

From the dotnet-run docs:

The dotnet run command is used in the context of projects, not built assemblies. If you're trying to run a framework-dependent application DLL instead, you must use dotnet without a command.

Are people only using Oakton on source projects or on release builds as well?

Jeremy D. Miller
@jeremydmiller
If you have an exe, you should be able to just go “myapp [args]"
And folks are using Oakton to run .Net Core projects in production, yes. I’ve done that as well
David Smith
@flipdoubt
Excellent. So how do you invoke the describe command on a dotnet core executable compiled for release? For me, app.exe --describe or app.exe --help return without any console output.
Jeremy D. Miller
@jeremydmiller
app.exe describe
app.exe help should give you the help output
You wouldn’t need the double dash if you’re running from the executable instead of dotnet run
David Smith
@flipdoubt
Ah, ok. When I run app.exe help on my dev machine, my app logs the same FileNotFoundException referencing "Microsoft.CodeAnalysis". Now that I can reproduce that locally, I will go through the cleaning exercise.
Jeremy D. Miller
@jeremydmiller
So we still have the Nuget problem. You might see what version of that nuget gets published by dotnet publish
David Smith
@flipdoubt

Same result.

Which package are you referring to with "you might see what version of that nuget gets published by dotnet publish"? There is no Microsoft.CodeAnalysis.dll in the publish output.

Jeremy D. Miller
@jeremydmiller
So when it says FileNotFoundException, it’s unable to load the assembly referenced. You might try making a direct dependency to that nuget package w/ that version
David Smith
@flipdoubt
Got it.
Thanks.
Jeremy D. Miller
@jeremydmiller
Sorry this is being frustrating. We’ve all been there.
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
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.
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
Now listening on: https://localhost:5001
Now listening on: http://localhost:5000
Application started. Press Ctrl+C to shut down.
Hosting environment: Development
Content root path: C:\inetpub\wwwroot\iss.local\InnovativeStaffSolutions.EmployeeManagement.Web
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?