Roslyn: NullableContextOptions no longer works

Created on 23 May 2019  路  3Comments  路  Source: dotnet/roslyn

_This issue has been moved from VSTS ticketId 896657._

In our .csproj files, this used to enable nullable context:

<NullableContextOptions>enable</NullableContextOptions>

Now, after upgrading to 16.2 preview 1, it no longer works. The compiler throws errors as if we were not in a nullable context. Surrounding code with #nullable enable/restore still works, but it's not feasible to do it for each and every code file in our solution.


Original comments

Pierre Arnaud on 5/22/2019, 05:59 PM

I've the exact same issue on all my projects.

Visual Studio Feedback System on 5/22/2019, 06:02 PM

We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.

Kexy Biscuit on 5/22/2019, 07:14 PM

Me too, this breaks nearly everything for me.

richf on 5/22/2019, 10:04 PM

Same problem.

Building from commandline does not have any issue

Anthony Trudeau on 5/23/2019, 08:20 AM

@VisualStudio on Twitter directed me to share my comments here after some messages there.

I'm on 16.1 within a new WPF project and using the element in the project file has no affect. There are no errors, warnings, or otherwise. Using the directive in the individual code files works as expected.

Area-Compilers New Language Feature - Nullable Reference Types

Most helpful comment

I took a pass over the top Stack Overflow posts and edited/answered/commented with this updated info.

All 3 comments

As of ~16.1~16.2, the property was renamed to Nullable. This name is simpler and aligns with the command-line flag.
I'll broadcast on Twitter and check StackOverflow for the inevitable question. Sorry for the inconvenience.

PR https://github.com/dotnet/roslyn/pull/35516

I took a pass over the top Stack Overflow posts and edited/answered/commented with this updated info.

Correction, the change to <Nullable> was in 16.2p1 (not in 16.1). Sorry for the confusion

Was this page helpful?
0 / 5 - 0 ratings