Repository navigation
Implement phase 1 of AOT-safe authentication registration - #4806
paulmedynski wants to merge 2 commits into
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
The runtime-version guard remains permanently enabled in publish outputs, so the claimed untrimmed-only reflective path is not removed.
2 open findings
What changed in this PR
Implements phase 1 of AOT-safe authentication registration by moving provider bootstrap and registration into Extensions.Abstractions while preserving compatibility.
Changes:
- Replaces reflective registration with a direct provider registry and relocates the initializer.
- Adds package-version enforcement, feature gates, diagnostics, and localized resources.
- Adds process-isolated configuration, trimming, NativeAOT, and pipeline coverage.
Existing feedback: Not available because no PR number or review threads were supplied.
| File | Description |
|---|---|
.config/LocalizationValidationAllowlist.json |
Adds Abstractions allowlist section. |
.github/instructions/architecture.instructions.md |
Documents Abstractions TFMs. |
.github/instructions/features.instructions.md |
Documents authentication switches. |
BUILDGUIDE.md |
Updates framework matrix. |
doc/design-notes/aot-auth-provider-proposal/README.md |
Updates phase-one behavior. |
doc/design-notes/aot-auth-provider-proposal/backporting.md |
Revises compatibility guidance. |
doc/design-notes/aot-auth-provider-proposal/design.md |
Updates registry failure design. |
doc/design-notes/aot-auth-provider-proposal/findings.md |
Revises bootstrap-failure resolution. |
doc/design-notes/aot-auth-provider-proposal/implementation-plan.md |
Records implementation and validation. |
eng/pipelines/jobs/test-abstractions-package-ci-job.yml |
Adds authentication/version checks. |
eng/pipelines/onebranch/jobs/build-buildproj-job.yml |
Adds Abstractions localization validation. |
eng/pipelines/onebranch/scripts/tests/validate-localization.Tests.ps1 |
Tests independent allowlists. |
eng/pipelines/onebranch/scripts/validate-localization.ps1 |
Supports selectable allowlist sections. |
eng/pipelines/onebranch/steps/validate-localization-step.yml |
Parameterizes resource validation. |
eng/pipelines/pr/jobs/test-buildproj-job.yml |
Adds PR authentication checks. |
eng/pipelines/scripts/tests/Build-Orchestration.Tests.ps1 |
Updates expected project TFMs. |
src/Microsoft.Data.SqlClient.Extensions/Abstractions/build/Microsoft.Data.SqlClient.Extensions.Abstractions.targets |
Enforces family package versions. |
src/Microsoft.Data.SqlClient.Extensions/Abstractions/doc/SqlAuthenticationProvider.xml |
Documents registry behavior. |
src/Microsoft.Data.SqlClient.Extensions/Abstractions/src/Abstractions.csproj |
Adds net10/AOT and package assets. |
src/Microsoft.Data.SqlClient.Extensions/Abstractions/src/AuthenticationFeatureSwitches.cs |
Defines trimming guards and switches. |
src/Microsoft.Data.SqlClient.Extensions/Abstractions/src/AuthenticationStrings.cs |
Provides localized authentication errors. |
src/Microsoft.Data.SqlClient.Extensions/Abstractions/src/PackageReadme.md |
Documents registration and version policy. |
src/Microsoft.Data.SqlClient.Extensions/Abstractions/src/Resources/Strings.cs.resx |
Moves Czech authentication strings. |
src/Microsoft.Data.SqlClient.Extensions/Abstractions/src/Resources/Strings.de.resx |
Moves German authentication strings. |
src/Microsoft.Data.SqlClient.Extensions/Abstractions/src/Resources/Strings.es.resx |
Moves Spanish authentication strings. |
src/Microsoft.Data.SqlClient.Extensions/Abstractions/src/Resources/Strings.fr.resx |
Moves French authentication strings. |
src/Microsoft.Data.SqlClient.Extensions/Abstractions/src/Resources/Strings.it.resx |
Moves Italian authentication strings. |
src/Microsoft.Data.SqlClient.Extensions/Abstractions/src/Resources/Strings.ja.resx |
Moves Japanese authentication strings. |
src/Microsoft.Data.SqlClient.Extensions/Abstractions/src/Resources/Strings.ko.resx |
Moves Korean authentication strings. |
src/Microsoft.Data.SqlClient.Extensions/Abstractions/src/Resources/Strings.pl.resx |
Moves Polish authentication strings. |
src/Microsoft.Data.SqlClient.Extensions/Abstractions/src/Resources/Strings.pt-BR.resx |
Moves Portuguese authentication strings. |
src/Microsoft.Data.SqlClient.Extensions/Abstractions/src/Resources/Strings.resx |
Adds neutral authentication strings. |
src/Microsoft.Data.SqlClient.Extensions/Abstractions/src/Resources/Strings.ru.resx |
Moves Russian authentication strings. |
src/Microsoft.Data.SqlClient.Extensions/Abstractions/src/Resources/Strings.tr.resx |
Moves Turkish authentication strings. |
src/Microsoft.Data.SqlClient.Extensions/Abstractions/src/Resources/Strings.zh-Hans.resx |
Moves Simplified Chinese strings. |
src/Microsoft.Data.SqlClient.Extensions/Abstractions/src/Resources/Strings.zh-Hant.resx |
Moves Traditional Chinese strings. |
src/Microsoft.Data.SqlClient.Extensions/Abstractions/src/SqlAuthenticationInitializer.cs |
Relocates the initializer API. |
src/Microsoft.Data.SqlClient.Extensions/Abstractions/src/SqlAuthenticationProvider.Internal.cs |
Removes the reflective driver bridge. |
src/Microsoft.Data.SqlClient.Extensions/Abstractions/src/SqlAuthenticationProvider.cs |
Calls the registry directly. |
src/Microsoft.Data.SqlClient.Extensions/Abstractions/src/SqlAuthenticationProviderRegistry.cs |
Implements bootstrap, precedence, and registration. |
src/Microsoft.Data.SqlClient.Extensions/Abstractions/src/TrimmingAttributes.cs |
Adds netstandard compatibility attributes. |
src/Microsoft.Data.SqlClient.Extensions/Abstractions/test/Abstractions.Test.csproj |
Excludes nested fixture outputs. |
src/Microsoft.Data.SqlClient.Extensions/Abstractions/test/AuthenticationRegistryTest.cs |
Tests registry failures and callbacks. |
src/Microsoft.Data.SqlClient.Extensions/Abstractions/test/AzureProviderConstructionTest.cs |
Tests Azure constructor selection. |
src/Microsoft.Data.SqlClient.Extensions/Abstractions/test/ConfigurationTest/ConfigurationTest.csproj |
Defines process-isolated fixture. |
src/Microsoft.Data.SqlClient.Extensions/Abstractions/test/ConfigurationTest/Program.cs |
Exercises bootstrap scenarios. |
src/Microsoft.Data.SqlClient.Extensions/Abstractions/test/ConfigurationTest/app.config |
Defines current configuration fixture. |
src/Microsoft.Data.SqlClient.Extensions/Abstractions/test/ConfigurationTest/bad-initializer.config |
Defines invalid initializer fixture. |
src/Microsoft.Data.SqlClient.Extensions/Abstractions/test/ConfigurationTest/bad-provider.config |
Defines missing provider fixture. |
src/Microsoft.Data.SqlClient.Extensions/Abstractions/test/ConfigurationTest/bad-unsupported.config |
Defines unsupported provider fixture. |
src/Microsoft.Data.SqlClient.Extensions/Abstractions/test/ConfigurationTest/legacy.config |
Defines legacy configuration fixture. |
src/Microsoft.Data.SqlClient.Extensions/Abstractions/test/PublishTest/Program.cs |
Tests published explicit registration. |
src/Microsoft.Data.SqlClient.Extensions/Abstractions/test/PublishTest/PublishTest.csproj |
Configures trimmed/AOT publishing. |
src/Microsoft.Data.SqlClient.Extensions/Abstractions/test/RunAuthenticationTests.ps1 |
Runs isolated authentication fixtures. |
src/Microsoft.Data.SqlClient.Extensions/Abstractions/test/RunVersionChecks.ps1 |
Tests package-version enforcement. |
src/Microsoft.Data.SqlClient.Extensions/Abstractions/test/RuntimeVersionTest/RuntimeVersionTest.csproj |
Produces mismatched driver fixture. |
src/Microsoft.Data.SqlClient.Extensions/Abstractions/test/SqlAuthenticationProviderTest.cs |
Verifies driver-independent registration. |
src/Microsoft.Data.SqlClient/ref/Microsoft.Data.SqlClient.cs |
Removes relocated initializer declaration. |
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Connection/SqlConnectionInternal.cs |
Uses the public registry lookup. |
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlAuthenticationProviderConfigurationSection.cs |
Preserves configuration handlers. |
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlUtil.cs |
Removes relocated error helpers. |
src/Microsoft.Data.SqlClient/src/PackageReadme.md |
Documents AOT registration requirements. |
src/Microsoft.Data.SqlClient/src/Resources/Strings.Designer.cs |
Removes relocated resource accessors. |
src/Microsoft.Data.SqlClient/src/Resources/Strings.cs.resx |
Removes moved Czech strings. |
src/Microsoft.Data.SqlClient/src/Resources/Strings.de.resx |
Removes moved German strings. |
src/Microsoft.Data.SqlClient/src/Resources/Strings.es.resx |
Removes moved Spanish strings. |
src/Microsoft.Data.SqlClient/src/Resources/Strings.fr.resx |
Removes moved French strings. |
src/Microsoft.Data.SqlClient/src/Resources/Strings.it.resx |
Removes moved Italian strings. |
src/Microsoft.Data.SqlClient/src/Resources/Strings.ja.resx |
Removes moved Japanese strings. |
src/Microsoft.Data.SqlClient/src/Resources/Strings.ko.resx |
Removes moved Korean strings. |
src/Microsoft.Data.SqlClient/src/Resources/Strings.pl.resx |
Removes moved Polish strings. |
src/Microsoft.Data.SqlClient/src/Resources/Strings.pt-BR.resx |
Removes moved Portuguese strings. |
src/Microsoft.Data.SqlClient/src/Resources/Strings.resx |
Removes moved neutral strings. |
src/Microsoft.Data.SqlClient/src/Resources/Strings.ru.resx |
Removes moved Russian strings. |
src/Microsoft.Data.SqlClient/src/Resources/Strings.tr.resx |
Removes moved Turkish strings. |
src/Microsoft.Data.SqlClient/src/Resources/Strings.zh-Hans.resx |
Removes moved Simplified Chinese strings. |
src/Microsoft.Data.SqlClient/src/Resources/Strings.zh-Hant.resx |
Removes moved Traditional Chinese strings. |
src/Microsoft.Data.SqlClient/src/TypeForwards.Abstractions.cs |
Adds initializer type forwarding. |
src/Microsoft.Data.SqlClient/tests/UnitTests/Microsoft/Data/SqlClient/AuthenticationConfigurationSchemaTest.cs |
Pins handler and forwarding contracts. |
src/Microsoft.Data.SqlClient/tests/UnitTests/Microsoft/Data/SqlClient/EnableAppConfigSwitchTest.cs |
Moves authentication-switch coverage. |
Files not reviewed (1)
- src/Microsoft.Data.SqlClient/src/Resources/Strings.Designer.cs: Generated file
🧠 Review effort: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| [FeatureGuard(typeof(RequiresDynamicCodeAttribute))] | ||
| [UnconditionalSuppressMessage("Trimming", "IL4000", | ||
| Justification = "Runtime assembly replacement is unavailable in fixed trimmed/AOT images; the package graph is checked at build time.")] | ||
| internal static bool IsRuntimeVersionValidationSupported => true; |
|
|
||
| | Switch Name | Default | Description | | ||
| |-------------|---------|-------------| | ||
| | `Switch.Microsoft.Data.SqlClient.EnableAppConfig` | `true` | Enables authentication app.config parsing and initializer execution; trimmed/AOT .NET 10 publishes remove this guarded path | |
Capture configuration forwarding, cached switches, resilient diagnostics, validation updates, and interactive-agent branch guidance before constructing the PR stack. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🔵 Needs a closer look
The broad authentication, compatibility, packaging, and pipeline changes require final human review, with documentation and pipeline-description discrepancies still outstanding.
3 open findings
Files not reviewed (1)
- src/Microsoft.Data.SqlClient/src/Resources/Strings.Designer.cs: Generated file
🧠 Review effort: Balanced
| - stage: test_authentication | ||
| displayName: Test Authentication Registration | ||
| # The scripts build their own Release fixtures and require no package artifacts or SQL secrets. | ||
| dependsOn: [] |
|
Closed in favour of the PR stack starting with #4816 |



