Skip to content

SYSLIB1101 being emitted inappropriately for configuration binder in 11.0.0-preview.7.26381.103 #132377

Closed

Description

@dodexahedron

Description

I have a settings class used with the configuration binder, binding configuration to an instance of that class via a call to the Bind extension method on an IConfigurationRoot instance.
This class has a few private properties that are only runtime-relevant lazy-evaluated properties not meant to participate in configuration binding.
The type of those properties is not supported by the configuration binder source generator, but that's fine because these properties are not supposed to participate. On top of that, the types will not be trimmed anyway since they're used extensively in the program in a trim-safe manner.

The properties are private and also have the [ConfigurationIgnore] attribute applied. Neither of these facts appears to satisfy the analyzer, and it emits SYSLIB1101 that the property is not supported, at the call site of Bind (Edit: Confirmed. See source links below)

Changing the type of the property to object (with no other changes whatsoever) makes the warning go away, so I think the problems lies in the analyzer considering information about the properties in the wrong order or something along those lines. (Edit: Confirmed. See source links below)

Seems to me that ineligibility of the type of a property to participate in configuration binding should not be considered until the property has already passed accessibility and especially ConfigurationIgnoreAttribute opt-out tests. If either of those already would exclude the property, there's no reason to continue evaluating that property further for the purposes of the binder analyzer, and definitely unexpected behavior to emit a warning about it.

This is the property form that caused it:

private ClassTypeThatIsNotSupportedByTheBinder PropertyThatShouldNotParticipateInBinding => field ??= ClassTypeThatIsNotSupportedByTheBinder.CreateInstance ( /*args*/ );

The warning gets emitted at the callsite for Bind on the IConfigurationRoot instance.

Neither making the backing field explicit nor adding the [ConfigurationIgnore] to the property make the warning go away.

The binder still works properly, generating the expected source and functioning as expected at run-time, so it looks like just an analyzer output bug.

Reproduction Steps

Create a class with a private property of a type that is not supported by the configuration binding source generator. Make another property like that and annotate it with [ConfigurationIgnore] as well, to show both problem cases.

Use that class in a call to the Microsoft.Extensions.Configuration.ConfigurationBinder.Bind(this IConfiguration configuration, object? instance) method, and observe SYSLIB1101 at the callsite.

Expected behavior

SYSLIB1101 should not be emitted if the property is private nor if it has ConfigurationIgnoreAttribute applied.

Actual behavior

SYSLIB1101 is emitted at the callsite for Bind

Regression?

No. It appears, in the code, that this never worked as expected.

Known Workarounds

None that are acceptable.
However, using a supported type for the ignored property does make the warning go away.

Configuration

  • .net 11.0.0-preview.7.26381.103
  • Windows 11 insiders build 26100.6.amd64fre.ge_release_flt.260716-1700
  • x64

Other information

The ConfigurationIgnoreAttribute was added in #126396

ETA: Looks like this flaw has always existed since the ConfigurationIgnoreAttribute was introduced. Relevant code:

Activity

  1. added
    untriaged
    on Aug 16, 2026
  2. dotnet-policy-service commented on Aug 16, 2026

    @dotnet-policy-service
    Contributor

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

  3. dodexahedron commented on Aug 16, 2026

    @dodexahedron
    Author

    I think I found the culprit.

    Just a few lines above the line where the IsIgnored property would have been set, it is skipped by the fact that the type is unsupported as part of the containing if statement's condition: if (member is IPropertySymbol { IsIndexer: false, IsImplicitlyDeclared: false } property && !IsUnsupportedType(property.Type))

    That check probably needs to move into the body of that statement, so that the attribute can override it.

    Also, perhaps the attribute check should be the first check, since it should pretty much be a hard kill switch?

  4. dodexahedron commented on Aug 17, 2026

    @dodexahedron
    Author

    Hmm... And, thinking about it... Isn't it wrong to skip them at all? Don't we need a PropertySpec with an indication that it should be ignored or that it is unsupported, rather than just not creating a PropertySpec in the first place?

    If that is the case, then the unsupported type check definitely should move into the body of that statement and should instead be setting a property on the PropertySpec to indicate it failed that check, for consumption by anything dependent on it, like whatever emits that SYSLIB1101 diag.

    Skipping them that early destroys information that is necessary to make the right decision later, for the [value greater than 1] things dependent on that information (including the configuration binding source generator and its analyzers at least), and it's conceivable that there may be other corner cases like this one that are affected similarly because of that check being as nuclear as it is.

  5. self-assigned this
    on Aug 18, 2026
  6. added
    source-generator
    and removed
    untriaged
    on Aug 18, 2026
  7. rosebyte commented on Aug 18, 2026

    @rosebyte
    Member

    Hello, I took a quick look and it seems we attach the descriptor before isIgnored is computed, definitely a bug, not a regression, let's fix it...

  8. added this to the 11.0.0 milestone on Aug 18, 2026
  9. added a commit that references this issue on Aug 21, 2026
    597c07c
  10. locked and limited conversation to collaborators on Sep 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area-Extensions-Configurationbugsource-generator

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions