You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Right now, when publishing a NativeAOT app using SqlClient, many warnings are emitted. To properly support NativeAOT, SqlClient will need to get to a place where no warnings are emitted, so the user can be 100% confident that the application will function correctly.
Note that this is related, but not the same as #1942, which is about reducing the binary size. However, the same technique can be used for both: if an entry point (e.g. slim data source builder) is introduced, which by default doesn't include functionality that is large and/or unsafe for NativeAOT, then programs not explicitly bringing in that functionality won't get warnings etc.
Reacted by Andrii Kurdiumov, Paulus Pärssinen, Edward Neal, ThatKevinGrigsby and Charles Roddie
This error did not appear before, is it a compatibility issue with different 7.0 versions of aot? I plan to downgrade, but uninstalling directly is difficult to downgrade @jkotas
I tried uninstalling the application using aspnetcore-runtime-7.0.5-win-x64 dotnet-sdk-7.0.302-win-x64 (1) or after the window->installed application was uninstalled,
I still see 7.0.5 when using dotnet --info, this 7.0.5 is buggy, bug A type initializer threw an exception home computer uses 7.0.4 to test sql The client library is normal.
So, I directly used dotnet --info to get the 7.0.5 folder, and directly brute-deleted it, but got other headaches fatal error LNK1123: 转换到 COFF 期间失败
Before I reinstalled the computer, my source code worked, I reinstalled the computer, the version of the computer was .net 7.0.5 Therefore, I think that I was able to work properly because I used an old version of .NET 7.0
@steveberdy this is SqlClient - neither @jkotas nor myself are owners/maintainers in this repo. I highly suggested first discussing the plan around this with the SqlClient owners and proceeding step-by-step.
Thanks, sorry about that. @cheenamalhotra are you a code owner? It looks like you have approved and merged PRs. If so, it'd be great if we could have a discussion on implementing AOT compatibility
Yes, I am one of the engineers on the team. I noticed your #2742 (comment) as well, did you want to propose the changes to Active Directory Auth provider as you mentioned here? Let us know your thoughts, and we're here to review and support.
@cheenamalhotra I'd be happy to! I'm working on the changes, and I'm setting up AOT-compatibility, trim warnings, etc. I'll make a PR. If there are any trim or AOT issues, I'd be happy to check them out as well.
Not applicable (engineering/compatibility task, not a bug report)
Area
Area\Engineering
Duplicates
None found (related but distinct: #1942 tracks binary size reduction via a slim data source builder)
Regression
Not applicable
Analysis
This is a long-running engineering task to eliminate all trimming/NativeAOT warnings from Microsoft.Data.SqlClient so apps published with PublishAot can be fully trusted. Good progress has been made recently: PRs #4683 and #4684 addressed easy trim-warning cases, and per the 2026-09-16 update, additional PRs are ready for review, narrowing remaining warnings down to two known areas — UDT support (tracked in #4413) and SqlAuthenticationProviderManager (addressed in ongoing PR #4573). Severity: P2 (compatibility/quality-of-life improvement, not a functional regression, but valuable for NativeAOT/trimming adopters).
Once all known warnings are eliminated or explicitly suppressed with justification, consider adding a CI check (e.g. a NativeAOT publish smoke test) to prevent regressions, and close this issue referencing the closing PR(s).
No action needed to assign Copilot coding agent right now since active human contributors (@charlesroddie et al.) already have PRs in flight; re-evaluate if progress stalls.
Note: This triage summary is auto-generated by an AI agent. The analysis and suggestions above have not been verified by a human maintainer. Please treat as preliminary guidance only.
Microsoft.Data.SqlClient 7.1.1 still fails a strict Native AOT publish on .NET SDK 10.0.403 / .NET runtime 10.0.14, Windows x64. A SQL-password connection using only open, parameterized reads and conditional updates retains IL2026 diagnostics in SqlDiagnosticListener, IL2057 in SqlAuthenticationProviderManager and SqlConfigurableRetryLogicLoader, and IL2067/IL2070 in CreateAzureAuthenticationProvider.
usingMicrosoft.Data.SqlClient;awaitusingvarconnection=newSqlConnection("Server=127.0.0.1,1433;User ID=sa;Password=example;Encrypt=False");awaitconnection.OpenAsync();usingvarcommand=newSqlCommand("SELECT COUNT_BIG(*) FROM sys.tables",connection);Console.WriteLine(awaitcommand.ExecuteScalarAsync());
The Pkcs reference avoids the separately tracked #4958 audit warnings. No Azure extension, custom authentication provider, UDT or retry provider is configured. The pinned source still reads configuration and discovers provider types in SqlAuthenticationProviderManager. Main and #4349 show ongoing work, so this is additional released-version evidence rather than a new duplicate issue.
Please include this basic SQL-password path in the warning-clean publish coverage. This currently limits the optional SQL Server integration in Relayer #288.
The retry loader's 5 are removed at publish time by EnableAppConfig; the analyzer cannot see publish-time switch values.
SqlConnectionStringBuilder (IL2113/IL2115) came with the net10.0 retarget: design-time TypeConverter reflection, unused at run time.
In a published app
Trimmed publish of a small ASP.NET Core app using a table-valued parameter, a reader, SqlBatch and GetSchema. Excludes 3 warnings from Azure Monitor itself.
Activity
kant2002 commentedon Mar 7, 2023
I add project settings to be enable trimming analysis here #1943 , That allow bookkeeping warnings which should be fixed.
lozn00 commentedon May 20, 2023
This error did not appear before, is it a compatibility issue with different 7.0 versions of aot? I plan to downgrade, but uninstalling directly is difficult to downgrade @jkotas
lozn00 commentedon May 20, 2023
I tried uninstalling the application using aspnetcore-runtime-7.0.5-win-x64 dotnet-sdk-7.0.302-win-x64 (1) or after the window->installed application was uninstalled,
I still see 7.0.5 when using
dotnet --info, this 7.0.5 is buggy, bug A type initializer threw an exception home computer uses 7.0.4 to test sql The client library is normal.So, I directly used
dotnet --infoto get the 7.0.5 folder, and directly brute-deleted it, but got other headachesfatal error LNK1123: 转换到 COFF 期间失败
I also upgraded to net 8.0 but also got some bugs that frustrated me very much
System.MissingMethodException
Before I reinstalled the computer, my source code worked, I reinstalled the computer, the version of the computer was .net 7.0.5 Therefore, I think that I was able to work properly because I used an old version of .NET 7.0
steveberdy commentedon Dec 6, 2024
@roji @jkotas I'd like to take a stab at this if you could assign it to me.
roji commentedon Dec 6, 2024
@steveberdy this is SqlClient - neither @jkotas nor myself are owners/maintainers in this repo. I highly suggested first discussing the plan around this with the SqlClient owners and proceeding step-by-step.
steveberdy commentedon Dec 6, 2024
Thanks, sorry about that. @cheenamalhotra are you a code owner? It looks like you have approved and merged PRs. If so, it'd be great if we could have a discussion on implementing AOT compatibility
cheenamalhotra commentedon Dec 6, 2024
Hi @steveberdy
Yes, I am one of the engineers on the team. I noticed your #2742 (comment) as well, did you want to propose the changes to Active Directory Auth provider as you mentioned here? Let us know your thoughts, and we're here to review and support.
steveberdy commentedon Dec 6, 2024
@cheenamalhotra I'd be happy to! I'm working on the changes, and I'm setting up AOT-compatibility, trim warnings, etc. I'll make a PR. If there are any trim or AOT issues, I'd be happy to check them out as well.
4 remaining items
priyankatiwari08 commentedon Sep 17, 2026
/triage
github-actions commentedon Sep 17, 2026
🔍 Triage Summary (on-demand re-triage)
Area\EngineeringAnalysis
This is a long-running engineering task to eliminate all trimming/NativeAOT warnings from Microsoft.Data.SqlClient so apps published with PublishAot can be fully trusted. Good progress has been made recently: PRs #4683 and #4684 addressed easy trim-warning cases, and per the 2026-09-16 update, additional PRs are ready for review, narrowing remaining warnings down to two known areas — UDT support (tracked in #4413) and
SqlAuthenticationProviderManager(addressed in ongoing PR #4573). Severity: P2 (compatibility/quality-of-life improvement, not a functional regression, but valuable for NativeAOT/trimming adopters).Next Steps
SqlAuthenticationProviderManagervia Make authentication provider discovery AOT-safe #4573, rather than duplicating that work here.@charlesroddieet al.) already have PRs in flight; re-evaluate if progress stalls.thomhurst commentedon Nov 2, 2026
Microsoft.Data.SqlClient 7.1.1 still fails a strict Native AOT publish on .NET SDK 10.0.403 / .NET runtime 10.0.14, Windows x64. A SQL-password connection using only open, parameterized reads and conditional updates retains IL2026 diagnostics in SqlDiagnosticListener, IL2057 in SqlAuthenticationProviderManager and SqlConfigurableRetryLogicLoader, and IL2067/IL2070 in CreateAzureAuthenticationProvider.
A standalone reproduction is:
dotnet new console --aot -n SqlClientAotProbe cd SqlClientAotProbe dotnet add package Microsoft.Data.SqlClient --version 7.1.1 dotnet add package System.Security.Cryptography.Pkcs --version 10.0.14 dotnet publish -c Release -r win-x64 -p:IlcTreatWarningsAsErrors=true -p:TrimmerSingleWarn=falseReplace Program.cs before publishing:
The Pkcs reference avoids the separately tracked #4958 audit warnings. No Azure extension, custom authentication provider, UDT or retry provider is configured. The pinned source still reads configuration and discovers provider types in SqlAuthenticationProviderManager. Main and #4349 show ongoing work, so this is additional released-version evidence rather than a new duplicate issue.
Please include this basic SQL-password path in the warning-clean publish coverage. This currently limits the optional SQL Server integration in Relayer #288.
paulmedynski commentedon Nov 4, 2026
I doubt #4821 addressed all of the concerns here, so re-opening for further analysis.
charlesroddie commentedon Nov 6, 2026
Re-measured by claude on main at f072438.
Library-wide analysis
net10.0,
-p:IsAotCompatible=true: 17 unique warnings (down from 31 on 14 October).Server.*,SqlConnection.CheckGetExtendedUDTInfo)SqlConfigurableRetryLogicLoaderSqlConnectionStringBuilderEnableAppConfig; the analyzer cannot see publish-time switch values.SqlConnectionStringBuilder(IL2113/IL2115) came with the net10.0 retarget: design-timeTypeConverterreflection, unused at run time.In a published app
Trimmed publish of a small ASP.NET Core app using a table-valued parameter, a reader,
SqlBatchandGetSchema. Excludes 3 warnings from Azure Monitor itself.System.Configuration9, retry loader 5, UDT 7, auth (EnsureBootstrapped) 1EnableAppConfig=falseEnableAzureExtensionDiscovery=falseCLR UDTs are the only remaining source (#4413).