rhuseman / mvc-mini-profiler

Automatically exported from code.google.com/p/mvc-mini-profiler
0 stars 0 forks source link

NullRef Exception in MiniProfiler.AddSqlTiming #113

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
When the profiler tries to log a SqlTiming object when there is no active 
timing (ie: the Head property is null), you get a null ref exception.

What steps will reproduce the problem?
1. Start profiling in HttpApplication.BeginRequest() using MiniProfiler.Start()
2. In HttpApplication.PostAuthorizeRequest, call 
MiniProfiler.Stop(discardResults: true) if the current user isn't allowed to 
profile.
3. Do some database query.
4. NullRef exception from line 274 in MiniProfiler.cs (I built the source 
myself and checked in the debugger that Head was indeed null).

What is the expected output? What do you see instead?
I'd expect the SqlTiming to be discarded rather than my app blowing up! 

What version of the product are you using? On what operating system?
1.9.1 from NuGet. Windows 7 in VS developer server (using Web developer 2010 
express). .NET 4.0. Verified against GIT repository source 26/Sept.

Please provide any additional information below.
I'm using Entity Framework 4.1 - database first. I generate my ObjectContext 
via 
MvcMiniProfiler.Data.ObjectContextUtils.GetProfiledContext<ApplicationEntities>(
). (I couldn't get the recommended 
ObjectContextUtils.CreateObjectContext<MyModel>(conn) method working (can't 
remember why now)).

Original issue reported on code.google.com by murray.g...@faredge.com.au on 26 Sep 2011 at 11:50

GoogleCodeExporter commented 8 years ago
I'm seeing this too. Any fix yet?

Original comment by brett.z...@gmail.com on 8 Nov 2011 at 7:48

GoogleCodeExporter commented 8 years ago
I grabbed a snapshot from GIT a few days after I posted this bug (29/Sept) and 
the issue had been resolved. Grab latest source and use that.

No idea if the fix has made it into the NuGet line yet though.

Original comment by murray.g...@faredge.com.au on 8 Nov 2011 at 9:38

GoogleCodeExporter commented 8 years ago
This bug is still present in the NuGet repo.

Original comment by fabien.d...@gmail.com on 13 Feb 2012 at 1:26

GoogleCodeExporter commented 8 years ago
k, fixed in latest

Original comment by sam.saff...@gmail.com on 14 Feb 2012 at 5:09