Skip to content

[release/11.0] Fix CoreFoundation number interop ABI in Apple proxy handling - #135198

Merged
JulieLeeMSFT merged 1 commit into
release/11.0from
backport/pr-135089-to-release/11.0
Oct 5, 2026
Merged

JulieLeeMSFT merged 1 commit into
release/11.0from
backport/pr-135089-to-release/11.0

Conversation

@github-actions

@github-actions github-actions Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Backport of #135089 to release/11.0

/cc @vitek-karas

Customer Impact

  • Customer reported
  • Found internally

#134617
Crash using SocketsHttpHandler on a network with proxy configured. Seems to only repro on iOS with CoreCLR runtime.

Regression

  • Yes
  • No

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:

  • For .NET 8 and .NET 9: The PR target branch is release/X.0-staging, not release/X.0.
  • For .NET 10+: The PR target branch is release/X.0 (no -staging suffix).

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.

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

Copy link
Copy Markdown
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.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @karelz, @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

@vitek-karas

Copy link
Copy Markdown
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.

@JulieLeeMSFT JulieLeeMSFT added Servicing-approved Approved for servicing release apx Related to the Intel Advanced Performance Extensions (APX) and removed Servicing-consider Issue for next servicing release review labels Oct 5, 2026
@JulieLeeMSFT
JulieLeeMSFT deployed to copilot-pat-pool October 5, 2026 23:03 — with GitHub Actions Active
@JulieLeeMSFT JulieLeeMSFT removed the apx Related to the Intel Advanced Performance Extensions (APX) label Oct 5, 2026
@JulieLeeMSFT
JulieLeeMSFT merged commit d4fba1e into release/11.0 Oct 5, 2026
98 of 104 checks passed
@JulieLeeMSFT
JulieLeeMSFT deleted the backport/pr-135089-to-release/11.0 branch October 5, 2026 23:03
@JulieLeeMSFT
JulieLeeMSFT deployed to copilot-pat-pool October 5, 2026 23:03 — with GitHub Actions Active

This branch was successfully deployed

1 active deployment
copilot-pat-pool — 92cec6e1 Deployed Oct 5, 2026 by JulieLeeMSFT via conclusion #9693
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-System.Net.Http Servicing-approved Approved for servicing release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants