3

Let's say I want to completely disable Glimpse.

Glimpse now registers itself using the assembly activation method. So even if I comment out all the glimpse stuff in web.config, it will still try to load.

I prefer to manually register Glimpse in Application_Start, if I need it.

Is there any way to override the default behavior to allow me to register it manually? (Which means I can disable it completely if I need to.)

h bob
  • 3,610
  • 3
  • 35
  • 51

1 Answers1

1

Glimpse has been built around the philosophy to have it run with the least amount of additional config or code for users to add or write themselves. Granted this comes with the additional drawback that if you want to disable it completely, that changes from your side will be required and some changes are easier than others.

I answered a similar SO Question Why is Glimpse still running indicating why commenting Glimpse specific config inside web.config is not enough for assemblies using the PreApplicationStartMethodAttribute.

In short, you'll need to make sure that the Glimpse.EF* and the Glimpse.Ado assemblies are not deployed in addition to commenting your web.config. Not deploying these assemblies and commenting out those config sections can be automated one way or the other (web.config transformations, custom build tasks...)

Community
  • 1
  • 1
cgijbels
  • 5,994
  • 1
  • 17
  • 21
  • Many libraries use the prestart method, I know. But I don't like the idea that a library does anything without me asking for it... I want behavior, not automatic behavior. That is magic which is hard to manage in a large system. Regardless, thanks for the explanation, though disabling it will not be easy for us. – h bob May 16 '15 at 18:40
  • Is there a way to make the automagic prestart optional? If I somehow override the prestart registration maybe (i.e. the code that calls Glimpse, rather than the Glimpse code itself)? – h bob May 16 '15 at 18:41
  • 1
    I don't think you can do that, the reason for the `PreApplicationStartMethodAttribute` is to make sure we have our hooks in place as soon as possible, especially for EF this would otherwise be a problem. If this is really an issue, then you can always compile the corresponding [project](https://github.com/Glimpse/Glimpse/tree/master/source/Glimpse.Ado.Net45) yourself and maybe have the `PreApplicationStartMethodAttribute` conditionally compiled? – cgijbels May 17 '15 at 08:44