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.Aggregate() at Glimpse.Ado.Tab.SQL.GetData(ITabContext context) at
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?
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?
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.
@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?
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.
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.
Will this be fixed any time soon?
Why is this issue closed? There is now version released that fix this bug. Please release 1.7.4