You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using latest omnisharp from the master branch with Visual Studio Code.
When setting nullable warnings as errors - msbuild fails but omnisharp still treats these warnings as warnings instead of errors.
Output from vscode:
Dotnet build:
$ dotnet build
MSBuild version 17.8.5+b5265ef37 for .NET
Determining projects to restore...
Restored test.csproj (in 140 ms).
Program.cs(8,22): error CS8600: Converting null literal or possible null value to non-nullable type. [test.csproj]
Build FAILED.
Program.cs(8,22): error CS8600: Converting null literal or possible null value to non-nullable type. [test.csproj]
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:02.10
Omnisharp should treat nullable warnings as errors when WarningsAsErrors is set to nullable in the project file without adding any extra warnings to WarningsAsErrors to match the behaviour of msbuild.
Thank you for your time, I really appreciate it.
Cheers,
Furai
PS At first I tried to tackle this issue on my own, I've cloned the repository and TBH I got stuck on build process for linux. It seems that base project is kind of outdated. Something should be done about using nuget on linux. Probably the best solution is to move from packages.config to PackageReference and use dotnet restore instead of nuget install. I'm not C# wizard and I know nearly nothing about this project so I'm not sure if this is the best solution. I'm just sharing my thoughts. I hope that's fine.
The text was updated successfully, but these errors were encountered:
What is odd is that we have a test for this scenario, but I am able to reproduce your bug locally. One difference is that the test is targeting net6.0. Changing your repro to net6.0 causes O# to return it as an error. Now to figure out why we are getting warnings when targeting net8.0.
Hey,
I'm creating new issue as requested:
Originally posted by @JoeRobich in #2292 (comment)
I'm using latest omnisharp from the master branch with Visual Studio Code.
When setting
nullable
warnings as errors - msbuild fails but omnisharp still treats these warnings as warnings instead of errors.Output from vscode:
Dotnet build:
If I add
CS8600
toWarnigngsAsErrors
like this:Then it shows up as error as expected:
Minimal reproducible example:
Program.cs
test.csproj
Expected behaviour:
WarningsAsErrors
is set tonullable
in the project file without adding any extra warnings toWarningsAsErrors
to match the behaviour of msbuild.Thank you for your time, I really appreciate it.
Cheers,
Furai
PS At first I tried to tackle this issue on my own, I've cloned the repository and TBH I got stuck on build process for linux. It seems that base project is kind of outdated. Something should be done about using nuget on linux. Probably the best solution is to move from
packages.config
toPackageReference
and usedotnet restore
instead ofnuget install
. I'm not C# wizard and I know nearly nothing about this project so I'm not sure if this is the best solution. I'm just sharing my thoughts. I hope that's fine.The text was updated successfully, but these errors were encountered: