MicrosoftIdentityApplicationOptions is bound from appsettings.json via the configuration binding source generator.
This type contains a property path that reaches CredentialDescription.Certificate of type X509Certificate2.
Microsoft.Identity.Abstractions_v10.0.0
|-- MicrosoftIdentityApplicationOptions
|-- ClientCredentials: IEnumerable<CredentialDescription>
|-- Certificate: X509Certificate2 <---
|-- IssuerName: X500DistinguishedName
|-- SubjectName: X500DistinguishedName
|-- PublicKey: PublicKey
| |-- SignatureGenerator: X509SignatureGenerator
|-- Extensions: X509ExtensionCollection
|-- PrivateKey: AsymmetricAlgorithm
X509Certificate2 is never represented in appsettings.json - it's a runtime-only object populated by code after loading credentials. However, since the source generator walks all public properties, it produces 18 SYSLIB warnings from X509Certificate2's object graph.
dotnet publish --runtime osx-arm64 -f net10.0 --configuration Releasepublish produces 18 SYSLIB warnings. The binary runs correctly:
./bin/Release/net10.0/osx-arm64/publish/AotReproAll warns cascade from CredentialDescription.Certificate (X509Certificate2):
| Warning | Count | Details |
|---|---|---|
| SYSLIB1100 (type not supported) | 7 | X509Certificate2, X500DistinguishedName ×2, PublicKey, X509ExtensionCollection, X509SignatureGenerator, AsymmetricAlgorithm |
| SYSLIB1101 (property not supported) | 7 | Certificate, IssuerName, SubjectName, PublicKey, Extensions, SignatureGenerator, PrivateKey |
SYSLIB0026 (obsolete PublicKey) |
1 | Generator references X509Certificate2.PublicKey |
SYSLIB0027 (obsolete PrivateKey) |
1 | Generator references X509Certificate2.PrivateKey |
SYSLIB0028 (obsolete SubjectName/IssuerName) |
2 | Generator references X509Certificate2.SubjectName and .IssuerName |
In Microsoft.Identity.Abstractions v11.0.0, the Certificate property were removed from CredentialDescription as regular public properties and re-exposed as C# 14 extension properties (.NET 10+ only). See the PR. Since extension properties are not part of the type's metadata, the configuration binding source generator does not see them and the 18 warnings disappear.
// Certificate is no longer regular public properties, instead,
// internal accessor methods exist:
protected internal X509Certificate2? GetCertificateInternal() => _certificate;
protected internal void SetCertificateInternal(X509Certificate2? value)
=> _certificate = value;
// Extension properties delegate to the internal accessors:
implicit extension CredentialDescriptionExtension for CredentialDescription
{
public X509Certificate2? Certificate
{
get => GetCertificateInternal();
set => SetCertificateInternal(value);
}
}This makes Certificate invisible to the source generator while keeping the same source-level API for consumers. However, this was a binary breaking change.
-
Direct consumers who recompile against v11 are fine. The C# compiler resolves
credential.Certificateto the extension property transparently. -
Transitive dependencies break at runtime. Libraries compiled against v10 emit IL that calls
CredentialDescription::get_Certificate()as an instance method. In v11, that instance method no longer exists — the extension property compiles to a static method on a separate type (CredentialDescriptionExtension::get_Certificate(CredentialDescription)). When an app pulls in v11 at runtime, the old IL can't find the instance method, causingMissingMethodException.
App
|-- Microsoft.Identity.Abstractions v11.0.0 (direct, recompiled -- OK)
|-- LibA (compiled against v10.0.0, NOT recompiled)
|-- calls CredentialDescription::get_Certificate() as instance method
|-- at runtime, .NET unifies to v11.0.0 assembly
|-- instance method gone --> MissingMethodException
Using #pragma warning disable with v10.0.0 at the call site does not work. The configuration binding source generator emits diagnostics from generated code, not from the user's source file, so pragmas have no effect.
<NoWarn> in the consumer's csproj is dangerous as it suppresses all SYSLIB1100/1101 warnings across the entire project, creating a blind spot for real issues in other types.
Is there a way to exclude a specific property from the configuration binding source generator's graph walk? the would let CredentialDescription keep Certificate as a regular public property (no binary break) while avoiding the 18 warnings for consumers who enable AOT and want to use AOT API in IdWeb package?