It crashes when I do this: - I have a class Person, with properties Name:string, Age:int and Children:PersonCollection. PersonCollection is based on CollectionBase and adds int Add(Person); Person this[int] { get; } to the class. - I create an instance of this class, and display it in a System.Windows.Forms.PropertyGrid control. - Up until now, everything is just fine, I can change properties, and the framework-provided typeconverter and UI lets me add and remove Children and set their properties. - When I try to manipulate the children's children, it crashes. An exception is thrown when I push the ... button to open the collection UI.
The exception is 'System.StackOverflowException' Stack trace: system.windows.forms.dll!System.Windows.Forms.Application::ComponentMana gerSystem.Windows.Forms.UnsafeNativeMethods+IMsoComponentManager.FPushMe ssageLoop(__int32 dwComponentID = 1, __int32 reason = 4, __int32 pvLoopData = 0) + 0x2c1 bytes system.windows.forms.dll!ThreadContext::RunMessageLoop(__int32 reason = 4, System.Windows.Forms.ApplicationContext context = {System.Windows.Forms.Application.ModalApplicationContext}) + 0x1c3 bytes system.windows.forms.dll!System.Windows.Forms.Application::RunDialog(Sys tem.Windows.Forms.Form form = {System.ComponentModel.Design.CollectionEditor.CollectionEditorCollectio nForm}) + 0x35 bytes system.windows.forms.dll!System.Windows.Forms.Form::ShowDialog(System.Wi ndows.Forms.IWin32Window owner = {TestPropGrid.Form1}) + 0x480 bytes system.windows.forms.dll!System.Windows.Forms.PropertyGridInternal.Prope rtyGridView::ShowDialog(System.Windows.Forms.Form dialog = {System.ComponentModel.Design.CollectionEditor.CollectionEditorCollectio nForm}) + 0x168 bytes system.design.dll!CollectionForm::ShowEditorDialog(System.Windows.Forms. Design.IWindowsFormsEditorService edSvc = {System.Windows.Forms.PropertyGridInternal.PropertyGridView}) + 0x1f bytes system.design.dll!System.ComponentModel.Design.CollectionEditor::Collect ionEditorCollectionFormShowEditorDialog(System.Windows.Forms.Design.IWin dowsFormsEditorService edSvc = {System.Windows.Forms.PropertyGridInternal.PropertyGridView}) + 0xc9 bytes system.design.dll!System.ComponentModel.Design.CollectionEditor::EditVal ue(System.ComponentModel.ITypeDescriptorContext context = {System.Windows.Forms.PropertyGridInternal.PropertyDescriptorGridEntry}, System.IServiceProvider provider = {System.Windows.Forms.PropertyGridInternal.PropertyDescriptorGridEntry}, System.Object value = {TestPropGrid.PersonCollection}) + 0x28b bytes system.windows.forms.dll!System.Windows.Forms.PropertyGridInternal.GridE ntry::EditPropertyValue(System.Windows.Forms.PropertyGridInternal.Proper tyGridView iva = {System.Windows.Forms.PropertyGridInternal.PropertyGridView}) + 0x74 bytes system.windows.forms.dll!System.Windows.Forms.PropertyGridInternal.Prope rtyDescriptorGridEntry::EditPropertyValue(System.Windows.Forms.PropertyG ridInternal.PropertyGridView iva = {System.Windows.Forms.PropertyGridInternal.PropertyGridView}) + 0x1b bytes system.windows.forms.dll!System.Windows.Forms.PropertyGridInternal.Prope rtyGridView::PopupDialog(__int32 row = 2) + 0x48c bytes system.windows.forms.dll!System.Windows.Forms.PropertyGridInternal.Prope rtyGridView::OnBtnClick(System.Object sender = {System.Windows.Forms.PropertyGridInternal.DropDownButton}, System.EventArgs e = {System.EventArgs}) + 0x90 bytes system.windows.forms.dll!System.Windows.Forms.Control::OnClick(System.Ev entArgs e = {System.EventArgs}) + 0x62 bytes system.windows.forms.dll!System.Windows.Forms.Button::OnClick(System.Eve ntArgs e = {System.EventArgs}) + 0x38 bytes system.windows.forms.dll!System.Windows.Forms.Button::OnMouseUp(System.W indows.Forms.MouseEventArgs mevent = {X=9 Y=8 Button=Left}) + 0x119 bytes system.windows.forms.dll!System.Windows.Forms.Control::WmMouseUp(System. Windows.Forms.Message m = {System.Windows.Forms.Message}, System.Windows.Forms.MouseButtons button = Left, __int32 clicks = 1) + 0x235 bytes system.windows.forms.dll!System.Windows.Forms.Control::WndProc(System.Wi ndows.Forms.Message m = {System.Windows.Forms.Message}) + 0x481 bytes system.windows.forms.dll!System.Windows.Forms.ButtonBase::WndProc(System .Windows.Forms.Message m = {System.Windows.Forms.Message}) + 0x11a bytes system.windows.forms.dll!System.Windows.Forms.Button::WndProc(System.Win dows.Forms.Message m = {System.Windows.Forms.Message}) + 0x8d bytes system.windows.forms.dll!ControlNativeWindow::OnMessage(System.Windows.F orms.Message m = {System.Windows.Forms.Message}) + 0x19 bytes system.windows.forms.dll!ControlNativeWindow::WndProc(System.Windows.For ms.Message m = {System.Windows.Forms.Message}) + 0xda bytes system.windows.forms.dll!System.Windows.Forms.NativeWindow::DebuggableCa llback(__int32 hWnd = 459216, __int32 msg = 514, __int32 wparam = 0, __int32 lparam = 524297) + 0x39 bytes system.windows.forms.dll!System.Windows.Forms.Application::ComponentMana gerSystem.Windows.Forms.UnsafeNativeMethods+IMsoComponentManager.FPushMe ssageLoop(__int32 dwComponentID = 1, __int32 reason = -1, __int32 pvLoopData = 0) + 0x2c1 bytes system.windows.forms.dll!ThreadContext::RunMessageLoop(__int32 reason = -1, System.Windows.Forms.ApplicationContext context = {System.Windows.Forms.ApplicationContext}) + 0x1c3 bytes system.windows.forms.dll!System.Windows.Forms.Application::Run(System.Wi ndows.Forms.Form mainForm = {TestPropGrid.Form1}) + 0x36 bytes > PropGrid.exe!TestPropGrid.Form1.Main() Line 131 C# You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.