-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Closed
Labels
🏁 Release: .NET 5Work items for the .NET 5 releaseWork items for the .NET 5 releasebreaking-changeIndicates a .NET Core breaking changeIndicates a .NET Core breaking changewinforms/subsvc
Description
Selected API validate input parameters and throw ArgumentNullException.
Selected API now validate input parameters and throw ArgumentNullException where previously a NullReferenceException could be thrown, if APIs were invoked with null input arguments.
Throwing ArgumentException is inline with the behaviours in .NET Runtime, and provides developers with a better debug experience clearly communicating which argument caused the exception.
Old behavior
The listed API would throw NullReferenceException if invoked with null input arguments.
New behavior
The listed API would throw ArgumentNullException if invoked with null input arguments.
Reason for change
Throwing ArgumentNullException is inline with the behaviours in .NET Runtime, and provides developers with a better debug experience clearly communicating which argument caused the exception.
Recommended action
- Review and, if necessary, update the code to prevent passing
nullinput arguments in the listed API. - If the code is handling
NullReferenceExceptionreplace (or supplement) it with handlingArgumentNullException.
Category
- Windows Forms
Version introduced: .NET 5.0 Preview 1
Affected APIs
- Control.ControlCollection
- Control.ControlCollection(Control) Constructor, parameter
owner
- Control.ControlCollection(Control) Constructor, parameter
- TabControl
- GetToolTipText(Object), parameter
item
- GetToolTipText(Object), parameter
- TableLayoutControlCollection
- TableLayoutControlCollection(TableLayoutPanel) Constructor, parameter
container
- TableLayoutControlCollection(TableLayoutPanel) Constructor, parameter
- ToolStripRenderer
- OnRenderArrow(ToolStripArrowRenderEventArgs), parameter
e - OnRenderItemImage(ToolStripItemImageRenderEventArgs), parameter
e - OnRenderItemCheck(ToolStripItemImageRenderEventArgs), parameter
e - OnRenderItemText(ToolStripItemTextRenderEventArgs), parameter
e - OnRenderStatusStripSizingGrip(ToolStripRenderEventArgs), parameter
e
- OnRenderArrow(ToolStripArrowRenderEventArgs), parameter
Version introduced: .NET 5.0 Preview 2
Affected APIs
- DataGridViewComboBoxEditingControl
- ApplyCellStyleToEditingControl(DataGridViewCellStyle), parameter
dataGridViewCellStyle
- ApplyCellStyleToEditingControl(DataGridViewCellStyle), parameter
- RichTextBox
- LoadFile(Stream, RichTextBoxStreamType), parameter
data
- LoadFile(Stream, RichTextBoxStreamType), parameter
Version introduced: .NET 5.0 Preview 5
Affected APIs
- ListViewGroup
- ISerializable.GetObjectData(SerializationInfo, StreamingContext), parameter
info
- ISerializable.GetObjectData(SerializationInfo, StreamingContext), parameter
- VisualStyleRenderer
- VisualStyleRenderer(String, Int32, Int32), parameter
className
- VisualStyleRenderer(String, Int32, Int32), parameter
- ListBox.IntegerCollection
- ListBox.IntegerCollection(ListBox) Constructor, parameter
owner - ListBox.IntegerCollection.CopyTo(Array, int), parameter
destination
- ListBox.IntegerCollection(ListBox) Constructor, parameter
Version introduced: .NET 5.0 Preview 6
Affected APIs
- ListBox.ObjectCollection
- ListBox.ObjectCollection(ListBox) Constructor, parameter
owner - ListBox.ObjectCollection(ListBox, Object[]) Constructor, parameter
owner - ListBox.ObjectCollection(ListBox, Object[]) Constructor, parameter
value - ListBox.ObjectCollection(ListBox, ListBox+ObjectCollection) Constructor, parameter
owner - ListBox.ObjectCollection(ListBox, ListBox+ObjectCollection) Constructor, parameter
value - ListBox.ObjectCollection.AddRange(Object[]), parameter
value - ListBox.ObjectCollection.AddRange(ListBox+ObjectCollection), parameter
value - ListBox.ObjectCollection.CopyTo(Object[], Int32), parameter
destination - ListBox.ObjectCollection.ICollection.CopyTo(Array, Int32), parameter
destination
- ListBox.ObjectCollection(ListBox) Constructor, parameter
Version introduced: .NET 5.0 Preview 7
Affected APIs
- ListView.SelectedIndexCollection
- ListView.SelectedIndexCollection(ListView) Constructor, parameter
owner
- ListView.SelectedIndexCollection(ListView) Constructor, parameter
Version introduced: .NET 5.0 Preview 8
Affected APIs
- TreeNodeCollection
- TreeNodeCollection.Find(String, Boolean) Method, parameter
keyisnullor empty.
- TreeNodeCollection.Find(String, Boolean) Method, parameter
Version introduced: .NET 5.0 RC1
Affected APIs
- ListViewItemCollection
- ListViewItemCollection.Find(String, Boolean) Method, parameter
keyisnullor empty.
- ListViewItemCollection.Find(String, Boolean) Method, parameter
- ScrollableControl
- ScrollableControl.OnPaintBackground(PaintEventArgs) Method, parameter
eisnull.
- ScrollableControl.OnPaintBackground(PaintEventArgs) Method, parameter
Issue metadata
- Issue type: breaking-change
Metadata
Metadata
Assignees
Labels
🏁 Release: .NET 5Work items for the .NET 5 releaseWork items for the .NET 5 releasebreaking-changeIndicates a .NET Core breaking changeIndicates a .NET Core breaking changewinforms/subsvc