Commit 054b2c3
committed
fix: type field as object + drop dead nested helper (issue #7 follow-up)
The PR-#2 first pass on issue #7 fixed constructor-signature reflection
(the DI-container surface) so the plugin loaded on gateway 25.x. The
reporter then ran the live lab against the post-fix DLL and showed a
SECOND failure path: gateway 25.5.0 ships IAnyCAPlugin v3.2.0.0, the
plugin loads cleanly through Initialize at CA-registration time, but the
very first Enroll trips TypeLoadException — the JIT eagerly resolves the
declared types of instance fields when it compiles ANY method on the
class, and `_domainValidatorFactory` was still declared as
`IDomainValidatorFactory` (a type the v3.2 assembly doesn't ship).
Changes:
1. CERTInextCAPlugin.cs:48 — `_domainValidatorFactory` field re-typed
from `volatile IDomainValidatorFactory` to `volatile object`. CLR
class-load no longer eagerly tries to resolve the v3.3-only
IDomainValidatorFactory type.
2. CERTInextCAPlugin.cs:63 — new private property
`DomainValidatorFactory` returns `_domainValidatorFactory as
IDomainValidatorFactory`. The cast is inside the property body and
therefore JIT-lazy per-method, so the type is only resolved when the
property actually runs (on hosts where the type exists). All read
sites that need typed access go through the property.
3. CERTInextCAPlugin.cs:1387 — the nested helper class
`DomainValidatorConfigProvider : IDomainValidatorConfigProvider` was
dead code (declared but never instantiated). Deleted — a nested type
declaring a v3.3-only base interface is itself a class-load hazard,
and the cost of removing it is zero.
4. Null-check guards (`_domainValidatorFactory != null`,
`_domainValidatorFactory == null`) remain as field reads — comparing
`object` to null doesn't touch the v3.3 type at all.
Tests:
- CERTInextCAPluginPublicSurfaceTests gained three new regression
guards:
* NoInstanceField_DeclaredTypeReferencesV3Point3OnlyTypes — walks
every instance field via reflection and asserts none are
declared as a v3.3-only type. This is the exact regression that
slipped through the first issue-#7 pass.
* NoNestedType_ImplementsV3Point3OnlyInterface — walks nested
type interface lists. Catches the dead-code nested helper pattern.
* NoPublicMethod_SignatureReferencesV3Point3OnlyTypes — walks
public methods' return and parameter types so reflection-driven
hosts don't trip on signature metadata.
- DcvEnroll_CompletesWithoutThrowing still passes against the live
sandbox — the DomainValidatorFactory property cast hot path on v3.3
works correctly.
156/156 unit tests pass. Release build 0 warnings, 0 errors.1 parent d4467e9 commit 054b2c3
2 files changed
Lines changed: 118 additions & 21 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 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 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
61 | 146 | | |
62 | 147 | | |
63 | 148 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
42 | 46 | | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
49 | 65 | | |
50 | 66 | | |
51 | 67 | | |
| |||
1125 | 1141 | | |
1126 | 1142 | | |
1127 | 1143 | | |
1128 | | - | |
1129 | | - | |
1130 | | - | |
1131 | | - | |
1132 | | - | |
1133 | | - | |
1134 | | - | |
1135 | | - | |
1136 | | - | |
1137 | | - | |
| 1144 | + | |
| 1145 | + | |
| 1146 | + | |
| 1147 | + | |
| 1148 | + | |
| 1149 | + | |
1138 | 1150 | | |
1139 | 1151 | | |
1140 | 1152 | | |
| |||
1414 | 1426 | | |
1415 | 1427 | | |
1416 | 1428 | | |
1417 | | - | |
| 1429 | + | |
1418 | 1430 | | |
1419 | 1431 | | |
1420 | 1432 | | |
| |||
0 commit comments