Hi,
I tried a similar, less complete question on DOTNET-CLR with no answer. I
don't know if it's bad form, but here's a more complete version (resulting
from further study).
The following code causes a StackOverflowException:
bool IExtenderProvider.CanExtend(object extendee) {
...
PropertyDescriptorCollection properties = TypeDescriptor.GetProperties
(extendee);
...
}
I think this behavior should be expected, and here's why:
When a control implementing IExtenderProvider is placed on a winform:
10 Designer adds control to form ie sites it
20 It tries to create a TypeDescriptor for it
30 During TypeDescriptor creation, it calls CanExtend on the provider
control, passing the extendee
40 CanExtend itself tries to create a TypeDescriptor for the extendee
50 GOTO 30
In support, the call chain goes something like this:
TypeDescriptor.GetProperties(...) ->
TypeDescriptor.GetEntry(...).GetProperties ->
ComponentEntry.GetExtenderProviders(...)
And, when tracing debugging, the following code:
PropertyDescriptorCollection properties = TypeDescriptor.GetProperties
(extendee);
is called repeatedly, until overflow, possibly confirming the suggested
reiteration.
Is this true?
Cheers,
Michael Weinhardt
You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced
DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.