Make Glimpse check if things are enabled in DataBoundControlAdapter (fix for #779) #789
Conversation
When Glimpse is disabled GetConfiguredTimerStrategy() returns null so added defensive checks
@@ -157,7 +160,7 @@ public DataBoundControlAdapter() | |||
|
|||
private bool AdapterStateCopied { get; set; } | |||
|
|||
private static readonly MethodInfo BeginRenderInfo = typeof(System.Web.UI.Adapters.PageAdapter).GetMethod("BeginRender", BindingFlags.Instance | BindingFlags.NonPublic); | |||
private static readonly MethodInfo BeginRenderInfo = typeof(ControlAdapter).GetMethod("BeginRender", BindingFlags.Instance | BindingFlags.NonPublic); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed PageAdapter to ControlAdapter (not necessary for the fix but it's clearer)
This looks good to me and if its tested, etc, I'm happy for it to come it. Let me know. |
Sorry about the tabs, it's fixed now |
@grahammendick thanks for the fix. Maybe you already had the issue with the adapter not registering during setup while developing the feature and that that is why it is now part of the GetData method, so no worries there 😉 Regarding
I see what you mean, as it is an instance property and not statically accessible (but that has been fixed in v2 😉) Just wondering why you also changed the reflection parts aka from |
@CGijbels I just piggybacked off the work @avanderhoorn had already done for the PageAdapter so that's why the code was in the GetData. The reflection change was fixing my earlier sloppy paste from the PageAdapter. It worked fine because PageAdapter inherits from ControlAdapter but it was misleading because the DataBoundControlAdapter didn't inherit from PageAdapter. |
We all good for this to go? |
Issue #779 Fix - Check Glimpse is enabled in DataBoundControlAdapter
When Glimpse is enabled and then disabled the DataBoundControlAdapter is still registered but GlimpseConfiguration.GetConfiguredTimerStrategy()() returns null. Defensive checks added so event listeners only added when Glimpse enabled.
@CGijbels Couldn't use GlimpseConfiguration.RuntimePolicyStrategy() because couldn't access Glimpse context from the ControlAdapter (it's not like a normal Inspector). Also I tried moving the Adapter registration into Setup but the DataBoundControlAdapter wasn't registered successfully. Try it yourself and you'll see that the DataBound information doesn't appear in the tab.