You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We've been using the ActivityMonitor in WebHostBuilder.ConfigureServices(), but any monitor we use there does not output to file.
Upon further inspection, this is basically caused by CK-AspNet's StartupFilter; StartupFilters are executed after the whole ConfigureServices() pipeline (which makes sense, since they're registered in the ConfigureServices() pipeline).
Example code:
usingCK.Core;usingMicrosoft.AspNetCore;usingMicrosoft.AspNetCore.Builder;usingMicrosoft.AspNetCore.Hosting;usingMicrosoft.Extensions.DependencyInjection;usingSystem;namespaceWebApplication3{publicclassProgram{publicstaticvoidMain(string[]args){BuildWebHost(args).Run();}publicstaticIWebHostBuildWebHost(string[]args)=>WebHost.CreateDefaultBuilder(args).UseStartup<Startup>().UseMonitoring().ConfigureServices(services =>{// GrandOutput doesn't have any handler yetActivityMonitorm=newActivityMonitor();m.Error("Error in ConfigureServices()");// Register startup filterservices.AddSingleton<IStartupFilter,StartupFilterTest>();}).Configure((app)=>{// Register ApplicationStartedapp.ApplicationServices.GetRequiredService<IApplicationLifetime>().ApplicationStarted.Register(OnApplicationStarted);}).Build();publicclassStartupFilterTest:IStartupFilter{publicAction<IApplicationBuilder>Configure(Action<IApplicationBuilder>next)=>(app)=>{// GrandOutput is configuredActivityMonitorm=newActivityMonitor();m.Error("Error in StartupFilter");next?.Invoke(app);};}privatestaticvoidOnApplicationStarted(){// GrandOutput is configuredActivityMonitorm=newActivityMonitor();m.Error("Error in ApplicationStarted");}}}
The text was updated successfully, but these errors were encountered:
We've been using the ActivityMonitor in WebHostBuilder.ConfigureServices(), but any monitor we use there does not output to file.
Upon further inspection, this is basically caused by CK-AspNet's StartupFilter; StartupFilters are executed after the whole ConfigureServices() pipeline (which makes sense, since they're registered in the ConfigureServices() pipeline).
Example code:
The text was updated successfully, but these errors were encountered: