Unable to view SQL on SQL Tab when using transactions #772

shady14u opened this Issue Mar 31, 2014 · 20 comments


None yet

9 participants


When wrapping the DB context with a transaction per request the SQL tab will not show SQL and throws:

System.NullReferenceException: Object reference not set to an instance of an object. at Glimpse.Ado.Model.ConnectionMetadata.RegiserTransactionStart(TransactionMetadata transaction) at
Glimpse.Ado.Model.MessageAggregator.AggregateTransactionBegan() at 
Glimpse.Ado.Model.MessageAggregator.Aggregate() at Glimpse.Ado.Tab.SQL.GetData(ITabContext context) at 
Glimpse.Core.Framework.GlimpseRuntime.ExecuteTabs(RuntimeEvent runtimeEvent)

If I comment out the transaction.BeginTransaction() and the Commit. then the SQL Tab displays fine.

I am using MVC5 and EF 6.0.2 and wrap my requests like the following

on Application_BeginRequest I create a transaction and put it in the HttpContext Items collection

on Application_EndRequest I look for any errors and commit or roll back the transaction


I get a similar exception! In my situation there is no command in the Commands structure.


I'm going to look into this, but just to make sure, are you able to update to all the latest packages and make sure that the issue still exists?

vadimi commented Jul 1, 2014

I just was able to reproduce this issue. The error happens in ConnectionMetadata class in RegiserTransactionStart method when Commands dictionary is empty. Simple null check helps:

var command = Commands.FirstOrDefault(x => x.Value.Offset >= transaction.Offset);
if (command.Value != null)
    command.Value.HeadTransaction = transaction;

Arr makes sense... under what case would you have a transaction but no commands? I guess maybe if you start a transaction but the logic path in a given case avoids creating any commands?

vadimi commented Jul 2, 2014

Yes, I have a scenario when there are no db queries at all on several pages, but I use one transaction per request anyways.


Any eta on when this might be fixed?



@robdmoore Thanks for the poke. Currently working on some other bits at the moment. As pointed out the fix is quite simple, would you like to give it a go and send it in as a PR?


Sorry, I've been flat out. Will do if I get a chance, not likely for a while though sorry.

@avanderhoorn avanderhoorn added this to the vNext milestone Jan 16, 2015

@robdmoore would be great if you can give it a crack, would love to get the fix into the next release.


Nice - looks like someone else did this :)

When is the next release coming out?

Thanks mate


Looks like I just ran into this bug with version 1.7.3. Has 1.7.4 shipped yet? or soon?


I'm going to try and get a release out early next week.


This is just waiting on one feature (keyboard shortcuts) to get in and then we will release.


any updates @avanderhoorn ?


Any updates @avanderhoorn ?


@NotMyself Thanks for pining me. Let me sync with the rest of the team and I'll get back to you next week.

kedde commented Feb 1, 2016

Have 1.7.4 been released on nuget? Or will this issue only be addressed in asp.net core version? I'll see the vNext Milestone tag.

jusefb commented Apr 19, 2016


Will this be fixed any time soon?

feitzi commented Sep 21, 2016

Why is this issue closed? There is now version released that fix this bug. Please release 1.7.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment