Commit ac40187
committed
refactor(runtime)!: reparent AmbiguousImplementationException and give the platform attributes a base (#1980 G-3, SA-15.3)
THE FIRST CHANGE TO LAND UNDER SA-15.3, which lifted SA-3's exclusion of vtable
and base-class changes. IT CLOSES #1980: G-1, G-2, G-4 and G-5 landed 2026-08-19.
AmbiguousImplementationException is `public sealed class ... : Exception` in .NET
and derived from SystemException here, unsealed, without .NET's (message, inner)
constructor (SR-AUD-158). All three are fixed.
SA-15.3'S FOURTH CONDITION IS THE PART NO LAYOUT ASSERTION CAN SEE, and it was
discharged by measurement rather than by assertion. The clause whose meaning
moves is `catch (const System::SystemException&)` around code that can throw this
type -- and THERE ARE ZERO SUCH CLAUSES ANYWHERE. The 17 first-party
catch (SystemException) sites are exception-hierarchy tests for other types;
cna's single one catches its own NoAudioHardwareException; and neither consumer
names this type at all. The pin asserts ALL THREE rows -- SystemException,
Exception, and the type itself -- so a later reparenting cannot quietly take the
two that did not move.
BEFORE G-3, FIVE OF .NET'S SIX PLATFORM ATTRIBUTES DERIVED FROM System::Attribute
DIRECTLY AND EACH CARRIED ITS OWN COPY of platformName_ and its own
getPlatformNameProperty() -- five duplicates of one fact, and no type through
which a caller could handle "any platform attribute" at all. That is SR-AUD-163.
OSPlatformAttribute is introduced (abstract, protected constructor, get-only
PlatformName) and all five derive from it and are sealed, as .NET seals all six.
protected, NOT private protected: C++ has no equivalent of C#'s "derived classes
in the same assembly only", and this port has no assembly boundary to express the
second half. protected keeps the base unconstructible from outside the hierarchy,
which is the half that carries meaning; the assembly restriction is NOT
EXPRESSIBLE AND IS NOT PRETENDED. TargetPlatformAttribute is .NET's sixth derived
type and is absent here, stated so that five is not mistaken for the whole set.
LAYOUTS MEASURED AFTER THE CHANGE RATHER THAN PREDICTED BEFORE IT (#1958's
lesson), and NOTHING GREW. The exception stays 168 because SystemException adds
no members of its own over Exception, so the reparenting moves it SIDEWAYS. The
attributes stay put because platformName_ moved INTO the new base rather than
being duplicated beside it -- which is the point of having a base. THE REBUILD IS
REQUIRED BY THE VTABLE, NOT THE SIZE, and the pins assert relationships
(sizeof(Supported...) == sizeof(OSPlatformAttribute)) rather than only literals,
so a later member cannot hide behind a hand-updated number.
Six mutations, ALL CAUGHT, five of them at compile time -- the only way C++
reports a shape, and the reason the pins are static_asserts. Reverting the base is
caught TWICE OVER: the constructor delegations stop compiling and the
static_assert fires.
ONE CORRECTION OF MY OWN IS RECORDED RATHER THAN QUIETLY FIXED: a first version
of the ticket note said G-4 was still outstanding. It was copied from the review
plan's original table instead of from the ticket's own record, and corrected on
re-reading it -- setIsOptionalProperty is gone and the header says so in terms.
That is the same premise error this programme keeps correcting in other people's
records.
Downstream, measured: zero AmbiguousImplementationException and zero
OSPlatformAttribute-family sites in cna and in mobile-eggbert; cna's one
catch (SystemException) cannot receive this type. Recorded as #2413. A FULL
CONSUMER REBUILD IS STILL REQUIRED, because both halves move a vtable.
Gate 17,676 / 38 executables: 17,676 run, 17,676 passed, 0 failed, 0 skipped,
recounted from the per-executable logs. +5 on 17,671, in SharpRuntimeTests_Runtime
(199 -> 204); no other executable moved. Zero build warnings at --parallel 2;
module boundaries green at 41/94.1 parent d3b594e commit ac40187
8 files changed
Lines changed: 316 additions & 33 deletions
File tree
- docs
- modules/runtime
- include/System/Runtime
- Versioning
- tests/System/Runtime
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | | - | |
| 6 | + | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
129 | | - | |
130 | | - | |
131 | | - | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
132 | 134 | | |
133 | 135 | | |
134 | 136 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
Lines changed: 34 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | | - | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
10 | | - | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
11 | 35 | | |
12 | 36 | | |
13 | | - | |
| 37 | + | |
14 | 38 | | |
15 | 39 | | |
16 | 40 | | |
17 | | - | |
18 | | - | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
19 | 48 | | |
20 | 49 | | |
21 | 50 | | |
| |||
Lines changed: 46 additions & 20 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
31 | 55 | | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
32 | 67 | | |
33 | 68 | | |
34 | 69 | | |
35 | | - | |
| 70 | + | |
36 | 71 | | |
37 | 72 | | |
38 | | - | |
39 | 73 | | |
40 | 74 | | |
41 | 75 | | |
42 | | - | |
43 | | - | |
| 76 | + | |
44 | 77 | | |
45 | 78 | | |
46 | 79 | | |
47 | 80 | | |
48 | | - | |
| 81 | + | |
49 | 82 | | |
50 | 83 | | |
51 | 84 | | |
52 | 85 | | |
53 | 86 | | |
54 | 87 | | |
55 | | - | |
| 88 | + | |
56 | 89 | | |
57 | 90 | | |
58 | | - | |
59 | 91 | | |
60 | 92 | | |
61 | 93 | | |
| |||
65 | 97 | | |
66 | 98 | | |
67 | 99 | | |
68 | | - | |
69 | | - | |
| 100 | + | |
70 | 101 | | |
71 | 102 | | |
72 | 103 | | |
73 | | - | |
| 104 | + | |
74 | 105 | | |
75 | 106 | | |
76 | | - | |
77 | 107 | | |
78 | 108 | | |
79 | 109 | | |
80 | 110 | | |
81 | 111 | | |
82 | 112 | | |
83 | | - | |
84 | | - | |
| 113 | + | |
85 | 114 | | |
86 | 115 | | |
87 | 116 | | |
88 | | - | |
| 117 | + | |
89 | 118 | | |
90 | 119 | | |
91 | | - | |
92 | 120 | | |
93 | 121 | | |
94 | 122 | | |
95 | | - | |
96 | | - | |
| 123 | + | |
97 | 124 | | |
98 | 125 | | |
99 | 126 | | |
| |||
110 | 137 | | |
111 | 138 | | |
112 | 139 | | |
113 | | - | |
| 140 | + | |
114 | 141 | | |
115 | 142 | | |
116 | | - | |
117 | 143 | | |
118 | 144 | | |
119 | 145 | | |
| |||
0 commit comments