How-To Upgrade From MiniProfiler V3
MiniProfiler V4 has major breaking changes in layout compared to V3 due to needing to support both ASP.NET and ASP.NET Core.
Breaking Changes
RenderIncludes()is now an instance method- Fix: change
MiniProfiler.RenderIncludes()toMiniProfiler.Current.RenderIncludes()
- Fix: change
- A
Namefield has been added to the SQL Server Profiler storage- Fix: Add a
nvarchar(200) nullfield to yourMiniProfilerstable.
- Fix: Add a
- .NET 4.6.1+ (or
netstandard2.0) are required (due to lack of the framework bits needed to really make async profiling work correctly).- Fix: If you need .NET 4.6 and below, continue to use MiniProfiler V3.
MiniProfiler.Step()andMiniProfiler.StepIf()methods now returnTiming(the same previous underlying type) instead ofIDisposable.- Fix: this shouldn’t require changes beyond a recompile, but adds functionality.
IProfilerProviderreplaced withIAsyncProfilerProvider(which addsStopAsync(bool discardResults))- Fix: if you implemented your own provider, you’ll need to change the interface and implement all the new bits.
IStoragereplaced withIAsyncStorage(which addsListAsync,SaveAsync,LoadAsync,SetUnviewedAsync,SetViewedAsync, andGetUnviewedIdsAsync)- Fix: if you implemented your own storage, you’ll need to change the interface and implement all the new bits.
ProfiledDbCommand,ProfiledDbConnection, andSimpleProfiledCommandno longer implementICloneableinnetstandard(it doesn’t exist there)- Fix: if you need this, please file an issue. The
ICloneableinterface is gone…so, yeah.
- Fix: if you need this, please file an issue. The
MiniProfiler.Settings.(AssembliesToExclude|TypesToExclude|MethodsToExclude)changed fromIEnumerable<string>toHashSet<string>(for performance)- Fix: if you’re using these the access may need minor tweaks. If you were using
.Add(), no change is necessary.
- Fix: if you’re using these the access may need minor tweaks. If you were using
MiniProfiler.ToJson(MiniProfiler profiler)is nowprofiler.ToJson()(instance method)- Fix: change
MiniProfiler.ToJson(myProfiler)tomyProfiler.ToJson()
- Fix: change
IUserProviderhas been removed, it’s now just a function on the settings.- Fix (ASP.NET): Use
MiniProfilerWebSettings.UserIdProvider = myFunc - Fix (ASP.NET Core): Set
UserIdProviderinMiniProfilerOptionsinStartup.cs
- Fix (ASP.NET): Use
Obsolete Things Removed in V4
IProfilerProvider.Start(ProfileLevel level, string sessionName = null)MiniProfiler.Settings.ExcludeStackTraceSnippetFromSqlTimingsMiniProfiler.Settings.UseExistingjQueryMiniProfilerExtensions.Inline<T>(this MiniProfiler profiler, Func<T> selector, string name, ProfileLevel level)MiniProfilerExtensions.Step(this MiniProfiler profiler, string name, ProfileLevel level)MiniProfiler.Stop()(now an instance method:MiniProfiler.Current?.Stop())- UI templating has been removed. While Stylesheets and the
.tmplare still replaceable, theshareandincludestemplates are now much more optimized code. Given the very few people customizing these (was anyone using those pieces?), they certainly weren’t worth the performance tradeoffs. If there’s a loud demand for them to come back, we’ll find a more efficient way to do it.