Version Used: Multiple, see below
Steps to Reproduce:
Create a new library project:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
</Project>
Edit Class1.cs (or create a new file):
class BugDemo
{
static ref int Valid70(bool condition, ref int x, ref int y)
{
if (condition)
{
return ref x;
}
else
{
return ref y;
}
}
static ref int Invalid70(bool condition, ref int x, ref int y)
{
return ref condition ? ref x : ref y;
}
}
Build on the 2.0.0 SDK and 2.1.4 SDK.
(I happened to use 2.0.0 in Bash under WSL and 2.1.4 on Windows 10; I don't expect that to make any difference.)
Expected Behavior:
Shouldn't build on either, without LangVersion being explicitly set.
Actual Behavior:
Build with a 2.0 SDK (so C # 7.0): Invalid70 fails to compile (several issues on the return statement).
Build with a 2.1.4 SDK (so C# 7.2): Builds fine
Reasoning
Perhaps the fix to the conditional operator is regarded as a bugfix - but it means that a project which is intended to only require C# 7.0 will build on some machines but not others.
cc @BillWagner, who I discovered this with.
Version Used: Multiple, see below
Steps to Reproduce:
Create a new library project:
Edit
Class1.cs(or create a new file):Build on the 2.0.0 SDK and 2.1.4 SDK.
(I happened to use 2.0.0 in Bash under WSL and 2.1.4 on Windows 10; I don't expect that to make any difference.)
Expected Behavior:
Shouldn't build on either, without
LangVersionbeing explicitly set.Actual Behavior:
Build with a 2.0 SDK (so C # 7.0):
Invalid70fails to compile (several issues on the return statement).Build with a 2.1.4 SDK (so C# 7.2): Builds fine
Reasoning
Perhaps the fix to the conditional operator is regarded as a bugfix - but it means that a project which is intended to only require C# 7.0 will build on some machines but not others.
cc @BillWagner, who I discovered this with.