[release/11.0.1xx-preview7] Fix Android PixelCopy analyzer failure - #37082
[release/11.0.1xx-preview7] Fix Android PixelCopy analyzer failure#37082kubaflo wants to merge 1 commit into
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 9be49656-7117-4235-9d96-404779ab6b16
|
/azp run |
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 37082Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 37082" |
|
Azure Pipelines: Successfully started running 1 pipeline(s). There may be pipelines that require an authorized user to comment /azp run to run. |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
There was a problem hiding this comment.
Pull request overview
This PR addresses a CA1416 platform-analyzer failure in the Android screenshot implementation by annotating the PixelCopy rendering helper with the appropriate minimum Android API support attribute, aligning the helper’s body with the existing runtime API-level guard at the call site.
Changes:
- Add
[SupportedOSPlatform("android26.0")]toRenderUsingPixelCopyAsyncso CA1416 recognizesPixelCopy.Requestas guarded by Android 26+ support.
|
@PureWeen current head
|
PureWeen
left a comment
There was a problem hiding this comment.
Adversarial review verdict: Ready
No findings. 3/3 reviewers agreed that the annotation is correct and complete:
- The exact
PixelCopy.Request(Window, Rect, Bitmap, …)binding requiresandroid26.0, so the new contract precisely matches the native API. - The helper has one caller, dominated by the analyzer-recognized
OperatingSystem.IsAndroidVersionAtLeast(26)guard; no unsafe or newly warned call site remains. - The attribute is private analyzer metadata only and introduces no runtime, public API, resource-lifetime, or cross-platform behavior change.
Test coverage: A new runtime test would exercise identical behavior before and after this metadata-only change. Analyzer-enabled build validation is the appropriate coverage for this fix; no additional test or code change is required.
Prior review status: No existing review threads; the prior automated review contained an overview only and no findings.
Methodology: 3 independent reviewers with adversarial consensus.
|
Closing as part of consolidating Preview 7 stabilization around #37081. This product-code change remains intentionally excluded from the test-only bundle. |
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. Thank you!
Root Cause
The Preview 7 device-test Mono build enables CI platform analyzers.
RenderAsyncguards the privateRenderUsingPixelCopyAsynccall withOperatingSystem.IsAndroidVersionAtLeast(26), but CA1416 does not propagate that caller precondition into the helper body, soPixelCopy.Requestis reported as reachable on Android 24.Description of Change
Mark
RenderUsingPixelCopyAsyncwithSupportedOSPlatform("android26.0"). This communicates the helper precondition to the analyzer and matches the existing runtime guard without changing screenshot behavior.Validation
PixelCopy.Request.net11.0-android37.0Release build withContinuousIntegrationBuild=truesucceeds after the annotation.Issues Fixed
Unblocks the Preview 7 Mono device-test build.