Skip to content

Tests: compile legacy-framework fixtures against net48 reference assemblies from NuGet (fixes CI on Linux) - #9

Merged
Thorium merged 1 commit into
Thorium:mainfrom
simontreanor:legacy-framework-refs
Sep 28, 2026
Merged

Thorium merged 1 commit into
Thorium:mainfrom
simontreanor:legacy-framework-refs

Conversation

@simontreanor

Copy link
Copy Markdown
Contributor

CI on main has been red since aee4bc72 (unit-tests updates), always on the same test:

check-then-add stays where the framework has no Dictionary TryAdd [FAIL]
System.Exception : Test input to parseAndCheckLegacyFramework does not typecheck ...
  (2,21) FS0039 The type 'string' is not defined.

parseAndCheckLegacyFramework resolves its references with assumeDotNetFramework = true, which finds the .NET Framework reference assemblies in Program Files, and only Windows has those. On the Linux runner the script got no usable mscorlib, so the fixture couldn't typecheck. Before requireTypechecks went in, the test passed there without testing anything; the new check is doing its job. It passes on Windows, which is why it doesn't show locally.

This PR gives the legacy compilation the same references on every OS:

  • The test project references Microsoft.NETFramework.ReferenceAssemblies.net48 with its assets excluded, and passes the package folder to the tests as an AssemblyMetadata attribute.
  • parseAndCheckLegacyFrameworkAllowingErrors keeps the script options but swaps the -r: references for net48's mscorlib, System, System.Core, System.Numerics, System.Xml, System.Data, the netstandard and System.Runtime facades, and FSharp.Core.
  • The OperatingSystem.IsWindows() guard on the FR0106/FR0166/FR0167 legacy test comes out, since that test can now run everywhere.

Verified on Linux: CI on this branch in my fork passed (build, 2,991 + 11 tests, vsix, vscode-ext). The failing test and the previously Windows-only one both run and pass there. The two legacy tests also pass on Windows, and fantomas --check is clean.

https://claude.ai/code/session_019V58BHhd4xcqmxoYHpKdTk

…mblies from NuGet

parseAndCheckLegacyFramework resolved .NET Framework references with
assumeDotNetFramework = true, which finds them in Program Files: only Windows
has them. On the Linux CI runner the script got no usable mscorlib (`string`
did not resolve), so since requireTypechecks went in, "check-then-add stays
where the framework has no Dictionary TryAdd" fails there; before, it passed
without testing anything.

The test project now takes Microsoft.NETFramework.ReferenceAssemblies.net48
(assets excluded, only its files are read) and passes its folder to the tests
as assembly metadata; the helper compiles against mscorlib, System,
System.Core, System.Numerics, System.Xml, System.Data, the netstandard and
System.Runtime facades and FSharp.Core. The Windows-only guard on the
FR0106/FR0166/FR0167 legacy test goes, since it now runs everywhere.

Claude-Session: https://claude.ai/code/session_019V58BHhd4xcqmxoYHpKdTk
@Thorium

Thorium commented Sep 28, 2026

Copy link
Copy Markdown
Owner

Ok this is clearly better solution, thank!

@Thorium
Thorium merged commit e9dffb4 into Thorium:main Sep 28, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants