diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/PropertyGrid.TabInfo.cs b/src/System.Windows.Forms/src/System/Windows/Forms/PropertyGrid.TabInfo.cs index e16e194aef8..34a5081e852 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/PropertyGrid.TabInfo.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/PropertyGrid.TabInfo.cs @@ -2,8 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -#nullable disable - using System.ComponentModel; using System.Windows.Forms.Design; diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/PropertyGrid.cs b/src/System.Windows.Forms/src/System/Windows/Forms/PropertyGrid.cs index 6a04b3711bb..c5265843914 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/PropertyGrid.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/PropertyGrid.cs @@ -1653,8 +1653,9 @@ private PropertyTab CreateTab(Type tabType, IDesignerHost host) { tab = CreatePropertyTab(tabType); } - catch (Exception) + catch (Exception exception) { + Debug.Fail($"{nameof(CreatePropertyTab)} failed. {exception.Message}"); return null; } @@ -1689,14 +1690,13 @@ private PropertyTab CreateTab(Type tabType, IDesignerHost host) tab = (PropertyTab)Activator.CreateInstance(tabType); } } - catch + catch (Exception exception) { + Debug.Fail($"Failed to create {nameof(PropertyTab)}. {exception.Message}"); tab = null; } } - Debug.Assert(tab is not null, "Failed to create tab!"); - if (tab is not null) { if (tab.Bitmap is null)