Skip to content

[Compiler tests] Added C990 for the analyzer/.editorconfig crash fixed in #2098 - #2099

Merged
RobertvanderHulst merged 1 commit into
X-Sharp:devfrom
hpetriffer:tests/analyzerconfig-generated-trees-c990
Oct 11, 2026
Merged

RobertvanderHulst merged 1 commit into
X-Sharp:devfrom
hpetriffer:tests/analyzerconfig-generated-trees-c990

Conversation

@hpetriffer

Copy link
Copy Markdown
Contributor

Regression test for the crash fixed in #2098: with /analyzer and /analyzerconfig, xsc crashed with an IndexOutOfRangeException in CommonCompiler.UpdateAnalyzerConfigOptionsProvider when the compilation had two compiler generated syntax trees.

What it adds

  • src/CompilerTests/Applications/C990: VO dialect, one literal symbol (#C990). The symbol makes ProcessTrees generate a tree, and the VO dialect adds the default tree, so there are two generated trees. Its .editorconfig is passed with /analyzerconfig.
  • xSharp Tests30.viproj: the C990 entry, in the C950-C999 group so that the runner picks it up (the NEW group is not run). Its Switches add /analyzer:Bin\Analyzers\XSharpTestAnalyzer.dll /analyzerconfig:Applications\C990\.editorconfig; both paths are relative to src\CompilerTests, the runner's working directory.
  • src/CompilerTests/Analyzers/XSharpTestAnalyzer: a no-op DiagnosticAnalyzer ([DiagnosticAnalyzer("X#")]). The crash only happens when at least one analyzer is loaded, and xsc only loads analyzers built against XSharp.CodeAnalysis.dll; Roslyn analyzers such as the WinForms ones are ignored. The project (net472) references XSharp.CodeAnalysis.dll, System.Collections.Immutable.dll and System.Memory.dll from Artifacts\Bin\xsc\Release\net472\, i.e. the compiler under test, so no binary is checked in.
  • src/CompilerTests/runtests.cmd: builds the analyzer into Bin\Analyzers (dotnet build, Release) before the tests run. Bin\ is git-ignored.

Testing

Based on dev @ d6fa8d3001 (includes #2098). Release build via src\buildcompiler.cmd Release, tests via RunCompilertests.cmd.

Compiler C990
Built from this branch (includes #2098) compiles (exit 0), runtime test passes
Installed xsc.exe 3.0.2.0 (without #2098) crashes, exit -532462766 (unhandled IndexOutOfRangeException)

Full suite with the compiler from this branch: fixed tests 1030, 22 runtime tests fail, all of which also fail on the 06.10 baseline (which had 25; C703, C901 and R832 pass now). Broken tests: 120 / 120 as expected.

🤖 Generated with Claude Code

…d in X-Sharp#2098

C990 compiles VO code with a literal symbol together with /analyzer and
/analyzerconfig. That combination produced two compiler generated syntax
trees and crashed xsc with an IndexOutOfRangeException before X-Sharp#2098.

The test needs an analyzer that xsc can load, so this adds a small no-op
analyzer (src/CompilerTests/Analyzers/XSharpTestAnalyzer) that is built
against the XSharp.CodeAnalysis.dll of the tested compiler. runtests.cmd
builds it into Bin\Analyzers before the tests run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@RobertvanderHulst
RobertvanderHulst merged commit 1b0e183 into X-Sharp:dev Oct 11, 2026
1 check 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