Skip to content

Make the full test suite pass on Linux (platform-independent tests and paths) - #2

Closed
GrahamTheCoder wants to merge 5 commits into
masterfrom
claude/tender-hamilton-3dqikc
Closed

GrahamTheCoder wants to merge 5 commits into
masterfrom
claude/tender-hamilton-3dqikc

Conversation

@GrahamTheCoder

@GrahamTheCoder GrahamTheCoder commented Nov 9, 2026 •

Copy link
Copy Markdown
Owner

Summary

The full test suite now passes on Linux (net10.0: 1216 passed, 0 failed, 7 skipped, all pre-existing Skips). Differences are handled in shared places rather than per test. .gitattributes is unchanged (* text eol=crlf).

Not yet verified: Windows (CI) and net8.0 locally.

Where each kind of difference is handled

  • Git: unchanged, CRLF everywhere, so raw newlines in test literals are \r\n on every OS.
  • Tests (shared helpers):
    • Utils.RootedPath(...) builds OS-valid fake absolute paths instead of C:\....
    • Solution/slnx tests compare via Utils.HomogenizeEol on both sides.
    • The comment-order check in ConverterTestBase parses SourceLine:N by digits, so it no longer depends on newline characters.
    • XmlTests.vb normalises Environment.NewLine.
    • MultiFileTestFixture sets EnableWindowsTargeting (WinForms projects restore on Linux) and uses separator-neutral obj/bin filters.
  • Production code (real Linux bugs, not just test issues):
    • Invalid metadata reference to the source project: Roslyn's workspace-generated reference to the VB/C# project is unreadable on Linux, so the converter's view of the other language couldn't see source-declared types (enum casts lost Math.Round/Conversions). CreateReferenceOnlyProjectFromAnyOptionsAsync now references metadata emitted directly from the project's compilation (no private members, as Roslyn's skeleton does), used by both conversion directions. It falls back to the workspace project reference if emit fails.
    • MSBuildWorkspace on Unix (CodeConv):
      • MSBuild turns the \" escaping in VB /define: args into /", so Roslyn dropped all VB defines, including _MyType. The converter then compiled a My template that can't build. Defines are now re-read from FinalDefineConstants on non-Windows and applied to both parse and compilation options.
      • Roslyn's generated project-to-project references are invalid on Unix (BC31519); they are replaced with emitted metadata (Unix only).
    • Path separators: .sln/.slnx/project-reference rewriting, resx and designer handling, obj/bin/AssemblyInfo detection and project-file source-to-target replacements now accept either separator and preserve the separators already in the file (PathConverter.EscapeSeparatorAgnostic).
  • Docs: Tests/Readme.md has a new "Cross-platform (Windows and Linux)" section stating where each concern belongs, linked from CONTRIBUTING.md.

Review notes

  • The Linux-only workspace workarounds (MsBuildWorkspaceConverter) are guarded by Path.DirectorySeparatorChar, so Windows behaviour there is unchanged. The ProjectExtensions metadata-reference change and the path/regex changes apply on all platforms, so Windows CI is the real check for those.
  • The defines workaround shells out to dotnet msbuild -getProperty once per VB project, and copies the My template via compilation options rather than reflection.

Test plan

  • dotnet test Tests/Tests.csproj -f net10.0 on Linux: all pass
  • Windows CI
  • net8.0 (running locally)

🤖 Generated with Claude Code

https://claude.ai/code/session_019FEr8H2e8jJFhFcBcweGhR

- Add Utils.RootedPath for OS-valid fake absolute paths
- Compare solution file output ignoring EOL differences
- Parse comment line numbers without relying on newline chars
- Normalise newlines in XmlTests self-verifying fixture
- Set EnableWindowsTargeting and use separator-neutral filters in multi-file fixture
- Handle both path separators in SolutionFileTextEditor

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019FEr8H2e8jJFhFcBcweGhR
…leton

Roslyn's workspace skeleton reference is unreadable on Linux, hiding all source types from the C# view and changing enum cast conversions.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019FEr8H2e8jJFhFcBcweGhR
…ion directions

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019FEr8H2e8jJFhFcBcweGhR
- Restore VB defines (and My template) that Roslyn loses on Unix when MSBuild mangles quoted defines
- Replace unreadable workspace project references with emitted metadata on Unix
- Make project file, solution, resx and generated-file path handling separator agnostic

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019FEr8H2e8jJFhFcBcweGhR
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019FEr8H2e8jJFhFcBcweGhR
@GrahamTheCoder GrahamTheCoder changed the title Make test suite platform independent (Linux) Make the full test suite pass on Linux (platform-independent tests and paths) Nov 10, 2026
@GrahamTheCoder

Copy link
Copy Markdown
Owner Author

Superseded by icsharpcode#1308

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