Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable C# 8.0 in the code base #33742

Merged
merged 1 commit into from Feb 28, 2019

Conversation

Projects
None yet
3 participants
@jaredpar
Copy link
Member

jaredpar commented Feb 28, 2019

This change enables C# 8.0 use in the code base as well as moving the
recommended Visual Studio version to 2019 Preview 4. The following
features are now allowed to be used:

  • switch expressions
  • recursive pattern matching
  • using declarations
  • static local functions
  • local / parameter shadowing in local functions / lambdas
  • null coalescing assignment
  • async streams: keep this out of our public API surface for now as we
    don't want to block unification with netcoreapp in the future.

Before getting into the features which are off limits I wanted to
outline how compiler toolsets work in this repository. There are three
toolsets we need to consider when adopting new features:

  1. The compiler toolset which provides the IDE experience: Intellisense,
    syntax highlighting, etc ...
  2. The compiler toolset which is used when the solution is built. This
    is explicitly different than the compiler toolset which ships with the
    MSBuild driving the compilation.
  3. The compiler toolset is built from source on every PR and used as the
    toolset for the PR (overriding 2 above).

That being said the following features are offlimit for now:

  • Index / Range: the API surface area, including the parts the compiler
    depends on, underwent significant churn for .NET Core Preview 3. Until
    we converge it means toolsets 1 and 2 can be a bit out of sync.
  • unmanaged generic struct: this is not included in VS2019 Preview 4
    and hence using it would make the IDE experience poor.
  • Nullable Reference Types: this area is under active churn and we could
    easily get into a situation where toolsets 2 and 3 disagreed on code
    checked into the repository creating unmergeable PRs. As such we're
    holding off on this in master for now. Until then please use the branch
    features/NullableDogfood
    to dogfood NRT. This will be merged back into master closer to
    Dev16.0GA.

Note: This change only affects the C# compiler toolset. There are no
changes to our MSBuild or .NET Core SDK toolsets. Those will be coming
soonish though.

Enable C# 8.0 in the code base
This change enables C# 8.0 use in the code base as well as moving the
recommended Visual Studio version to 2019 Preview 4.  The following
features are now allowed to be used:

- `switch` expressions
- recursive pattern matching
- `using` declarations
- `static` local functions
- local / parameter shadowing in local functions / lambdas
- `null` coalescing assignment
- `async` streams: keep this out of our public API surface for now as we
don't want to block unification with netcoreapp in the future.

Before getting into the features which are off limits I wanted to
outline how compiler toolsets work in this repository. There are three
toolsets we need to consider when adopting new features:

1. The compiler toolset which provides the IDE experience: Intellisense,
syntax highlighting, etc ...
1. The compiler toolset which is used when the solution is built. This
is explicitly different than the compiler toolset which ships with the
MSBuild driving the compilation.
1. The compiler toolset is built from source on every PR and used as the
toolset for the PR (overriding 2 above).

That being said the following features are offlimit for now:

- Index / Range: the API surface area, including the parts the compiler
depends on, underwent significant churn for .NET Core Preview 3. Until
we converge it means toolsets 1 and 2 can be a bit out of sync.
- `unmanaged` generic `struct`: this is not included in VS2019 Preview 4
and hence using it would make the IDE experience poor.
- Nullable Reference Types: this area is under active churn and we could
easily get into a situation where toolsets 2 and 3 disagreed on code
checked into the repository creating unmergeable PRs. As such we're
holding off on this in master for now. Until then please use the branch
[features/NullableDogfood](https://github.com/dotnet/roslyn/tree/features/NullableDogfood)
to dogfood NRT. This will be merged back into master closer to
Dev16.0GA.

Note: This change only affects the C# compiler toolset. There are no
changes to our MSBuild or .NET Core SDK toolsets. Those will be coming
soonish though.

@jaredpar jaredpar requested a review from dotnet/roslyn-compiler as a code owner Feb 28, 2019

@jaredpar

This comment has been minimized.

Copy link
Member Author

jaredpar commented Feb 28, 2019


The projects in this repository are configured to build with Portable PDBs, which are supported in stack traces starting with .NET Framework 4.7.2.
If a stack trace is displayed on .NET Framework older than 4.7.2 (e.g. by xUnit when a test fails) it won't contain source and line information.
## Developing with Visual Studio 2019

This comment has been minimized.

@jasonmalinowski

jasonmalinowski Feb 28, 2019

Member

Is this being intentionally silent in saying nothing about 2017? I recognize it's not supported, but the lack of saying anything does say it's not supported.

This comment has been minimized.

@jaredpar

jaredpar Feb 28, 2019

Author Member

When we were working on VS2017 we didn't say anything about VS2015 not being supported. If I have to list all the VS versions that arent' supported it will be rather long.

This comment has been minimized.

@jasonmalinowski

jasonmalinowski Feb 28, 2019

Member

"You must use 2019, everything else is unsupported" is short.

@jcouv jcouv added this to the 16.1.P1 milestone Feb 28, 2019

@jcouv jcouv self-assigned this Feb 28, 2019

@jcouv

jcouv approved these changes Feb 28, 2019

Copy link
Member

jcouv left a comment

LGTM Thanks

@jaredpar jaredpar merged commit 715f26c into dotnet:master Feb 28, 2019

1 check passed

license/cla All CLA requirements met.
Details

@jaredpar jaredpar deleted the jaredpar:fix-toolset branch Feb 28, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.