diff --git a/MiniProfiler.EF6.nuspec b/MiniProfiler.EF6.nuspec index d2f756938..0a66d7eb7 100644 --- a/MiniProfiler.EF6.nuspec +++ b/MiniProfiler.EF6.nuspec @@ -1,16 +1,16 @@ - MiniProfiler.EF6 - 3.0.11 - Jarrod Dixon, Yaakov Ellis - Jarrod Dixon, Yaakov Ellis + RevMiniProfiler.EF6 + 3.1.2 + Jarrod Dixon, Yaakov Ellis,rev.com + rev.com MiniProfiler integration for Entity Framework 6 http://miniprofiler.com http://www.apache.org/licenses/LICENSE-2.0 profiler sql mvc asp.net performance profiling timing entityframework - + en-US diff --git a/MiniProfiler.MVC4.nuspec b/MiniProfiler.MVC4.nuspec index cf7223f79..c2db0c8df 100644 --- a/MiniProfiler.MVC4.nuspec +++ b/MiniProfiler.MVC4.nuspec @@ -1,17 +1,17 @@  - MiniProfiler.MVC4 - 3.0.11 - Marc Gravell, Jarrod Dixon, Yaakov Ellis, Nick Craver - Marc Gravell, Jarrod Dixon Yaakov Ellis, Nick Craver + RevMiniProfiler.MVC4 + 3.1.2 + Marc Gravell, Jarrod Dixon, Yaakov Ellis, Nick Craver, rev.com + rev.com MiniProfiler extensions and helpers for ASP.NET MVC 4+ http://miniprofiler.com http://www.apache.org/licenses/LICENSE-2.0 profiler sql mvc asp.net performance profiling timing en-US - + See https://github.com/MiniProfiler/dotnet/releases for more info diff --git a/MiniProfiler.nuspec b/MiniProfiler.nuspec index 930a0f577..3232e120b 100644 --- a/MiniProfiler.nuspec +++ b/MiniProfiler.nuspec @@ -1,16 +1,16 @@  - MiniProfiler - 3.2.0.157 - Marc Gravell, Jarrod Dixon, Yaakov Ellis, Nick Craver - Marc Gravell, Jarrod Dixon, Yaakov Ellis, Nick Craver - Lightweight mini-profiler, in particular designed for ASP.NET MVC sites + RevMiniProfiler + 3.3.4 + Marc Gravell, Jarrod Dixon, Yaakov Ellis, Nick Craver, Rev.com + Rev.com + A slightly modified mini-profiler with a better support for async and multithreaded http://miniprofiler.com http://www.apache.org/licenses/LICENSE-2.0 profiler sql mvc asp.net performance profiling timing en-US - See https://github.com/MiniProfiler/dotnet/releases for more info + Async support is added diff --git a/Sample.Console/App.config b/Sample.Console/App.config index 88eccf649..f888cf446 100644 --- a/Sample.Console/App.config +++ b/Sample.Console/App.config @@ -1,13 +1,12 @@  -
+ - + - @@ -19,9 +18,10 @@ - + - \ No newline at end of file + + \ No newline at end of file diff --git a/Sample.Console/Sample.Console.csproj b/Sample.Console/Sample.Console.csproj index 034a13290..f8a37a008 100644 --- a/Sample.Console/Sample.Console.csproj +++ b/Sample.Console/Sample.Console.csproj @@ -1,5 +1,5 @@  - + Debug @@ -9,7 +9,7 @@ Properties Sample.Console Sample.Console - v4.0 + v4.6.1 512 publish\ @@ -39,6 +39,7 @@ DEBUG;TRACE prompt 4 + false AnyCPU @@ -48,17 +49,20 @@ TRACE prompt 4 + false - False - ..\packages\Dapper.1.22\lib\net40\Dapper.dll + ..\packages\Dapper.1.22\lib\net45\Dapper.dll + True - - ..\packages\EntityFramework.6.0.0\lib\net40\EntityFramework.dll + + ..\packages\EntityFramework.6.0.0\lib\net45\EntityFramework.dll + True - - ..\packages\EntityFramework.6.0.0\lib\net40\EntityFramework.SqlServer.dll + + ..\packages\EntityFramework.6.0.0\lib\net45\EntityFramework.SqlServer.dll + True @@ -66,15 +70,15 @@ - ..\packages\System.Data.SQLite.Core.1.0.97.0\lib\net40\System.Data.SQLite.dll + ..\packages\System.Data.SQLite.Core.1.0.97.0\lib\net451\System.Data.SQLite.dll True - ..\packages\System.Data.SQLite.EF6.1.0.97.0\lib\net40\System.Data.SQLite.EF6.dll + ..\packages\System.Data.SQLite.EF6.1.0.97.0\lib\net451\System.Data.SQLite.EF6.dll True - ..\packages\System.Data.SQLite.Linq.1.0.97.0\lib\net40\System.Data.SQLite.Linq.dll + ..\packages\System.Data.SQLite.Linq.1.0.97.0\lib\net451\System.Data.SQLite.Linq.dll True @@ -115,12 +119,12 @@ - + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - + - SampleWeb.SampleService.RouteHit + SampleWeb.SampleService.RouteHit, Service References.SampleService.Reference.cs.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null \ No newline at end of file diff --git a/Sample.Mvc.Mongo/Web.config b/Sample.Mvc.Mongo/Web.config index 653e6dad1..76ddc21ac 100644 --- a/Sample.Mvc.Mongo/Web.config +++ b/Sample.Mvc.Mongo/Web.config @@ -1,88 +1,93 @@ - + - - - - + + + + - + - - - - - + + + + + - + - - + + - - + + - - - + + + - + - - - - - - + + + + + + - - + + - - + + - - - + - + - + - + diff --git a/Sample.Mvc/EfModelFirst/EfModelFirstContext.Designer.cs b/Sample.Mvc/EfModelFirst/EfModelFirstContext.Designer.cs index dc622c068..9414874ca 100644 --- a/Sample.Mvc/EfModelFirst/EfModelFirstContext.Designer.cs +++ b/Sample.Mvc/EfModelFirst/EfModelFirstContext.Designer.cs @@ -1,4 +1,4 @@ -// T4 code generation is enabled for model 'D:\Files\GitHub\miniprofiler\dotnet\Sample.Mvc\EfModelFirst\EfModelFirstContext.edmx'. +// T4 code generation is enabled for model 'C:\work\develop\miniprofiler\Sample.Mvc\EfModelFirst\EfModelFirstContext.edmx'. // To enable legacy code generation, change the value of the 'Code Generation Strategy' designer // property to 'Legacy ObjectContext'. This property is available in the Properties Window when the model // is open in the designer. diff --git a/Sample.Mvc/Sample.Mvc.csproj b/Sample.Mvc/Sample.Mvc.csproj index e3b4b6b4b..8bf9bae58 100644 --- a/Sample.Mvc/Sample.Mvc.csproj +++ b/Sample.Mvc/Sample.Mvc.csproj @@ -1,5 +1,5 @@  - + Debug @@ -13,7 +13,7 @@ Properties SampleWeb SampleWeb - v4.5 + v4.6.1 false false @@ -52,21 +52,21 @@ false - + ..\packages\Dapper.1.22\lib\net45\Dapper.dll True - False ..\packages\EntityFramework.6.1.0\lib\net45\EntityFramework.dll + True - False ..\packages\EntityFramework.6.1.0\lib\net45\EntityFramework.SqlServer.dll + True - False ..\packages\EntityFramework.SqlServerCompact.6.1.0\lib\net45\EntityFramework.SqlServerCompact.dll + True @@ -79,20 +79,20 @@ - ..\packages\System.Data.SQLite.Core.1.0.97.0\lib\net45\System.Data.SQLite.dll + ..\packages\System.Data.SQLite.Core.1.0.97.0\lib\net451\System.Data.SQLite.dll True - ..\packages\System.Data.SQLite.EF6.1.0.97.0\lib\net45\System.Data.SQLite.EF6.dll + ..\packages\System.Data.SQLite.EF6.1.0.97.0\lib\net451\System.Data.SQLite.EF6.dll True - ..\packages\System.Data.SQLite.Linq.1.0.97.0\lib\net45\System.Data.SQLite.Linq.dll + ..\packages\System.Data.SQLite.Linq.1.0.97.0\lib\net451\System.Data.SQLite.Linq.dll True - True ..\packages\Microsoft.SqlServer.Compact.4.0.8876.1\lib\net40\System.Data.SqlServerCe.dll + True @@ -169,10 +169,6 @@ - - - - @@ -189,6 +185,10 @@ + + + + EntityModelCodeGenerator EfModelFirstContext.Designer.cs @@ -326,11 +326,11 @@ - + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - + \ No newline at end of file diff --git a/Sample.Mvc/Service References/SampleService/Reference.cs b/Sample.Mvc/Service References/SampleService/Reference.cs index 839293f6f..5cee86069 100644 --- a/Sample.Mvc/Service References/SampleService/Reference.cs +++ b/Sample.Mvc/Service References/SampleService/Reference.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.34003 +// Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. diff --git a/Sample.Mvc/Service References/SampleService/SampleWeb.SampleService.RouteHit.datasource b/Sample.Mvc/Service References/SampleService/SampleWeb.SampleService.RouteHit.datasource index f47a8ef78..446352ac5 100644 --- a/Sample.Mvc/Service References/SampleService/SampleWeb.SampleService.RouteHit.datasource +++ b/Sample.Mvc/Service References/SampleService/SampleWeb.SampleService.RouteHit.datasource @@ -6,5 +6,5 @@ cause the file to be unrecognizable by the program. --> - SampleWeb.SampleService.RouteHit, Service References.SampleService.Reference.cs, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + SampleWeb.SampleService.RouteHit, Service References.SampleService.Reference.cs.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null \ No newline at end of file diff --git a/Sample.Mvc/Web.config b/Sample.Mvc/Web.config index e68abb0ac..708945b1e 100644 --- a/Sample.Mvc/Web.config +++ b/Sample.Mvc/Web.config @@ -27,7 +27,7 @@ --> - + @@ -82,13 +82,13 @@ + + + + - - - - - + @@ -123,9 +123,9 @@ + - \ No newline at end of file diff --git a/Sample.Mvc/packages.config b/Sample.Mvc/packages.config index ce002527f..77ae269c0 100644 --- a/Sample.Mvc/packages.config +++ b/Sample.Mvc/packages.config @@ -1,15 +1,15 @@  - - - + + + - + - - - + + + \ No newline at end of file diff --git a/Sample.Wcf/Sample.Wcf.csproj b/Sample.Wcf/Sample.Wcf.csproj index 2bc949381..3986d0090 100644 --- a/Sample.Wcf/Sample.Wcf.csproj +++ b/Sample.Wcf/Sample.Wcf.csproj @@ -1,5 +1,5 @@  - + Debug @@ -13,7 +13,7 @@ Properties Sample.Wcf Sample.Wcf - v4.0 + v4.6.1 false @@ -27,6 +27,7 @@ + true @@ -37,6 +38,7 @@ prompt 4 x86 + false pdbonly @@ -45,26 +47,30 @@ TRACE prompt 4 + false - - ..\packages\EntityFramework.6.0.0\lib\net40\EntityFramework.dll + + ..\packages\EntityFramework.6.0.0\lib\net45\EntityFramework.dll + True - - ..\packages\EntityFramework.6.0.0\lib\net40\EntityFramework.SqlServer.dll + + ..\packages\EntityFramework.6.0.0\lib\net45\EntityFramework.SqlServer.dll + True + - ..\packages\System.Data.SQLite.Core.1.0.97.0\lib\net40\System.Data.SQLite.dll + ..\packages\System.Data.SQLite.Core.1.0.97.0\lib\net451\System.Data.SQLite.dll True - ..\packages\System.Data.SQLite.EF6.1.0.97.0\lib\net40\System.Data.SQLite.EF6.dll + ..\packages\System.Data.SQLite.EF6.1.0.97.0\lib\net451\System.Data.SQLite.EF6.dll True - ..\packages\System.Data.SQLite.Linq.1.0.97.0\lib\net40\System.Data.SQLite.Linq.dll + ..\packages\System.Data.SQLite.Linq.1.0.97.0\lib\net451\System.Data.SQLite.Linq.dll True @@ -76,7 +82,6 @@ - @@ -153,12 +158,12 @@ - + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - +
+ + - + + @@ -45,7 +54,6 @@ - @@ -57,9 +65,10 @@ - + - \ No newline at end of file + + \ No newline at end of file diff --git a/Sample.Wcf/packages.config b/Sample.Wcf/packages.config index 3ccefb084..2fd5389ca 100644 --- a/Sample.Wcf/packages.config +++ b/Sample.Wcf/packages.config @@ -1,8 +1,8 @@  - + - - - + + + \ No newline at end of file diff --git a/StackExchange.Profiling.EntityFramework/StackExchange.Profiling.EntityFramework.csproj b/StackExchange.Profiling.EntityFramework/StackExchange.Profiling.EntityFramework.csproj index 56857ef07..a3f1fca77 100644 --- a/StackExchange.Profiling.EntityFramework/StackExchange.Profiling.EntityFramework.csproj +++ b/StackExchange.Profiling.EntityFramework/StackExchange.Profiling.EntityFramework.csproj @@ -1,5 +1,5 @@  - + Debug AnyCPU @@ -10,8 +10,9 @@ Properties StackExchange.Profiling.EntityFramework MiniProfiler.EntityFramework - v4.0 + v4.6.1 512 + true @@ -21,6 +22,7 @@ DEBUG;TRACE prompt 4 + false pdbonly @@ -29,6 +31,7 @@ TRACE prompt 4 + false true @@ -38,8 +41,8 @@ - False ..\packages\EntityFramework.4.1.10715.0\lib\EntityFramework.dll + True diff --git a/StackExchange.Profiling.EntityFramework/packages.config b/StackExchange.Profiling.EntityFramework/packages.config index 2e958c679..0ae20d0ff 100644 --- a/StackExchange.Profiling.EntityFramework/packages.config +++ b/StackExchange.Profiling.EntityFramework/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/StackExchange.Profiling.EntityFramework6/App.config b/StackExchange.Profiling.EntityFramework6/App.config index 90664caaa..fa1e7836d 100644 --- a/StackExchange.Profiling.EntityFramework6/App.config +++ b/StackExchange.Profiling.EntityFramework6/App.config @@ -14,4 +14,4 @@ - + diff --git a/StackExchange.Profiling.EntityFramework6/Properties/AssemblyInfo.cs b/StackExchange.Profiling.EntityFramework6/Properties/AssemblyInfo.cs index 75c8a8b17..c75a692f4 100644 --- a/StackExchange.Profiling.EntityFramework6/Properties/AssemblyInfo.cs +++ b/StackExchange.Profiling.EntityFramework6/Properties/AssemblyInfo.cs @@ -11,5 +11,5 @@ [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: Guid("d56997c3-6d37-4953-bd49-b7f690390735")] -[assembly: AssemblyVersion("3.0.11")] -[assembly: AssemblyInformationalVersion("3.0.11")] \ No newline at end of file +[assembly: AssemblyVersion("3.1.0.0")] +[assembly: AssemblyInformationalVersion("3.1.0.0")] \ No newline at end of file diff --git a/StackExchange.Profiling.EntityFramework6/StackExchange.Profiling.EntityFramework6.csproj b/StackExchange.Profiling.EntityFramework6/StackExchange.Profiling.EntityFramework6.csproj index 4bb41ce4b..6822e3f7a 100644 --- a/StackExchange.Profiling.EntityFramework6/StackExchange.Profiling.EntityFramework6.csproj +++ b/StackExchange.Profiling.EntityFramework6/StackExchange.Profiling.EntityFramework6.csproj @@ -1,5 +1,5 @@  - + Debug AnyCPU @@ -10,7 +10,7 @@ Properties StackExchange.Profiling.EntityFramework6 MiniProfiler.EntityFramework6 - v4.0 + v4.6.1 512 ..\ @@ -44,12 +44,12 @@ - False - ..\packages\EntityFramework.6.0.2\lib\net40\EntityFramework.dll + ..\packages\EntityFramework.6.0.2\lib\net45\EntityFramework.dll + True - False - ..\packages\EntityFramework.6.0.2\lib\net40\EntityFramework.SqlServer.dll + ..\packages\EntityFramework.6.0.2\lib\net45\EntityFramework.SqlServer.dll + True diff --git a/StackExchange.Profiling.EntityFramework6/packages.config b/StackExchange.Profiling.EntityFramework6/packages.config index 2962f8dc4..9a3005df4 100644 --- a/StackExchange.Profiling.EntityFramework6/packages.config +++ b/StackExchange.Profiling.EntityFramework6/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/StackExchange.Profiling.MongoDB/MongoDbStorage.cs b/StackExchange.Profiling.MongoDB/MongoDbStorage.cs index acd68a512..56f8e4f94 100644 --- a/StackExchange.Profiling.MongoDB/MongoDbStorage.cs +++ b/StackExchange.Profiling.MongoDB/MongoDbStorage.cs @@ -155,16 +155,17 @@ private void SaveTiming(Timing timing) private void SaveClientTimings(MiniProfiler profiler) { - if (profiler.ClientTimings == null || profiler.ClientTimings.Timings == null || !profiler.ClientTimings.Timings.Any()) + var clientTimings = profiler.ClientTimings?.Timings; + if (clientTimings == null || !clientTimings.Any()) return; - profiler.ClientTimings.Timings.ForEach(x => + foreach (var x in clientTimings) { x.MiniProfilerId = profiler.Id; x.Id = Guid.NewGuid(); - }); + } - foreach (var clientTiming in profiler.ClientTimings.Timings) + foreach (var clientTiming in clientTimings) { var clientTimingPoco = new ClientTimingPoco { @@ -179,7 +180,7 @@ private void SaveClientTimings(MiniProfiler profiler) } } - private void SaveCustomTimings(Timing timing, KeyValuePair> customTimingsKV) + private void SaveCustomTimings(Timing timing, KeyValuePair> customTimingsKV) { var key = customTimingsKV.Key; var value = customTimingsKV.Value; @@ -260,7 +261,7 @@ private List LoadChildrenTimings(Guid parentId) return childrenTimings; } - private Dictionary> LoadCustomTimings(Guid timingId) + private Dictionary> LoadCustomTimings(Guid timingId) { var customTimingPocos = CustomTimings .Find(Query.EQ(poco => poco.TimingId, timingId)) @@ -269,7 +270,7 @@ private Dictionary> LoadCustomTimings(Guid timingId) return customTimingPocos .GroupBy(poco => poco.Key) .ToDictionary(grp => grp.Key, - grp => grp.OrderBy(poco => poco.StartMilliseconds) + grp => (IReadOnlyList)grp.OrderBy(poco => poco.StartMilliseconds) .Select(CustomTimingPocoToCustomTiming).ToList()); } diff --git a/StackExchange.Profiling.MongoDB/StackExchange.Profiling.MongoDB.csproj b/StackExchange.Profiling.MongoDB/StackExchange.Profiling.MongoDB.csproj index ca56cc59a..a8a04fa9a 100644 --- a/StackExchange.Profiling.MongoDB/StackExchange.Profiling.MongoDB.csproj +++ b/StackExchange.Profiling.MongoDB/StackExchange.Profiling.MongoDB.csproj @@ -9,7 +9,7 @@ Properties StackExchange.Profiling.MongoDB StackExchange.Profiling.MongoDB - v4.0 + v4.6.1 512 @@ -21,6 +21,7 @@ DEBUG;TRACE prompt 4 + false pdbonly @@ -29,6 +30,7 @@ TRACE prompt 4 + false diff --git a/StackExchange.Profiling.Mvc/Properties/AssemblyInfo.cs b/StackExchange.Profiling.Mvc/Properties/AssemblyInfo.cs index 9ed41b751..b63206474 100644 --- a/StackExchange.Profiling.Mvc/Properties/AssemblyInfo.cs +++ b/StackExchange.Profiling.Mvc/Properties/AssemblyInfo.cs @@ -11,5 +11,5 @@ [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: Guid("44f8ac97-8e2c-4dba-adae-d971fb086a19")] -[assembly: AssemblyVersion("3.0.11")] -[assembly: AssemblyInformationalVersion("3.0.11")] +[assembly: AssemblyVersion("3.1.0.0")] +[assembly: AssemblyInformationalVersion("3.1.0.0")] diff --git a/StackExchange.Profiling.Mvc/StackExchange.Profiling.Mvc.csproj b/StackExchange.Profiling.Mvc/StackExchange.Profiling.Mvc.csproj index 1d740ed54..9e42279ab 100644 --- a/StackExchange.Profiling.Mvc/StackExchange.Profiling.Mvc.csproj +++ b/StackExchange.Profiling.Mvc/StackExchange.Profiling.Mvc.csproj @@ -1,5 +1,5 @@  - + Debug @@ -9,7 +9,7 @@ Properties StackExchange.Profiling.Mvc MiniProfiler.Mvc - v4.0 + v4.6.1 512 diff --git a/StackExchange.Profiling.RavenDb/StackExchange.Profiling.RavenDb.csproj b/StackExchange.Profiling.RavenDb/StackExchange.Profiling.RavenDb.csproj index e4fd9c247..bed63c217 100644 --- a/StackExchange.Profiling.RavenDb/StackExchange.Profiling.RavenDb.csproj +++ b/StackExchange.Profiling.RavenDb/StackExchange.Profiling.RavenDb.csproj @@ -9,7 +9,7 @@ Properties StackExchange.Profiling.RavenDb StackExchange.Profiling.RavenDb - v4.0 + v4.6.1 512 @@ -21,6 +21,7 @@ DEBUG;TRACE prompt 4 + false pdbonly @@ -29,18 +30,20 @@ TRACE prompt 4 + false - - ..\packages\Microsoft.CompilerServices.AsyncTargetingPack.1.0.1\lib\net40\Microsoft.CompilerServices.AsyncTargetingPack.Net4.dll + + ..\packages\Microsoft.CompilerServices.AsyncTargetingPack.1.0.1\lib\net45\Microsoft.CompilerServices.AsyncTargetingPack.Net45.dll + True - False - ..\packages\RavenDB.Client.2.5.2878\lib\net40\Raven.Abstractions.dll + ..\packages\RavenDB.Client.2.5.2878\lib\net45\Raven.Abstractions.dll + True - False - ..\packages\RavenDB.Client.2.5.2878\lib\net40\Raven.Client.Lightweight.dll + ..\packages\RavenDB.Client.2.5.2878\lib\net45\Raven.Client.Lightweight.dll + True diff --git a/StackExchange.Profiling.RavenDb/packages.config b/StackExchange.Profiling.RavenDb/packages.config index b153022b8..19361e681 100644 --- a/StackExchange.Profiling.RavenDb/packages.config +++ b/StackExchange.Profiling.RavenDb/packages.config @@ -1,5 +1,5 @@  - - + + \ No newline at end of file diff --git a/StackExchange.Profiling.Tests/App.config b/StackExchange.Profiling.Tests/App.config index edd4b89cd..01f2e5f51 100644 --- a/StackExchange.Profiling.Tests/App.config +++ b/StackExchange.Profiling.Tests/App.config @@ -12,9 +12,9 @@ + - @@ -27,12 +27,15 @@ + + + + - - - - - + + + + \ No newline at end of file diff --git a/StackExchange.Profiling.Tests/BaseTest.cs b/StackExchange.Profiling.Tests/BaseTest.cs index 5b3d952ed..ac81992a3 100644 --- a/StackExchange.Profiling.Tests/BaseTest.cs +++ b/StackExchange.Profiling.Tests/BaseTest.cs @@ -210,7 +210,7 @@ protected void AssertTimingsAreEqualAndRecurse(Timing t1, Timing t2) Console.WriteLine(); var ct1 = pair1.Value; - List ct2; + IReadOnlyList ct2; Assert.True(t2.CustomTimings.TryGetValue(pair1.Key, out ct2)); for (int i = 0; i < ct1.Count; i++) diff --git a/StackExchange.Profiling.Tests/MiniProfilerTest.cs b/StackExchange.Profiling.Tests/MiniProfilerTest.cs index c06d016b9..b8e0b195a 100644 --- a/StackExchange.Profiling.Tests/MiniProfilerTest.cs +++ b/StackExchange.Profiling.Tests/MiniProfilerTest.cs @@ -1,4 +1,9 @@ -using NUnit.Framework; +using System; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using System.Web; +using NUnit.Framework; namespace StackExchange.Profiling.Tests { @@ -25,6 +30,102 @@ public void Simple() } } + [Test] + public void WhenUsingAsyncProvider_SimpleCaseWorking() + { + MiniProfiler.Settings.ProfilerProvider = new AsyncWebRequestProfilerProvider(); + using (GetRequest("http://localhost/Test.aspx", startAndStopProfiler: false)) + { + MiniProfiler.Start(); + IncrementStopwatch(); // 1 ms + MiniProfiler.Stop(); + + var c = MiniProfiler.Current; + + Assert.That(c, Is.Not.Null); + Assert.That(c.DurationMilliseconds, Is.EqualTo(StepTimeMilliseconds)); + Assert.That(c.Name, Is.EqualTo("/Test.aspx")); + + Assert.That(c.Root, Is.Not.Null); + Assert.That(c.Root.HasChildren, Is.False); + } + } + + [Theory] + public async Task Current_WhenAsyncMethodReturns_IsCarried( + bool configureAwait + ) + { + MiniProfiler.Settings.ProfilerProvider = new AsyncWebRequestProfilerProvider(); + using (GetRequest("http://localhost/Test.aspx", startAndStopProfiler: false)) + { + MiniProfiler.Start(); + + var c = MiniProfiler.Current; + await Task.Delay(TimeSpan.FromMilliseconds(1)).ConfigureAwait(configureAwait); + Assert.That(HttpContext.Current, Is.Null); + + Assert.That(MiniProfiler.Current, Is.Not.Null); + Assert.That(MiniProfiler.Current, Is.EqualTo(c)); + } + } + + [Theory] + public async Task Head_WhenAsyncMethodReturns_IsCarried( + bool configureAwait + ) + { + MiniProfiler.Settings.ProfilerProvider = new AsyncWebRequestProfilerProvider(); + using (GetRequest("http://localhost/Test.aspx", startAndStopProfiler: false)) + { + MiniProfiler.Start(); + var sut = MiniProfiler.Current; + var head = sut.Head; + + await Task.Delay(TimeSpan.FromMilliseconds(1)).ConfigureAwait(configureAwait); + Assert.That(HttpContext.Current, Is.Null); + + Assert.That(sut.Head, Is.Not.Null); + Assert.That(sut.Head, Is.EqualTo(head)); + } + } + + [Test] + public void Head_WhenMultipleTasksSpawned_EachSetsItsOwnHead() + { + MiniProfiler.Settings.ProfilerProvider = new AsyncWebRequestProfilerProvider(); + var allTasks = new SemaphoreSlim(0, 1); + var completed = new TaskCompletionSource(); + using (GetRequest("http://localhost/Test.aspx", startAndStopProfiler: false)) + { + MiniProfiler.Start(); + var sut = MiniProfiler.Current; + var head = sut.Head; + + Task.Run(() => { + Assert.That(sut.Head, Is.EqualTo(head)); + using (sut.Step("test1")) + { + allTasks.Release(); + completed.Task.Wait(); + } + }); + allTasks.Wait(); + Task.Run(() => { + using (sut.Step("test2")) + { + allTasks.Release(); + completed.Task.Wait(); + } + }); + allTasks.Wait(); + + Assert.That(sut.Head, Is.Not.Null); + Assert.That(sut.Head, Is.EqualTo(head)); + completed.SetResult(0); + } + } + [Test] public void StepIf_Basic() { @@ -47,8 +148,8 @@ public void StepIf_Basic() } MiniProfiler.Stop(); - Assert.IsTrue(mp1.Root.Children.Contains(goodTiming)); - Assert.IsTrue(!mp1.Root.Children.Contains(badTiming)); + Assert.IsTrue(mp1.Root.Children.ToList().Contains(goodTiming)); + Assert.IsTrue(!mp1.Root.Children.ToList().Contains(badTiming)); } } diff --git a/StackExchange.Profiling.Tests/StackExchange.Profiling.Tests.csproj b/StackExchange.Profiling.Tests/StackExchange.Profiling.Tests.csproj index d1f64d206..020167c15 100644 --- a/StackExchange.Profiling.Tests/StackExchange.Profiling.Tests.csproj +++ b/StackExchange.Profiling.Tests/StackExchange.Profiling.Tests.csproj @@ -1,5 +1,5 @@  - + Debug AnyCPU @@ -11,11 +11,12 @@ Properties StackExchange.Profiling.Tests StackExchange.Profiling.Tests - v4.0 + v4.6.1 512 {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + true @@ -25,6 +26,7 @@ DEBUG;TRACE prompt 4 + false pdbonly @@ -33,6 +35,7 @@ TRACE prompt 4 + false true @@ -42,20 +45,20 @@ - False - ..\packages\Dapper.1.22\lib\net40\Dapper.dll + ..\packages\Dapper.1.22\lib\net45\Dapper.dll + True - False - ..\packages\EntityFramework.6.1.0\lib\net40\EntityFramework.dll + ..\packages\EntityFramework.6.1.0\lib\net45\EntityFramework.dll + True - False - ..\packages\EntityFramework.6.1.0\lib\net40\EntityFramework.SqlServer.dll + ..\packages\EntityFramework.6.1.0\lib\net45\EntityFramework.SqlServer.dll + True - False - ..\packages\EntityFramework.SqlServerCompact.6.1.0\lib\net40\EntityFramework.SqlServerCompact.dll + ..\packages\EntityFramework.SqlServerCompact.6.1.0\lib\net45\EntityFramework.SqlServerCompact.dll + True @@ -78,20 +81,20 @@ - ..\packages\System.Data.SQLite.Core.1.0.97.0\lib\net40\System.Data.SQLite.dll + ..\packages\System.Data.SQLite.Core.1.0.97.0\lib\net451\System.Data.SQLite.dll True - ..\packages\System.Data.SQLite.EF6.1.0.97.0\lib\net40\System.Data.SQLite.EF6.dll + ..\packages\System.Data.SQLite.EF6.1.0.97.0\lib\net451\System.Data.SQLite.EF6.dll True - ..\packages\System.Data.SQLite.Linq.1.0.97.0\lib\net40\System.Data.SQLite.Linq.dll + ..\packages\System.Data.SQLite.Linq.1.0.97.0\lib\net451\System.Data.SQLite.Linq.dll True - True ..\packages\Microsoft.SqlServer.Compact.4.0.8876.1\lib\net40\System.Data.SqlServerCe.dll + True @@ -151,12 +154,12 @@ if not exist "$(TargetDir)amd64" md "$(TargetDir)amd64" xcopy /s /y "$(SolutionDir)packages\Microsoft.SqlServer.Compact.4.0.8876.1\NativeBinaries\amd64\*.*" "$(TargetDir)amd64" - + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - +