You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Jens Geyer (Jira)" <ji...@apache.org> on 2022/02/07 18:53:00 UTC

[jira] [Commented] (THRIFT-5511) Full support for the new net6 "nullability" semantics

    [ https://issues.apache.org/jira/browse/THRIFT-5511?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17488354#comment-17488354 ] 

Jens Geyer commented on THRIFT-5511:
------------------------------------

 * old behaviour like before (only change is THashSet deprecation)
 * new behaviour is enabled with the "net6" switch:  `thrift  -gen netstd:net6   ...`

Be aware that **enabling this opt-in feature is a breaking change** and will cause some work with existing codebases - that's why it is opt-in. If you leave the switch off, nothing really changes = compatibility case.

Recommended readings:
 * https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/attributes/nullable-analysis


> Full support for the new net6 "nullability" semantics 
> ------------------------------------------------------
>
>                 Key: THRIFT-5511
>                 URL: https://issues.apache.org/jira/browse/THRIFT-5511
>             Project: Thrift
>          Issue Type: Improvement
>          Components: netstd - Compiler
>    Affects Versions: 0.16.0
>         Environment: [net6 / C# 10|https://stackoverflow.com/a/247623/499466]
>            Reporter: Jens Geyer
>            Assignee: Jens Geyer
>            Priority: Major
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> This is sort of an follow-up to THRIFT-5479.
> The initially chosen solution was to [add an {{<autogenerate>}} tag |https://docs.microsoft.com/en-us/dotnet/csharp/nullable-references#nullable-contexts]to each generated C# source file, because otherwise the analysis would drop a whole lot of messages onto the user. One major reason behind this design was that it does not break compatibility.
> It turned out that that actually may do more harm than good, because of [this issue|https://github.com/dotnet/roslyn/issues/44063#issuecomment-788307265], which has a really great potential to lead the developer into a false security, believing what the IDE tells, that values in some cases are not null - but what it really should say is "{_}I did not analyze this code so I cannot safely tell anything{_}".
> Hence, we should have better support for it.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)