Commit eaed006
Teach the authoring prompt the Android API floor CA1416 cannot enforce
PR 443's reviewer found a device test reading the API 28
TextView.AccessibilityHeading in a project whose android floor is 21.0.
The test compiles and ships: Controls.DeviceTests.csproj carries
<NoWarn>$(NoWarn),CA1416</NoWarn>, so the .NET platform-compatibility
analyzer that exists to catch exactly this is switched off. The
repository sets dotnet_diagnostic.CA1416.severity = error globally and
then suppresses it in all four device-test projects, so every Android
device test this pipeline authors is unprotected, not just the one that
happened to trip it.
A detector was measured and refused. Keyed on bare member name against
the real Mono.Android metadata it fires on 8 of 8 files, matching
Controls (the MAUI namespace), True and NotEqual (xUnit asserts), Value
and Handler. Excluding every name the BCL also declares still leaves 7
of 8, because Android overloads names across types at different levels -
AccessibilityHeading alone is declared on hundreds of types, and
PerformClick, Draw and GetChildAt are ancient on the type actually
called while an obscure sibling carries a high annotation. Deciding
which type a .Member read targets needs a semantic model, which is
precisely CA1416. A regex here would be a refusal machine aimed at
correct tests.
So the rule is stated instead, per the established rule that every guard
rule must be stated in the authoring prompt or the author can only find
it by being refused - and here there is no guard at all, so the author
cannot even be refused.
The guidance asserts three facts about files it does not own, so a
second test reads those files rather than the prose: the android floor,
the CA1416 suppression, and the guard this repository already uses at
HandlerTestBasementOfT.Android.cs, which version-guards that exact
getter and records that there is no ViewCompat.GetAccessibilityHeading.
Mutation tested: deleting the rule fails the first test; raising the
real csproj floor to 28.0 fails the second. 2 killed, 0 survivors.
Suite 961 passed, 0 failed.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 735ac9a2-7bec-4baa-ad19-c298e5bc795a1 parent 7eb6a0b commit eaed006
2 files changed
Lines changed: 36 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6853 | 6853 | | |
6854 | 6854 | | |
6855 | 6855 | | |
| 6856 | + | |
| 6857 | + | |
| 6858 | + | |
| 6859 | + | |
| 6860 | + | |
| 6861 | + | |
| 6862 | + | |
| 6863 | + | |
| 6864 | + | |
| 6865 | + | |
| 6866 | + | |
| 6867 | + | |
| 6868 | + | |
| 6869 | + | |
| 6870 | + | |
| 6871 | + | |
| 6872 | + | |
| 6873 | + | |
| 6874 | + | |
| 6875 | + | |
| 6876 | + | |
| 6877 | + | |
| 6878 | + | |
| 6879 | + | |
| 6880 | + | |
| 6881 | + | |
| 6882 | + | |
| 6883 | + | |
| 6884 | + | |
| 6885 | + | |
| 6886 | + | |
| 6887 | + | |
| 6888 | + | |
| 6889 | + | |
| 6890 | + | |
6856 | 6891 | | |
6857 | 6892 | | |
6858 | 6893 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6227 | 6227 | | |
6228 | 6228 | | |
6229 | 6229 | | |
| 6230 | + | |
6230 | 6231 | | |
6231 | 6232 | | |
6232 | 6233 | | |
| |||
0 commit comments