Commit 5cf00af
authored
Resolve features from @(ReferencePath) after ResolveAssemblyReferences (#531)
Feature detection now runs in a single PolyfillResolveFeatures target
hooked AfterTargets="ResolveAssemblyReferences" BeforeTargets="CoreCompile",
and inspects @(ReferencePath) — the final list of assemblies csc will see,
with NuGetPackageId / NuGetPackageVersion preserved on NuGet-resolved items.
Replaces the previous two-target arrangement (PreparePolyfill running early
off @(ResolvedCompileFileDefinitions), plus a DetectBclMemoryPackageRef
fallback off @(PackageReference)). The fallback was too optimistic: it
fired whenever a PackageReference for Microsoft.Bcl.Memory existed, even
when the dll was not actually in csc's /reference list (stale IDE state,
ExcludeAssets="compile", etc.). The result was that RefsBclMemory got set,
Polyfill's own Index/Range types were suppressed, and the BCL types were
also missing — producing CS0246 in Polyfill_IEnumerable_ElementAt and
Polyfill_IEnumerable_Take.
Inspecting @(ReferencePath) post-RAR makes the feature flags reflect what
csc will actually see, eliminating that whole class of bug.
Adds ConsumeBclMemoryExcludeCompile as a regression test that uses
ExcludeAssets="compile" to reproduce the failure mode without needing an
IDE in the loop. ConsumeBclMemoryNoResolve loses its now-impossible
PreparePolyfill override and stays as a plain smoke test.
If you want it shorter, the body can collapse to:
Single PolyfillResolveFeatures target runs after ResolveAssemblyReferences
and inspects @(ReferencePath), so feature flags only fire when the
corresponding assembly is actually in the reference list csc will see.
Replaces the early PreparePolyfill + DetectBclMemoryPackageRef pair, whose
@(PackageReference)-based fallback could set RefsBclMemory while the dll
was missing from /reference (stale IDE state, ExcludeAssets="compile"),
causing CS0246 in Polyfill_IEnumerable_ElementAt / Take.
Adds ConsumeBclMemoryExcludeCompile as a regression test.1 parent 60de353 commit 5cf00af
5 files changed
Lines changed: 45 additions & 36 deletions
File tree
- src
- ConsumeBclMemoryExcludeCompile
- ConsumeBclMemoryNoResolve
- Polyfill
Lines changed: 17 additions & 0 deletions
| 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 | + | |
Lines changed: 1 addition & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
| 11 | + | |
20 | 12 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | 3 | | |
5 | 4 | | |
6 | 5 | | |
| |||
77 | 76 | | |
78 | 77 | | |
79 | 78 | | |
80 | | - | |
81 | | - | |
82 | | - | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
83 | 90 | | |
84 | 91 | | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
| 92 | + | |
89 | 93 | | |
90 | | - | |
91 | | - | |
92 | 94 | | |
93 | | - | |
| 95 | + | |
94 | 96 | | |
95 | | - | |
96 | | - | |
| 97 | + | |
97 | 98 | | |
98 | | - | |
99 | | - | |
100 | 99 | | |
101 | 100 | | |
102 | | - | |
| 101 | + | |
103 | 102 | | |
104 | | - | |
105 | | - | |
| 103 | + | |
| 104 | + | |
106 | 105 | | |
107 | | - | |
| 106 | + | |
108 | 107 | | |
109 | 108 | | |
110 | | - | |
111 | | - | |
| 109 | + | |
| 110 | + | |
112 | 111 | | |
113 | 112 | | |
114 | | - | |
115 | | - | |
| 113 | + | |
| 114 | + | |
116 | 115 | | |
117 | 116 | | |
118 | | - | |
| 117 | + | |
119 | 118 | | |
120 | 119 | | |
121 | | - | |
| 120 | + | |
122 | 121 | | |
123 | 122 | | |
124 | 123 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
99 | | - | |
| 99 | + | |
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
| |||
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
123 | | - | |
| 123 | + | |
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
| |||
0 commit comments