MiniProfiler, .NET 5, & ProfilingViewComponentInvokerFactory
See original GitHub issueI’m not sure if I’m crazy, or what the deal is here. Does MiniProfiler support AspNetCore on NET5
? I don’t see a pre-release version and I’m getting some weird behaviors where it doesn’t seem like it’s loading the correct dll.
I was curious to lookup profiling for ViewComponents in MiniProfiler and stumbled across #286. Which seems to be exactly what I was looking for, but it doesn’t seem to be working. I tried to wire it up myself via a call to
services.AddSingleton<Microsoft.AspNetCore.Mvc.ViewComponents.IViewComponentInvokerFactory,
StackExchange.Profiling.Internal.ProfilingViewComponentInvokerFactory>();
But I get an error on being unable to resolve ProfilingViewComponentInvokerFactory
.
I tried navigating to the source of AddMiniProfiler
and got redirected to the decompiled source for \.nuget\packages\miniprofiler.aspnetcore.mvc\4.2.22\lib\netcoreapp3.0\MiniProfiler.AspNetCore.Mvc.dll
. Which seemed odd, cause I’m not on netcoreapp3.0
, I’m on net5
, but so be it. I checked the source in github MiniProfiler.AspNetCore.Mvc/MvcExtensions.cs
, and even that matches what my decompiled source gives, if NETCOREAPP3_0
resolved to true
. However if I actually use #if NETCOREAPP3_0
in my own code, it’s greyed out and doesn’t run.
Is there a compatibility issue with the MiniProfiler Nuget package, and NET5? And if not, how do you get support for ViewComponent profiling (and out of curiosity, shouldn’t ProfilingViewComponentInvokerFactory
be registered as a singleton like DefaultViewComponentInvokerFactory
is by default?)
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (2 by maintainers)
Awesome! Glad to see that this is something that can be tracked. I remember coming across the calls to
BeforeViewComponent
in the component invoker, but didn’t have experience/understanding with diagnostic listeners to understand how they were used, or that MiniProfiler used them underneath. Super slick, I’ll have to read up on how they work. Excited to see this added to MiniProfiler. Always appreciate your time on this stuff!No worries, and congrats on the job! I’m not at all surprised to see Microsoft eventually snag you up with your skills and talents. Looking forward to seeing what sort of stuff you end up working on, both with regards to Azure and other OSS contributions!
Just grabbed
4.2.49
off of MyGet to give it a shot, and it seems to work great for me. Components show in the list of events exactly where I’d expect. Any ideas as to when the next publish to Nuget is planned?