rules_dotnet icon indicating copy to clipboard operation
rules_dotnet copied to clipboard

Build fails with `treat_warnings_as_errors=True` and `warnings_not_as_errors` set

Open djungelorm opened this issue 1 year ago • 0 comments

Using the following options in csharp_nunit_test, the build can still fail with CS1591 errors. I imagine this is true of other rules as well.

csharp_nunit_test(
    ...
    treat_warnings_as_errors = True,
    warning_level = 4,
    warnings_not_as_errors = ["CS1591"],
)

This rule generates the following .params file passed to the C# compiler:

/unsafe-
/checked-
/nostdlib+
/utf8output
/deterministic+
/filealign:512
/nologo
/highentropyva+
/warnaserror-:CS1591
/warnaserror+
/warn:4
/target:exe
/langversion:10.0
/debug-
/optimize+
/define:TRACE;RELEASE
/debug:portable
...

I believe the ordering of the /warnaserror flags in the above is incorrect. It should be:

/warnaserror+
/warnaserror-:CS1591

djungelorm avatar Mar 21 '23 15:03 djungelorm