Glimpse/Glimpse.Prototype

NullReferenceException when conditionally calling UseGlimpse

ddotlic opened this issue · 0 comments

We're seeing something rather unexpected - if we call services.AddGlimpse() but then don't call app.UseGlimpse() - for example, because we're running in a production environment - the site crashes.

The error is it appears identical to the one observed in this bug: #98

Since the call to AddGlimpse() (made in ConfigureServices) cannot be avoided by an if in an easy manner (the criteria we use which is environment is not as easily available as it is in Configure method) I would expect it to not do much until one actually calls UseGlimpse()?

Or are we expected to "pair" the Add/Use by guarding both with the same conditional (up to us to see how to achieve this)?

Differently put I am not sure if this is a bug (personally expect that it is) or me missing something...