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
Name
field has been added to the SQL Server Profiler storage- Fix: Add a
nvarchar(200) null
field to yourMiniProfilers
table.
- 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.
IProfilerProvider
replaced 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.
IStorage
replaced 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
, andSimpleProfiledCommand
no longer implementICloneable
innetstandard
(it doesn’t exist there)- Fix: if you need this, please file an issue. The
ICloneable
interface 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
IUserProvider
has been removed, it’s now just a function on the settings.- Fix (ASP.NET): Use
MiniProfilerWebSettings.UserIdProvider = myFunc
- Fix (ASP.NET Core): Set
UserIdProvider
inMiniProfilerOptions
inStartup.cs
- Fix (ASP.NET): Use
Obsolete Things Removed in V4
IProfilerProvider.Start(ProfileLevel level, string sessionName = null)
MiniProfiler.Settings.ExcludeStackTraceSnippetFromSqlTimings
MiniProfiler.Settings.UseExistingjQuery
MiniProfilerExtensions.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
.tmpl
are still replaceable, theshare
andincludes
templates 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.