Description
Selected API validate input parameters and throw ArgumentException
.
Selected API now validate input parameters and throw ArgumentException
where previous behaviour could lead to indeterminate state, if APIs were invoked with input arguments of unexpected or incorrect type.
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.
Version introduced
.NET 5.0 Preview 1
Old behavior
The listed API would lead to indeterminate state if invoked with input arguments of unexpected or incorrect type.
New behavior
The listed API would throw ArgumentException
if invoked with input arguments of unexpected or incorrect type.
Reason for change
Throwing ArgumentException
is inline with the behaviours in .NET Runtime, and provides developers with a better debug experience but clearly communicating which argument resulting in a exception.
Recommended action
- Review and, if necessary, update the code to prevent passing input arguments of incorrect type to the listed API.
- Handle
ArgumentException
, if necessary.
Category
- Windows Forms
Version introduced: .NET 5.0 Preview 1
Affected APIs
- TabControl
- GetToolTipText(Object), parameter
item
- throws AE, if invoked with input arguments of type other thanTabPage
.
- GetToolTipText(Object), parameter
Version introduced: .NET 5.0 Preview 5
Affected APIs
- DataFormats
- GetFormat(String), parameter
format
- throws AE, ifformat
isnull
,string.Empty
or whitespace (e.g.string.IsNullOrWhispace(format)
).
NB:Win32Exception
remains to be thrown, if registration failed
- GetFormat(String), parameter
Version introduced: .NET 5.0 Preview 7
Affected APIs
- InputLanguageChangedEventArgs
- InputLanguageChangedEventArgs(CultureInfo, Byte), parameter
culture
- throws AE, if unable not retrieve anInputLanguage
for a given culture.
- InputLanguageChangedEventArgs(CultureInfo, Byte), parameter
Issue metadata
- Issue type: breaking-change