Skip to content
This repository has been archived by the owner on Jan 15, 2021. It is now read-only.

Make Glimpse check if things are enabled in DataBoundControlAdapter (fix for #779) #789

Merged
merged 2 commits into from Apr 29, 2014

Conversation

grahammendick
Copy link

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.

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);
Copy link
Author

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)

@avanderhoorn
Copy link
Member

This looks good to me and if its tested, etc, I'm happy for it to come it. Let me know.

@grahammendick
Copy link
Author

Sorry about the tabs, it's fixed now

@CGijbels
Copy link
Collaborator

@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

Couldn't use GlimpseConfiguration.RuntimePolicyStrategy() because couldn't access Glimpse context from the ControlAdapter

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 System.Web.UI.Adapters.PageAdapter to ControlAdapter ?
Was it related to the issue or something that had to be done and piggybacked on this fix? (Not that it matters, I'm just curious 😉)

@grahammendick
Copy link
Author

@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.

@avanderhoorn
Copy link
Member

We all good for this to go?

@avanderhoorn avanderhoorn added this to the vNext milestone Apr 29, 2014
@avanderhoorn avanderhoorn self-assigned this Apr 29, 2014
@CGijbels
Copy link
Collaborator

:shipit:

avanderhoorn added a commit that referenced this pull request Apr 29, 2014
Issue #779 Fix - Check Glimpse is enabled in DataBoundControlAdapter
@avanderhoorn avanderhoorn merged commit 8f05d51 into Glimpse:master Apr 29, 2014
@avanderhoorn avanderhoorn changed the title Issue #779 Fix - Check Glimpse is enabled in DataBoundControlAdapter Check Glimpse is enabled in DataBoundControlAdapter (fix for #779) Apr 29, 2014
@avanderhoorn avanderhoorn changed the title Check Glimpse is enabled in DataBoundControlAdapter (fix for #779) Make Glimpse check if things are enabled in DataBoundControlAdapter (fix for #779) Apr 29, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants