Nullness issue - Unsafe cast requires generic type to be non-null #18275
Labels
Area-Nullness
Issues related to handling of Nullable Reference Types
Bug
Impact-Medium
(Internal MS Team use only) Describes an issue with moderate impact on existing code.
Milestone
Issue description
I suggest that unsafe cast shouldn't impose any restrictions on
'T
, it can be nullable, non-nullable or any other type, it should be fully generic. There is nothing in initial code about nullables, so it's very confusing to user to see such error.The build currently works for me in 9.0.1 SDK, but breaking change is coming according to this ticket https://youtrack.jetbrains.com/issue/RIDER-121095/Non-existing-NRT-related-errors
Choose one or more from the following categories of impact
null
constructs in code not using the checknulls switch.null
,not null
).Operating System
Windows (Default)
What .NET runtime/SDK kind are you seeing the issue on
.NET SDK (.NET Core, .NET 5+)
.NET Runtime/SDK version
.NET SDK 9.0.101
Reproducible code snippet and actual behavior
Possible workarounds
or
The text was updated successfully, but these errors were encountered: