dotnet / dotnet/roslyn

Move CreateCompilation to target NetLatest by default

Open
#78,239 0 comments 1 reaction 0 assignees View on GitHub
Area-Compilers
Dominant language
C#
Stars
20.7k
Forks
4.3k
PR merge metrics
PR metrics pending

Description

The core unit test helper for the compiler is `CreateCompilation`. It is the basis of virtually all of our unit testing and is meant as a simple API for compiling and executing code samples. To support execution on both .NET Core and .NET Framework (as our unit tests work on both) the implicit reference set changes based on which platform we are executing on. For historical reasons though the implicit reference set when executing on .NET Core is `netstandard2.0`. That means the majority of our unit tests effectively never compile against .NET Core reference sets. That means the tests are not representative of user scenarios and they do not evolve as the repository moves to new TFMs.

This issue tracks changing the default for `CreateCompilation` to be `NetLatest`. That provides the latest TFM for both .NET Framework or .NET Core based on the runtime executing the tests.

The steps here are:

- [ ] Create the infra for `NetLatest` to be the default but have a fall back to make it custom per test assembly
- [ ] Port assembly by assembly to the new default
- [ ] Rename the helpers so `Standard` becomes `Legacy` as that is no longer our preferred test setup
- [ ] Remove `CreateCompilationWithCSharp`
- [ ] Remove `CreateCompilationWithMscorlibAndSpan`
- [ ] Remove ` CreateCompilationWithMscorlibAndSpanSrc`
- [ ] Find and delete all references to https://github.com/dotnet/roslyn/issues/78238

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.