Skip to content
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

Is there a way to mute NU1603? #5913

Closed
forki opened this issue Sep 21, 2017 · 17 comments
Closed

Is there a way to mute NU1603? #5913

forki opened this issue Sep 21, 2017 · 17 comments
Labels
Area:ErrorHandling warnings and errors/log messages & related error codes.

Comments

@forki
Copy link

forki commented Sep 21, 2017

On Windows (I haven't tested this on macOS or Linux)

  1. Install .NET Core 2.0.2

  2. Clone fable-suave-scaffold

  3. Instal Node LTS and Yarn latest

  4. Run build.cmd

Expected behaviour

No NU1603 since paket controls the dependencies

Actual behaviour

image

@emgarten
Copy link
Member

emgarten commented Sep 21, 2017

@forki
Copy link
Author

forki commented Sep 21, 2017

is that something we can set in nuget.config? Or ar least when we add PackageReferences in memory?

@emgarten
Copy link
Member

@forki
Copy link
Author

forki commented Sep 21, 2017

ok but setting it in Paket.Restore.targets should work as well, right?

@emgarten
Copy link
Member

Should work if you can set it before it is read. Let me know if it doesn't and we can find a different way.

@forki
Copy link
Author

forki commented Sep 21, 2017

image

urgs. now other tools (in this case F# compiler) complain about that

/cc @dsyme @KevinRansom @cartermp

forki added a commit to fsprojects/Paket that referenced this issue Sep 21, 2017
@emgarten
Copy link
Member

Gah! Seems like we should test these on all project types going forward.

The design for this was to use the exact same fields as the compiler so that users could add these through the project properties window.

@forki
Copy link
Author

forki commented Sep 21, 2017

ok reverting that for now. We need another solution. If people are using warnaserror in F# then things will crash.

forki added a commit to fsprojects/Paket that referenced this issue Sep 21, 2017
@emgarten
Copy link
Member

Alternatively you could set HideWarningsAndErrors to true and then replay them after restore from project.assets.json with filtering. It would be much more work than just setting nowarn however.

@forki
Copy link
Author

forki commented Sep 21, 2017

O_o

@forki
Copy link
Author

forki commented Sep 21, 2017

sorry, what I meant is: NuGet's current approach is not working with F# and that has nothing to do with paket. If you set the NoWarn in the project then the compiler will scream at you.

@mishra14
Copy link
Contributor

Closing this issue in the favor of dotnet/fsharp#3626.

Please feel free to reopen this if you feel otherwise.

@forki
Copy link
Author

forki commented Sep 22, 2017 via email

@rrelyea
Copy link
Contributor

rrelyea commented Sep 22, 2017

@forki - Hear ya. We should have communicated with more compilers than we did during 15.3. Sorry that we didn't.

@KevinRansom
Copy link

KevinRansom commented Sep 22, 2017

@rrelyea
I believe this design makes use of a bug in the C# compiler. It ignores anything it doesn't understand ... and it only understands numeric values. I doubt if the bug will ever get fixed though.

You should consider changing the name of the msbuild property from NoWarn to NugetNoWarn or NoWarnNuget.

Kevin

The C# bug:

namespace ConsoleApp10 {
    class Program {
        static void Main(string[] args) {
            int x = 7;
        }
    }
}

csc Program.cs

Microsoft (R) Visual C# Compiler version 2.3.2.62019 (b7354608)
Copyright (C) Microsoft Corporation. All rights reserved.

Program.cs(13,17): warning CS0219: The variable 'x' is assigned but its value is never used

csc Program.cs /nowarn:0219

Microsoft (R) Visual C# Compiler version 2.3.2.62019 (b7354608)
Copyright (C) Microsoft Corporation. All rights reserved.

now this:
csc Program.cs /nowarn:cs0219

Microsoft (R) Visual C# Compiler version 2.3.2.62019 (b7354608)
Copyright (C) Microsoft Corporation. All rights reserved.

Program.cs(13,17): warning CS0219: The variable 'x' is assigned but its value is never used

C# ignores any non numeric value including cs0219. It is a C# bug, and it is very likely it won't get fixed.

@mishra14
Copy link
Contributor

mishra14 commented Sep 22, 2017

@KevinRansom Thanks for the detailed response.

I have one correction - /nowarn:CS0219 works as expected -

F:\validation\test\addpkg>csc Program.cs  /nowarn:CS0219
Microsoft (R) Visual C# Compiler version 2.4.0.62025 (a0507c1e)
Copyright (C) Microsoft Corporation. All rights reserved.


F:\validation\test\addpkg>csc Program.cs  /nowarn:cs0219
Microsoft (R) Visual C# Compiler version 2.4.0.62025 (a0507c1e)
Copyright (C) Microsoft Corporation. All rights reserved.

Program.cs(9,17): warning CS0219: The variable 'x' is assigned but its value is never used

F:\validation\test\addpkg>

Note that it is case sensitive, so cs0219 is not the same as CS0219.

@KevinRansom
Copy link

KevinRansom commented Sep 23, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area:ErrorHandling warnings and errors/log messages & related error codes.
Projects
None yet
Development

No branches or pull requests

5 participants