Skip to content

Commit 5f0984a

Browse files
PhysShellclaude
andcommitted
test(s2-step11): red — L1 positive runtime-FAMILY incompatibility
Adds Tier B regressions: a .NET Framework 4.x wrapper (references mscorlib) under the net8 probe is refused WRAPPER_RUNTIME_UNSUPPORTED (cross-family), while a compatible netstandard2.0 wrapper is NOT rejected by the runtime-family predicate and continues to binding/probe (passes). Also decodes child output as UTF-8 (a localized MSBuild/NuGet line must not crash the reader thread) and sets LangVersion=latest so net48/netstandard2.0 compile the nullable wrapper sources; net4x pulls in the cross-platform reference assemblies. RED against the current bind: a net48 wrapper binds cleanly (its types retarget onto the net8 refs) and reaches the probe, so the version-only predicate never sees the mscorlib cross-family reference. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JxKjqdGEFzq4UzZupw379G
1 parent 1045ec8 commit 5f0984a

1 file changed

Lines changed: 17 additions & 3 deletions

File tree

‎tests/test_verify_target_tierb.py‎

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,12 @@
240240
"probe": True, "expect": ("pass", "two")},
241241
{"name": "incompat", "pre": _PRE, "wrapper": _INCOMPAT, "tfm": "net9.0", "convert": True,
242242
"ref": True, "probe": True, "expect": ("refuse", "WRAPPER_RUNTIME_UNSUPPORTED")},
243+
# a .NET Framework 4.x wrapper references mscorlib -> cross-family incompatibility (L1).
244+
{"name": "netfx", "pre": _PRE, "wrapper": _STRONG, "tfm": "net48", "convert": True,
245+
"ref": True, "probe": True, "expect": ("refuse", "WRAPPER_RUNTIME_UNSUPPORTED")},
246+
# a compatible netstandard2.0 wrapper is NOT rejected by the runtime-family predicate.
247+
{"name": "netstandard", "pre": _PRE, "wrapper": _WEAK, "tfm": "netstandard2.0", "convert": True,
248+
"ref": True, "probe": True, "expect": ("pass", "converted")},
243249
{"name": "missingdep", "pre": _PRE, "wrapper": _MISSINGDEP, "helper": _HELPER,
244250
"convert": True, "ref": True, "probe": True,
245251
"expect": ("refuse", "WRAPPER_RUNTIME_UNSUPPORTED")},
@@ -258,7 +264,10 @@ def _sha(b: bytes) -> str:
258264

259265
def _run(argv: list[str], cwd: str | None = None,
260266
env: dict | None = None) -> subprocess.CompletedProcess:
261-
return subprocess.run(argv, cwd=cwd, capture_output=True, text=True, check=False, env=env)
267+
# decode as UTF-8 with replacement — a localized MSBuild / NuGet-restore line (e.g. under a
268+
# non-UTF-8 Windows console codepage) must never crash the reader thread.
269+
return subprocess.run(argv, cwd=cwd, capture_output=True, text=True, check=False, env=env,
270+
encoding="utf-8", errors="replace")
262271

263272

264273
def _py(args: list[str], cwd: str | None = None) -> subprocess.CompletedProcess:
@@ -291,13 +300,18 @@ def _build(dotnet: str) -> tuple[str, str]:
291300

292301
def _csproj(tfm: str, refs: list[tuple[str, str]], asmname: str,
293302
pkgs: list[tuple[str, str]] | None = None) -> str:
303+
pkgs = list(pkgs or [])
304+
if tfm.startswith("net4"): # .NET Framework targets need the cross-platform ref assemblies
305+
pkgs.append(("Microsoft.NETFramework.ReferenceAssemblies", "1.0.3"))
294306
items = "".join(f'<Reference Include="{n}"><HintPath>{h}</HintPath></Reference>'
295307
for n, h in refs)
296-
items += "".join(f'<PackageReference Include="{n}" Version="{v}" />'
297-
for n, v in (pkgs or []))
308+
items += "".join(f'<PackageReference Include="{n}" Version="{v}" />' for n, v in pkgs)
298309
grp = f"<ItemGroup>{items}</ItemGroup>" if items else ""
310+
# LangVersion latest: net48 / netstandard2.0 default to C# 7.3, where Nullable=enable and the
311+
# nullable annotations in the wrapper sources are an error.
299312
return (f'<Project Sdk="Microsoft.NET.Sdk"><PropertyGroup>'
300313
f'<TargetFramework>{tfm}</TargetFramework><Nullable>enable</Nullable>'
314+
f'<LangVersion>latest</LangVersion>'
301315
f'<AssemblyName>{asmname}</AssemblyName><Deterministic>true</Deterministic>'
302316
f'</PropertyGroup>{grp}</Project>')
303317

0 commit comments

Comments
 (0)