roslyn: Incorrect error codes reported

Version Used:

I’m updating Windows Forms SDK/toolset from P6 to RC1, and our builds fail with errors which we have already suppressed. E.g.: image

It appears instead of CS0618 we must now be suppressing SYSLIB0011 but I had to spend time to figure it out on my own. Likewise we have other failures, e.g. image …and only VS is telling me that I now need to suppress a different one: image

Few builds:

Steps to Reproduce:

  1. Clone this commit: https://github.com/dotnet/winforms/commit/2427ee0140db52050535e9459384e6527610720d
  2. Run .\build.cmd
  3. Observe multiple failures

Expected Behavior:

Errors must either correctly report codes or use the existing suppression rules.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 25 (25 by maintainers)

Most upvoted comments

/+warnaserror seems to be the problem. The minimal repro project https://github.com/dotnet/roslyn/issues/47736#issuecomment-693708428 gives an unexpected error CS0618 when either <WarningsAsErrors>SYSLIB0011</WarningsAsErrors> is specified or <TreatWarningsAsErrors>true</TreatWarningsAsErrors> is specified.

Thanks to @jmarolf for helping me track this down. I suppose this bug didn’t have the chance to negatively impact more people since corefx didn’t add custom diagnostic IDs until recently.

One thing I totally forgot to mention (sorry), to start Windows Forms solution in VS you need to run:

restore.cmd
start-vs.cmd

This will restore the necessary dependencies and set env vars for VS.