Skip to content

[release/11.0] Don't report unsupported types for never bound properties - #132783

Open
github-actions[bot] wants to merge 1 commit into
release/11.0from
backport/pr-132455-to-release/11.0
Open

[release/11.0] Don't report unsupported types for never bound properties#132783
github-actions[bot] wants to merge 1 commit into
release/11.0from
backport/pr-132455-to-release/11.0

Conversation

@github-actions

@github-actions github-actions Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Backport of #132455 to release/11.0

/cc @rosebyte

Customer Impact

  • Customer reported
  • Found internally

Customers using Configuration Binder source generation in .NET 11 can receive false SYSLIB1100 or SYSLIB1101 diagnostics when a configuration type contains a property that cannot participate in binding, including a property marked [ConfigurationIgnore] or one without a public accessor. This can fail builds that treat warnings as errors, even though the generated binder behaves correctly at run time. This was reported in #132377.

Regression

  • Yes
  • No

The source generator has always evaluated unsupported property types before filtering properties that cannot participate in binding. The [ConfigurationIgnore] case has existed since the attribute was introduced in #126396 as new .NET 11 functionality.

Testing

Source-generation tests cover private, internal, protected, and [ConfigurationIgnore] properties. Additional tests verify that unsupported types still produce diagnostics when reached through a bindable property or constructor parameter. The original change in #132455 passed its required checks before being merged into main.

Risk

Low. The change is limited to source-generator type indexing and diagnostic eligibility. Run-time binding behaviour and public APIs are unchanged. The filtering follows the existing binding rules, while tests ensure diagnostics remain for types that are actually reachable by generated binding.

Fixes #132377.

## Problem

The configuration binder source generator reports `SYSLIB1101`
("Property 'X' on type 'Y' is not supported.") and `SYSLIB1100` at the
`Bind`/`Get` call site for properties the generated binder never binds:

- properties annotated with `[ConfigurationIgnore]`
- properties with no public accessor

## Root cause

`CreateObjectSpec` queued every property's type via
`EnqueueTransitiveType`, passing the `PropertyNotSupported` descriptor,
before `isIgnored` was computed and without consulting accessibility.
When that type was later found unbindable, the attached diagnostic info
was reported against the property. Both checks were only honoured later,
at emit time, in `TypeIndex.ShouldBindTo`.

## Fix

Build the `PropertySpec` first, then enqueue its type only when the
property can take part in binding. A property backing a constructor
parameter is still registered, since those are bound regardless of the
accessibility of the property describing them.


`ShouldBindTo` now short-circuits on the ignore flag and accessibility
before resolving the type spec, because excluded types are no longer in
the index.

---------

Co-authored-by: rosebyte <jaroslav.ruzicka@hotmail.com>
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
13 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @dotnet/area-extensions-configuration
See info in area-owners.md if you want to be subscribed.

@rosebyte
rosebyte self-requested a review August 26, 2026 17:38
@rosebyte rosebyte added the Servicing-approved Approved for servicing release label Aug 26, 2026
@rosebyte
rosebyte requested a review from svick August 26, 2026 17:49
@rosebyte rosebyte self-assigned this Aug 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant