Description
.NET version
.net 9
Did it work in .NET Framework?
Yes
Did it work in any of the earlier releases of .NET Core or .NET 5+?
.net 8
Issue description
The logic for refreshing the property list when using the [RefreshProperties(RefreshProperties.All)] attribute is broken in .net 9
In .net 8 everything works as expected.
When changing a property, now only the values are refreshed, although the documentation clearly states that using RefreshProperties.All will cause properties to be requeried. Now RefreshProperties.All behaves like RefreshProperties.Repaint
The bug was added with commit dc4314e
Steps to reproduce
Updating the code below from .net 8 to .net 9 causes the GetProperties method to stop being called when changing property A via PropertyGrid
public Form1()
{
InitializeComponent();
propertyGrid1.SelectedObject = new SelectedObject();
}
[TypeConverter(typeof(MyTypeConverter))]
public class SelectedObject
{
private string a;
private string b;
[RefreshProperties(RefreshProperties.All)]
public string A
{
get { return a; }
set { a = value; }
}
public string B
{
get { return b; }
set { b = value; }
}
}
public class MyTypeConverter : TypeConverter
{
public MyTypeConverter()
: base() { }
public override bool GetPropertiesSupported(ITypeDescriptorContext context)
{
return true;
}
public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes)
{
return base.GetProperties(context, value, attributes) ?? TypeDescriptor.GetProperties(value, attributes);
}
}