Skip to content

System.Text.RegularExpressions.Tests Fails with 'Language C# is not supported` Error when TestReadyToRun is Enabled #96726

Open
@ivdiazsa

Description

@ivdiazsa

Description

When building and running System.Text.RegularExpressions.Tests with TestReadyToRun=true, the test run will crash and fail with an error about the language C# not being supported.

Reproduction Steps

  1. Clone the repo and build the clr and libs subsets. Make sure you specify TestReadyToRun, so that some necessary pretest components get built.
git clone https://github.com/dotnet/runtime
cd runtime
./build.sh --subset clr+libs --configuration Release -p:TestReadyToRun=true
  1. Build and run the test
cd src/libraries/System.Text.RegularExpressions/tests/FunctionalTests
/path/to/runtime/dotnet.sh build -c Release -t:Test -p:TestReadyToRun=true

Expected behavior

All tests pass, except the skipped ones.

Actual behavior

[FAIL] System.Text.RegularExpressions.Tests.RegexKnownPatternTests.Docs_GroupingConstructs_ZeroWidthPositiveLookbehindAssertions(engine: SourceGenerated)
System.NotSupportedException : The language 'C#' is not supported.
   at Microsoft.CodeAnalysis.Host.HostWorkspaceServices.GetLanguageServices(String languageName)
   at Microsoft.CodeAnalysis.Host.Mef.MefWorkspaceServices.GetLanguageServices(String languageName)
   at Microsoft.CodeAnalysis.SolutionState.AddProject(ProjectInfo projectInfo)
   at Microsoft.CodeAnalysis.SolutionCompilationState.AddProject(ProjectInfo projectInfo)
   at Microsoft.CodeAnalysis.Solution.AddProject(ProjectInfo projectInfo)
   at Microsoft.CodeAnalysis.Solution.AddProject(ProjectId projectId, String name, String assemblyName, String language)
   at System.Text.RegularExpressions.Tests.RegexGeneratorHelper.SourceGenRegexAsync(ValueTuple`4[] regexes, CancellationToken cancellationToken) in /path/to/runtime/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/RegexGeneratorHelper.netcoreapp.cs:line 193
   at System.Text.RegularExpressions.Tests.RegexGeneratorHelper.SourceGenRegexAsync(String pattern, CultureInfo culture, Nullable`1 options, Nullable`1 matchTimeout, CancellationToken cancellationToken) in /path/to/runtime/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/RegexGeneratorHelper.netcoreapp.cs:line 133
   at System.Text.RegularExpressions.Tests.RegexHelpers.GetRegexAsync(RegexEngine engine, String pattern, Nullable`1 options, Nullable`1 matchTimeout) in /path/to/runtime/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/Regex.Tests.Common.cs:line 117
   at System.Text.RegularExpressions.Tests.RegexKnownPatternTests.Docs_GroupingConstructs_ZeroWidthPositiveLookbehindAssertions(RegexEngine engine) in /path/to/runtime/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/Regex.KnownPattern.Tests.cs:line 443
--- End of stack trace from previous location ---
Finished System.Text.RegularExpressions.Tests, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51

It is worth noting there are lots (1,000+) failures and this output extract is just one example. However, all of them are with the same error.

Regression?

No

Known Workarounds

None, other than keeping the test disabled in tests.proj.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions