[Mono-bugs] [Bug 413896] New: PropertyGrid: Wrong ITypeDescriptorContext to TypeConverter, breaks Padding/ Margin properties

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Fri Aug 1 07:47:37 EDT 2008


https://bugzilla.novell.com/show_bug.cgi?id=413896

User andyhume32 at yahoo.co.uk added comment
https://bugzilla.novell.com/show_bug.cgi?id=413896#c2

           Summary: PropertyGrid: Wrong ITypeDescriptorContext to
                    TypeConverter, breaks Padding/Margin properties
           Product: Mono: Class Libraries
           Version: SVN
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Windows.Forms
        AssignedTo: contact at i-nz.net
        ReportedBy: andyhume32 at yahoo.co.uk
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


Created an attachment (id=231279)
 --> (https://bugzilla.novell.com/attachment.cgi?id=231279)
Repro app #2 -- PropGridMyPaddingAndTypeConverter.cs

Repro any PropertyGrid which contains a Margin/Padding property, expand the
property and change the (e.g.) Bottom item to a new value.  Expect the value to
update respectively, but currently see a InvalidCastException in
PaddingConverter.CreateInstance, see full exception below.  A suitable repro
app can be found on bug 409028.


Second repro attached, with Asserts shows incorrect context to the
TypeConverter.CreateInstance method (at least).

Again expand the property and set the Bottom sub-property.  Expect Assert
output lines on the console to each say "PASS".  With current Mono see the
following (and also followed by the exception as above).
[[
!!!! FAIL !!!!  context.Instance
    expected: MyObjectWithPaaaddingProperty
     but was: System.Windows.Forms.Paaadding
!!!! FAIL !!!!  context.PropertyDescriptor.DisplayName
    expected: Paaadding1
     but was: Bottom
!!!! FAIL !!!!  context.PropertyDescriptor.Name
    expected: Paaadding1
     but was: Bottom
!!!! FAIL !!!!  context.PropertyDescriptor.ComponentType
    expected: MyObjectWithPaaaddingProperty
     but was: System.Windows.Forms.Paaadding
!!!! FAIL !!!!  context.PropertyDescriptor.PropertyType
    expected: System.Windows.Forms.Paaadding
     but was: System.Int32
!!!! FAIL !!!!  context.PropertyDescriptor.Converter
    expected: System.Windows.Forms.PaaaddingConverter
     but was: System.ComponentModel.Int32Converter
]]

Seems to be passing the context for the parent property rather than for the
selected object?


[[
Unhandled Exception: System.InvalidCastException: Cannot cast from source type
to destination type.
  at System.Windows.Forms.PaddingConverter.CreateInstance
(ITypeDescriptorContext context, IDictionary propertyValues) [0x00059] in
D:\cygwin\usr\src\mono\mcs\class\Managed.Windows.Forms\System.Windows.Forms\PaddingConverter.cs:106 
  at System.Windows.Forms.PropertyGridInternal.GridEntry.SetValueCore
(System.Object value, System.String& error) [0x0024b] in
D:\cygwin\usr\src\mono\mcs\class\Managed.Windows.Forms\System.Windows.Forms\GridEntry.cs:547 
  at System.Windows.Forms.PropertyGridInternal.GridEntry.SetValue
(System.Object value, System.String& error) [0x00010] in
D:\cygwin\usr\src\mono\mcs\class\Managed.Windows.Forms\System.Windows.Forms\GridEntry.cs:483 
  at System.Windows.Forms.PropertyGridInternal.PropertyGridView.TrySetEntry
(System.Windows.Forms.PropertyGridInternal.GridEntry entry, System.Object
value) [0x0008c] in
D:\cygwin\usr\src\mono\mcs\class\Managed.Windows.Forms\System.Windows.Forms\PropertyGridView.cs:300 
  at
System.Windows.Forms.PropertyGridInternal.PropertyGridView.grid_textbox_Validate
(System.Object sender, System.ComponentModel.CancelEventArgs args) [0x00000] in
D:\cygwin\usr\src\mono\mcs\class\Managed.Windows.Forms\System.Windows.Forms\PropertyGridView.cs:830 
  at
System.Windows.Forms.PropertyGridInternal.PropertyGridTextBox.System.Windows.Forms.IMessageFilter.PreFilterMessage
(System.Windows.Forms.Message& m) [0x000c6] in
D:\cygwin\usr\src\mono\mcs\class\Managed.Windows.Forms\System.Windows.Forms\PropertyGridTextBox.cs:308 
  at System.Windows.Forms.Application.FilterMessage
(System.Windows.Forms.Message& message) [0x00024] in
D:\cygwin\usr\src\mono\mcs\class\Managed.Windows.Forms\System.Windows.Forms\Application.cs:503 
  at System.Windows.Forms.Application.RunLoop (Boolean Modal,
System.Windows.Forms.ApplicationContext context) [0x000ff] in
D:\cygwin\usr\src\mono\mcs\class\Managed.Windows.Forms\System.Windows.Forms\Application.cs:873 
  at System.Windows.Forms.Application.Run
(System.Windows.Forms.ApplicationContext context) [0x0002e] in
D:\cygwin\usr\src\mono\mcs\class\Managed.Windows.Forms\System.Windows.Forms\Application.cs:740 
  at System.Windows.Forms.Application.Run (System.Windows.Forms.Form mainForm)
[0x00000] in
D:\cygwin\usr\src\mono\mcs\class\Managed.Windows.Forms\System.Windows.Forms\Application.cs:723 
  at PropGridObjManyTypes.RunGrid (Boolean logGets) [0x001fb] in
PropGridObjManyTypes7.cs:108 
  at PropGridObjManyTypes.Main (System.String[] args) [0x00020] in
PropGridObjManyTypes7.cs:36 
]]


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list