Skip to content

MulticastOption.Group no longer accepts null #19723

@eerhardt

Description

@eerhardt

MulticastOption.Group no longer accepts null

MulticastOption.Group is not supposed to accept null. If someone sets it to null, we will NRE inside of the Sockets implementation.

Version introduced

5.0

Old behavior

null could be set on MulticastOption.Group property, and later if the MulticastOption was passed to Socket.SetSocketOption, the runtime would throw a System.NullReferenceException.

New behavior

Setting MulticastOption.Group property to null results in an ArgumentNullException during the set.

Reason for change

The NullReferenceException was discovered when annotating the Sockets library with nullable annotations. To be consistent with the Framework Design Guidelines, the property was updated to throw the correct exception.

Recommended action

Ensure you don't pass null into MulticastOption.Group setter.

Category

  • Networking

Affected APIs

`MulticastOption.Group Property


Issue metadata

  • Issue type: breaking-change

Metadata

Metadata

Assignees

Labels

🏁 Release: .NET 5Work items for the .NET 5 releasebreaking-changeIndicates a .NET Core breaking changeframework-design/guidelinesIssues relates to the 2008 framework design guidelines.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions