Closed thomasnaletsg closed 8 months ago
Verified this issue on .NET 8.0.200 with dlls built form winforms repo of release/8.0 branch, it was fixed, MyPropertyTab can be removed and added unit tests have passed. RemoveTabType.zip
https://github.com/dotnet/winforms/assets/130345015/33caa8e8-5cab-47ec-aa6c-a26be87855c9
Verified this issue on .NET 9.0.0-alpha.1.24061.5 with dlls built form winforms repo of main branch, it was fixed, MyPropertyTab can be added and removed.
Verified with .NET SDK 8.0.2 test pass build, this issue was fixed. Test result is same as above.
Verified this issue with .NET 9 Preview 1 test pass build, it was fixed. Test result is same as above.
.NET version
8.0.100
Did it work in .NET Framework?
Yes
Did it work in any of the earlier releases of .NET Core or .NET 5+?
Yes, it works in 5.0
Issue description
The PropertyGrid.RemoveTabType method does not effectively remove the PropertyTab. Calling this method with a previously added tab does not suppress the tab. It looks like the check on type is wrong in the method RemoveTabType since the commit https://github.com/dotnet/winforms/pull/6108
The type check is not consistent between AddTabType and RemoveTabType method: In AddTabType: https://github.com/dotnet/winforms/blob/39c1cfba04f0682ae79e6629188eb291bc0d203e/src/System.Windows.Forms/src/System/Windows/Forms/PropertyGrid.cs#L1480
In RemoveTabType: https://github.com/dotnet/winforms/blob/39c1cfba04f0682ae79e6629188eb291bc0d203e/src/System.Windows.Forms/src/System/Windows/Forms/PropertyGrid.cs#L3565
Steps to reproduce
In .net50, MyPropertyTab is removed in .net80, MyPropertyTab is not removed