Description
Implements phase 1 of the AOT-safe authentication provider registration proposal. This draft targets
dev/paul/aot/planso the diff contains the implementation and related documentation updates, rather than the original design-plan commit.SqlAuthenticationInitializerand retain its driver type forward for the 8.0 major release.GetProvider/SetProvidernull/false failure results. Log actionable configuration, provider, callback and runtime-version errors, including cached bootstrap failures when tracing is enabled after the initial failure.netstandard2.0;net10.0, add compatibility attributes, and guard reflective configuration and Azure discovery so trimmed and NativeAOT .NET 10 publishes remove those paths.packages.configand an emergency build opt-out, plus untrimmed runtime assembly-version checks. Mixed family versions remain unsupported.DotNetCoreCLI@2, with the shared tool-restore step immediately after SDK/runtime installation.Compatibility notes: no new public registration-method signatures or registry-error exception contract are introduced. Failed replacement does not publish the new provider. Bootstrap failures remain cached for the process lifetime and require correcting the cause and restarting. Exact-version enforcement intentionally rejects unsupported mixed-family graphs.
Issues
No linked issue. Implements the phase-1 plan on
dev/paul/aot/plan.Testing
Added or updated coverage for direct registration without the driver, initial null lookup followed by set/get, replacement callbacks and failure-state preservation, actionable EventSource diagnostics, configuration handler contracts, initializer registration, precedence, disabled feature switches, cached bootstrap failures, runtime version mismatches, package-version enforcement and trimmed/NativeAOT registration.
Validation performed locally on Linux:
dotnet build build.proj -t:BuildAll --verbosity quietdotnet test src/Microsoft.Data.SqlClient.Extensions/Abstractions/test/Abstractions.Test.csproj --framework net10.0 --no-restore --verbosity quietdotnet test src/Microsoft.Data.SqlClient/tests/UnitTests/Microsoft.Data.SqlClient.UnitTests.csproj --framework net10.0 --no-build --no-restore --filter 'FullyQualifiedName~AuthenticationConfigurationSchemaTest|FullyQualifiedName~EnableAppConfigSwitchTest|FullyQualifiedName~SqlAuthenticationProviderManagerTests' --verbosity quietdotnet tool run pwsh -- -File src/Microsoft.Data.SqlClient.Extensions/Abstractions/test/RunAuthenticationTests.ps1dotnet tool run pwsh -- -File src/Microsoft.Data.SqlClient.Extensions/Abstractions/test/RunAuthenticationTests.ps1 -Publishdotnet tool run pwsh -- -File src/Microsoft.Data.SqlClient.Extensions/Abstractions/test/RunVersionChecks.ps1dotnet build src/Microsoft.Data.SqlClient.Extensions/Abstractions/test/ConfigurationTest/ConfigurationTest.csproj --framework net462 --configuration Release --verbosity quietThe .NET Framework targets compile, but Windows/net462 test execution was not performed on Linux. Azure pipelines and SQL Server integration tests were not run locally.
Earlier validation also identified two existing baseline issues outside this change: the driver localization check lacks
ADP_IsolationLevelResetTimeouttranslations in 13 cultures, and one build-orchestration documentation-path quoting assertion fails. Those unrelated issues have not been changed.Guidelines
Please review the contribution guidelines before submitting a pull request: