Skip to content

Enable nullability in WindowsFormsDesignerOptionService #13059

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/System.Windows.Forms.Design/src/PublicAPI.Shipped.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
~override System.Windows.Forms.Design.ParentControlDesigner.OnPaintAdornments(System.Windows.Forms.PaintEventArgs pe) -> void
~override System.Windows.Forms.Design.ParentControlDesigner.PreFilterProperties(System.Collections.IDictionary properties) -> void
~override System.Windows.Forms.Design.ParentControlDesigner.SnapLines.get -> System.Collections.IList
~override System.Windows.Forms.Design.WindowsFormsDesignerOptionService.PopulateOptionCollection(System.ComponentModel.Design.DesignerOptionService.DesignerOptionCollection options) -> void
override System.Windows.Forms.Design.WindowsFormsDesignerOptionService.PopulateOptionCollection(System.ComponentModel.Design.DesignerOptionService.DesignerOptionCollection! options) -> void
~static System.Windows.Forms.Design.ParentControlDesigner.InvokeCreateTool(System.Windows.Forms.Design.ParentControlDesigner toInvoke, System.Drawing.Design.ToolboxItem tool) -> void
System.ComponentModel.Design.DesignerActionMethodItem.DesignerActionMethodItem(System.ComponentModel.Design.DesignerActionList? actionList, string? memberName, string? displayName) -> void
System.ComponentModel.Design.DesignerActionMethodItem.DesignerActionMethodItem(System.ComponentModel.Design.DesignerActionList? actionList, string? memberName, string? displayName, bool includeAsDesignerVerb) -> void
Expand Down Expand Up @@ -95,7 +95,7 @@ virtual System.ComponentModel.Design.DesignerActionMethodItem.MemberName.get ->
~virtual System.Windows.Forms.Design.ParentControlDesigner.CanParent(System.Windows.Forms.Design.ControlDesigner controlDesigner) -> bool
~virtual System.Windows.Forms.Design.ParentControlDesigner.CreateToolCore(System.Drawing.Design.ToolboxItem tool, int x, int y, int width, int height, bool hasLocation, bool hasSize) -> System.ComponentModel.IComponent[]
~virtual System.Windows.Forms.Design.ParentControlDesigner.GetParentForComponent(System.ComponentModel.IComponent component) -> System.Windows.Forms.Control
~virtual System.Windows.Forms.Design.WindowsFormsDesignerOptionService.CompatibilityOptions.get -> System.Windows.Forms.Design.DesignerOptions
virtual System.Windows.Forms.Design.WindowsFormsDesignerOptionService.CompatibilityOptions.get -> System.Windows.Forms.Design.DesignerOptions!
abstract System.ComponentModel.Design.CollectionEditor.CollectionForm.OnEditValueChanged() -> void
abstract System.ComponentModel.Design.DataSourceDescriptor.Image.get -> System.Drawing.Bitmap!
abstract System.ComponentModel.Design.DataSourceDescriptor.IsDesignable.get -> bool
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

#nullable disable

using System.ComponentModel.Design;

namespace System.Windows.Forms.Design;
Expand All @@ -12,7 +10,7 @@ namespace System.Windows.Forms.Design;
/// </summary>
public class WindowsFormsDesignerOptionService : DesignerOptionService
{
private DesignerOptions _options;
private DesignerOptions? _options;

public virtual DesignerOptions CompatibilityOptions => _options ??= new DesignerOptions();

Expand All @@ -27,10 +25,9 @@ protected override void PopulateOptionCollection(DesignerOptionCollection option
return;
}

DesignerOptions designerOptions = CompatibilityOptions;
if (designerOptions is not null)
if (CompatibilityOptions is not null)
{
CreateOptionCollection(options, "DesignerOptions", designerOptions);
CreateOptionCollection(options, "DesignerOptions", CompatibilityOptions);
}
}
}