-
Notifications
You must be signed in to change notification settings - Fork 315
Cleanup | Centralise AppContext switches #3492
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cleanup | Centralise AppContext switches #3492
Conversation
/azp run |
Azure Pipelines successfully started running 2 pipeline(s). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, but need to also update this test helper:
src/Microsoft.Data.SqlClient/tests/Common/LocalAppContextSwitchesHelper.cs
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/LocalAppContextSwitches.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/LocalAppContextSwitches.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/src/Resources/ILLink.Substitutions.Windows.xml
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/LocalAppContextSwitches.cs
Show resolved
Hide resolved
Move string constants and variables together; add a comment to UseManagedNetworking explaining that it can be turned into a constant by ILLink.
These tests no longer directly set the AppContext switches to round or truncate decimals, since these switches are cached when first queried.
Thanks both. I've added the review comments, and the failing Could you run CI please? |
/azp run |
Azure Pipelines successfully started running 2 pipeline(s). |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3492 +/- ##
==========================================
- Coverage 68.85% 63.86% -5.00%
==========================================
Files 277 270 -7
Lines 62237 61872 -365
==========================================
- Hits 42854 39515 -3339
- Misses 19383 22357 +2974
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Description
We try to centralise all access to SqlClient's AppContext switches via the
LocalAppContextSwitches
class. There are currently a few cases where we don't do this though:The first port of call is to relocate all of these to the existing LocalAppContextSwitches class. This slightly helps in the merge of SqlConnection.
I've also added an
ILLink.Substitutions.xml
resource to the output. This is a trimming improvement, and is documented here. It allows referencing applications to specify aRuntimeHostConfigurationOption
to set an AppContext switch, which the IL trimmer will reference and remove the entire managed or native SNI. There's a little more work to come on this once trimming is ready.For comparison purposes, this is modelled in part on CsWinRT:
RuntimeHostConfigurationOption
I've used sizoscope to verify that I can use RuntimeHostConfigurationOption, publish an application and see the corresponding SNI's types are removed from the output.
Issues
Partially relates to #1261 and #1942.
Testing
Unit tests pass locally.