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

Document breaking change for #46044 #51070

Merged
merged 3 commits into from
Mar 9, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions docs/compilers/CSharp/Compiler Breaking Changes - DotNet 6.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
## This document lists known breaking changes in Roslyn in C# 9.0 introduced with .NET 6.
Copy link
Member

@Youssef1313 Youssef1313 Feb 8, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


1. https://github.com/dotnet/roslyn/issues/46044 In C# 9.0 (Visual Studio 16.9), a warning is reported when assigning `default` to, or when casting a possibly `null` value to a type parameter type that is not constrained to value types or reference types. To avoid the warning, the type can be annotated with `?`.
Copy link
Member

@jcouv jcouv Feb 9, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In C# 9.0 [](start = 49, length = 9)

I think this warning is now produced even for LangVer=8, right? If so we should just say "In Visual Studio 16.9, ..."

I didn't understand why start a new document. There is no .NET 6 yet (we just shipped .NET 5).
Our file structure got a bit confused. The latest file is DotNet 5 (for 16.8). So we could start a new document for post-DotNet 5. #Resolved

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this warning is now produced even for LangVer=8, right?

No, the warnings are not reported with /langversion:8.

So we could start a new document for post-DotNet 5.

I've renamed the document to "Compiler Breaking Changes - post DotNet 5.md" based on our discussion.


In reply to: 572483433 [](ancestors = 572483433)

```C#
static void F1<T>(object? obj)
{
T t1 = default; // warning CS8600: Converting possible null value to non-nullable type
t1 = (T)obj; // warning CS8600: Converting possible null value to non-nullable type

T? t2 = default; // ok
t2 = (T?)obj; // ok
}
```
12 changes: 12 additions & 0 deletions docs/compilers/CSharp/Compiler Breaking Changes - post VS2019.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,3 +142,15 @@ class C

22. https://github.com/dotnet/roslyn/issues/49596 In *Visual Studio 2019 version 16.9* and greater, conversions from `sbyte` or `short` to `nuint` require explicit casts,
and binary operations with `sbyte` or `short` and `nuint` arguments require explicit casts for one or both operands for `+`, `-`, `*`, `/`, `%`, `<`, `>`, `<=`, `>=`, `==`, `!=`, `|`, `&`, and `^`.

23. https://github.com/dotnet/roslyn/issues/46044 In *Visual Studio 2019 version 16.9* and greater, a warning is reported when assigning `default` to, or when casting a possibly `null` value to a type parameter type that is not constrained to value types or reference types. To avoid the warning, the type can be annotated with `?`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a little bit lost here. The title of this document is:

This document lists known breaking changes in Roslyn in Visual Studio 2019 Update 1 and beyond compared to Visual Studio 2019.

I'm expecting this to be documented in the new file only. Am I missing something?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, it looks like we messed up with some recent breaking changes.
The latest file is https://github.com/dotnet/roslyn/blob/master/docs/compilers/CSharp/Compiler%20Breaking%20Changes%20-%20DotNet%205.md and corresponds to VS 16.8 / .NET 5.
We should probably start a new file for post-.NET 5.

```C#
static void F1<T>(object? obj)
{
T t1 = default; // warning CS8600: Converting possible null value to non-nullable type
t1 = (T)obj; // warning CS8600: Converting possible null value to non-nullable type

T? t2 = default; // ok
t2 = (T?)obj; // ok
}
```