[net11.0][iOS] Fix CS8604 build break in BlazorWebViewHandler header marshaling - #37260
Merged
Merged
Conversation
praveenkumarkarunanithi
temporarily deployed
to
copilot-pat-pool
August 10, 2026 11:17 — with
GitHub Actions
Inactive
Contributor
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 37260Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 37260" |
praveenkumarkarunanithi
temporarily deployed
to
copilot-pat-pool
August 10, 2026 11:17 — with
GitHub Actions
Inactive
|
Azure Pipelines: Successfully started running 1 pipeline(s). There may be pipelines that require an authorized user to comment /azp run to run. |
praveenkumarkarunanithi
temporarily deployed
to
copilot-pat-pool
August 10, 2026 11:18 — with
GitHub Actions
Inactive
praveenkumarkarunanithi
temporarily deployed
to
copilot-pat-pool
August 10, 2026 11:20 — with
GitHub Actions
Inactive
praveenkumarkarunanithi
had a problem deploying
to
copilot-pat-pool
August 10, 2026 11:21 — with
GitHub Actions
Failure
praveenkumarkarunanithi
temporarily deployed
to
copilot-pat-pool
August 10, 2026 11:21 — with
GitHub Actions
Inactive
kubaflo
approved these changes
Aug 10, 2026
|
Azure Pipelines: Successfully started running 1 pipeline(s). There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a net11.0-only nullable analysis build break (CS8604) in the iOS BlazorWebViewHandler request-header marshaling path by making the ToString() nullability explicit before constructing KeyValuePair<string,string> entries.
Changes:
- Updates
GetRequestHeadersto pattern-matchkey?.ToString()andheaders[key]?.ToString()into non-nullstringlocals before yielding. - Avoids passing potentially-null
ToString()results intoKeyValuePair<string,string>(resolving the compiler error under stricternet11.0analysis).
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.
Note
Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue.
Root Cause
PR #35706 added an iOS helper,
GetRequestHeaders, which reads request headers from anNSDictionaryand passes them to the shared cache-policy code asKeyValuePair<string, string>entries. The implementation calls.ToString()on the dictionary key and value.Although the key and value objects were already null-checked,
NSObject.ToString()is itself nullable. The compiler therefore could not guarantee that the resulting strings were non-null when constructingKeyValuePair<string, string>, resulting in CS8604 onnet11.0.This was only a warning on
net10.0, but the stricter nullable analysis innet11.0promoted it to an error and caused the CI build failure.Description of Change
Null-checked the .ToString() results via an inline is string pattern-match before yielding them. Semantically identical to the original loop with no behavior or performance impact — it only makes the nullable flow explicit to the compiler.
Issues Fixed
Fixes the net11.0 CI build failure caused by
CS8604inBlazorWebViewHandler.iOS.csRegression Details
Regression from #35706
Platforms Tested