@@ -4124,6 +4124,63 @@ public void PropertyGrid_SelectedGridItemChanged_TriggeredCorrectly()
41244124 eventArgs . NewSelection . Should ( ) . Be ( gridItem ) ;
41254125 }
41264126
4127+ // Regression test for https://github.com/dotnet/winforms/issues/13071
4128+ [ WinFormsFact ]
4129+ public void PropertyGrid_FullRefreshShouldTriggerTypeConverterGetProperties ( )
4130+ {
4131+ using PropertyGrid propertyGrid = new ( )
4132+ {
4133+ SelectedObject = new SelectedObject ( )
4134+ } ;
4135+ PropertyGridView propertyGridView = propertyGrid . TestAccessor ( ) . Dynamic . _gridView ;
4136+
4137+ MyTypeConverter . GetPropertiesInvokeCount = 0 ;
4138+ propertyGridView . Refresh ( true ) ;
4139+
4140+ int getPropertiesInvokeCount2 = MyTypeConverter . GetPropertiesInvokeCount ;
4141+ getPropertiesInvokeCount2 . Should ( ) . Be ( 1 ) ;
4142+ }
4143+
4144+ #region classes used for PropertyGrid_FullRefreshShouldTriggerTypeConverterGetProperties
4145+ [ TypeConverter ( typeof ( MyTypeConverter ) ) ]
4146+ private class SelectedObject
4147+ {
4148+ private string _a ;
4149+ private string _b ;
4150+
4151+ [ RefreshProperties ( RefreshProperties . All ) ]
4152+ public string A
4153+ {
4154+ get { return _a ; }
4155+ set { _a = value ; }
4156+ }
4157+
4158+ public string B
4159+ {
4160+ get { return _b ; }
4161+ set { _b = value ; }
4162+ }
4163+ }
4164+
4165+ private class MyTypeConverter : TypeConverter
4166+ {
4167+ public static int GetPropertiesInvokeCount { get ; set ; } = 0 ;
4168+ public MyTypeConverter ( )
4169+ : base ( ) { }
4170+
4171+ public override bool GetPropertiesSupported ( ITypeDescriptorContext context )
4172+ {
4173+ return true ;
4174+ }
4175+
4176+ public override PropertyDescriptorCollection GetProperties ( ITypeDescriptorContext context , object value , Attribute [ ] attributes )
4177+ {
4178+ GetPropertiesInvokeCount ++ ;
4179+ return base . GetProperties ( context , value , attributes ) ?? TypeDescriptor . GetProperties ( value , attributes ) ;
4180+ }
4181+ }
4182+ #endregion
4183+
41274184 private class SubToolStripRenderer : ToolStripRenderer
41284185 {
41294186 }
0 commit comments