ComponentDesigner.Initialize throws ArgumentNullException

ComponentDesigner.Initialize was updated to throw an ArgumentNullException if the component argument is null.

Version introduced

.NET 9 Preview 1

Previous behavior

Previously, ComponentDesigner.Initialize accepted a null argument, but resulted in a NullReferenceException or other exception later on.

New behavior

Starting in .NET 9, ComponentDesigner.Initialize throws an ArgumentNullException if the argument is null.

Change category

This change is a behavioral change.

Reason for change

During the process of enabling nullability in the code file, it was discovered that many methods and properties, both in ComponentDesigner and its subclasses, relied on the passed-in component to be initialized to non-null. These methods and properties resulted in a NullReferenceException or another exception later on if they were initialized with a null value.

Make sure you don't call ComponentDesigner.Initialize with a null argument.

Affected APIs