Repository navigation
[release/11.0] Fix CoreFoundation number interop ABI in Apple proxy handling - #135198
Merged
Merged
Conversation
Apple proxy handling can crash in `CFNumberGetValue` when running under the CoreCLR interpreter. `CFNumberType` was declared as a 32-bit enum, but native CoreFoundation uses `CFIndex`, which is 64-bit on all supported .NET Apple targets. The simulator repro received `0x100000009` instead of the requested type value `9`. This fixes the native declaration by using a `long`-backed enum and a `byte` return matching Apple's one-byte `Boolean`. No proxy logic or interpreter implementation changes are needed. Adds six Apple-only theory cases to the existing HTTP unit-test project. They evaluate an in-memory PAC script and exercise the source-linked production `CFProxy.PortNumber` implementation, covering ports 1, 80, 443, 8080, 65535, and `DIRECT`. They require neither system proxy changes nor network connections. ### Validation - Before product changes, reproduced the crash on an iOS 26.5 arm64 simulator through the actual production `MacProxy` PAC callback. The new regression also crashed against the unfixed declaration. With the fix, the original repro completed all ten lookups. - Full iOS simulator unit suite under the CoreCLR interpreter: 2,558 passed, 40 existing skips; all six new cases passed. - Full macOS unit suite: 2,683 passed, 4 existing skips. After moving the new source-inclusion group to the end of the project, the targeted regression was rebuilt and rerun: 6 passed. - macOS functional suite: 4,766 passed, 43 skipped, 3 IPv6 link-local failures. All three failures also reproduced against the exactly unfixed production declaration. Resolves #134617 > [!NOTE] > This pull request was prepared with GitHub Copilot. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Azure Pipelines: Successfully started running 4 pipeline(s). 12 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
|
Tagging subscribers to this area: @karelz, @dotnet/ncl |
wfurt
approved these changes
Oct 5, 2026
Member
|
/ba-g BA doesn't report any unknown failures and the service got stuck the first time. BI doesn't report any interesting failures either. I rechecked and all failures match existing KBEs. |
This branch was successfully deployed
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.
Backport of #135089 to release/11.0
/cc @vitek-karas
Customer Impact
#134617
Crash using SocketsHttpHandler on a network with proxy configured. Seems to only repro on iOS with CoreCLR runtime.
Regression
Compared to .NET 10 this is a regression. .NET 10 uses mono runtime. The bug exists there as well, but the different runtime seems to not cause the crash here (tested locally that the same code works on .NET 10 while it crashes on .NET 11) - the crash can be masked if the runtime uses zero-initialized memory for the interop calls, which is likely with mono's interpreter.
Testing
New test which closely mimics customer reported behavior. Validated that the new test fails on unfixed runtime with the same failure as customer reporter. After the fix the test passes.
Risk
Low - the change only affects the code which crashes - before the change the code would always crash, so fixing it doesn't introduce a behavior change.
IMPORTANT: If this backport is for a servicing release, please verify that:
release/X.0-staging, notrelease/X.0.release/X.0(no-stagingsuffix).Package authoring no longer needed in .NET 9
IMPORTANT: Starting with .NET 9, you no longer need to edit a NuGet package's csproj to enable building and bump the version.
Keep in mind that we still need package authoring in .NET 8 and older versions.