Skip to content

Fix Image dimension DefaultValue metadata - #14895

Draft
breadtitor wants to merge 2 commits into
dotnet:mainfrom
breadtitor:agent/fix-image-default-values
Draft

Fix Image dimension DefaultValue metadata#14895
breadtitor wants to merge 2 commits into
dotnet:mainfrom
breadtitor:agent/fix-image-default-values

Conversation

@breadtitor

@breadtitor breadtitor commented Aug 16, 2026

Copy link
Copy Markdown

Fixes dotnet/runtime#126265

Proposed changes

  • Change the DefaultValue metadata for Image.Width and Image.Height from false to integer 0.
  • Add a parameterized TypeDescriptor regression test for both properties.

Customer Impact

  • Metadata consumers no longer receive a Boolean default for integer properties.
  • Prevents invalid-cast failures in consumers such as OpenAPI schema generation.

Regression?

  • No. This corrects invalid design-time metadata; the property values and API surface are unchanged.

Risk

  • Low. The production change is limited to two DefaultValue attributes and is covered by a focused regression test.

Test methodology

  • Built System.Drawing.Common and System.Drawing.Common.Tests with the repository-pinned .NET 11 toolchain.
  • Ran System.Drawing.Tests.ImageTests.ImageDimensionProperty_DefaultValueIsZero: 2 passed, 0 failed.

Test environment(s)

  • Windows x64
  • .NET SDK 11.0.100-preview.6.26359.118
  • Test runtime 11.0.0-rc.1.26411.119

AI assistance: Codex was used to prepare this change; the patch was reviewed by the submitter.

Microsoft Reviewers: Open in CodeFlow

The Width and Height properties are integers, but their DefaultValue attributes used false. Use zero and cover both properties through TypeDescriptor metadata.

Fix dotnet/runtime#126265
@breadtitor

Copy link
Copy Markdown
Author

@dotnet-policy-service agree

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

draft draft PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

System.Drawing.Image Width and Height declare bool default values

1 participant