title | description | ms.date |
---|---|---|
Breaking change: Some TableLayoutSettings properties throw InvalidEnumArgumentException |
Learn about the breaking change in .NET 6 where some TableLayoutSettings APIs now throw an InvalidEnumArgumentException for invalid arguments. |
01/18/2021 |
Selected xref:System.Windows.Forms.TableLayoutSettings properties now throw an xref:System.ComponentModel.InvalidEnumArgumentException if you attempt to assign an incorrect value.
In previous .NET versions, these properties throw an xref:System.ArgumentOutOfRangeException if you attempt to assign an incorrect value. Starting in .NET 6, these properties throw an xref:System.ComponentModel.InvalidEnumArgumentException in such cases.
This change affects binary compatibility.
Throwing xref:System.ComponentModel.InvalidEnumArgumentException is in line with the existing Windows Forms API in similar situations. Throwing this exception also provides developers with a better debug experience.
.NET 6
- Update the code to prevent assigning incorrect values.
- If necessary, handle an xref:System.ComponentModel.InvalidEnumArgumentException when accessing these APIs.
- xref:System.Windows.Forms.TableLayoutPanel.CellBorderStyle?displayProperty=fullName
- xref:System.Windows.Forms.TableLayoutPanel.GrowStyle?displayProperty=fullName