Cleanup | OS-independent build of non-SNI types#4207
Open
edwardneal wants to merge 7 commits intodotnet:mainfrom
Open
Cleanup | OS-independent build of non-SNI types#4207edwardneal wants to merge 7 commits intodotnet:mainfrom
edwardneal wants to merge 7 commits intodotnet:mainfrom
Conversation
Also fixed a trimming issue - ILLink.Substitutions.xml's logical name was prefixed with Resources\.
Trimming will remove all members besides GetLocalDBConnectionString.
Contributor
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
benrr101
requested changes
Apr 21, 2026
Contributor
benrr101
left a comment
There was a problem hiding this comment.
I feel like this PR is missing a lot of the intended changes? Like, just unconditionally including all the files isn't going to do everything, right?
Eg, do the Microsoft.Win32.SafeHandles namespace exist when compiling for a non-windows runtime?
Contributor
Author
|
It's not going to do everything, but it's not designed to. There are four steps:
I've split them up because changing the non-SNI and the SNI types at the same time will lead to a PR which changes ~50 files and which also performs the logic changes needed for the runtime-level switching. I felt that'd be harder to review and more likely to generate merge conflicts, so we end up with this PR for the simple changes and a follow-up for the SNI layer. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This follows up #3844. Where the first PR laid the groundwork and performed OS-independent builds of the public types, this one handles the wider codebase.
I've moved through the dependencies in sequence:
With the
Interop.Windows.Kernel32andInterop.Windows.Sninamespaces now available, more conditional compilations became unnecessary and could be cleared up.When testing the IL trimming, I noticed that
ILLink.Substitutions.xmlhad the wrong name in the shared project and that the value inLocalAppContextSwitches.UseManagedNetworkingwasn't being substituted for a constant. This is fixed, and more conditional compilations disappeared.Finally, I've performed a merge of the managed SNI's LocalDB integration. This is a useful stopping point - the remaining references to
_WINDOWSand_UNIXpast this will all need to be done at once because they depend uponISniNativeMethods,SniNativeWrapper,SNIHandleorSNILoadHandle.Issues
None.
Testing
Existing tests continue to pass, as expected.
Publishing a simple sample application, enabling trimming and checking with ILSpy and sizoscope confirms that these types are removed by the trimming process (once the resource had the correct name!)