-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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. | ||
|
||
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 `?`. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
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). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
No, the warnings are not reported with
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 | ||
} | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 `?`. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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:
I'm expecting this to be documented in the new file only. Am I missing something? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indeed, it looks like we messed up with some recent breaking changes. |
||
```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 | ||
} | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding a link for this document in https://github.com/dotnet/docs/blob/main/docs/csharp/whats-new/breaking-changes.md.