Uploaded image for project: '[DEPRECATED] SonarVB'
  1. [DEPRECATED] SonarVB
  2. SONARVB-246

Build fails when analyzers report location containing " Error:"

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.0
    • Component/s: None
    • Labels:
      None

      Description

      In summary, it's a known Roslyn issue #5724 _VBC emitting extra console output on warning with " error:"
      _. If the line containing the error contains the string " Error:" then MSBuild will fail. So far it is has only been affected VB rules S103 and S2178.

      Workarounds:

      • disable the affected rules in SonarQube, or
      • reformat the code to not include the string "My Error:" e.g. by concatenating two string together "My " & "Error:"

      Further investigation
      This does not affect the C# analyzers, even though the VB and C# analyzers share common code.
      The underlying issue is in the Roslyn Vbc MSBuild task. This wraps the call to the vbc.exe compiler. The corresponding C# task is Csc which wraps the C# compiler csc.exe. The difference is that Vbc does extra processing of the text output returned by the compiler, writing additional output that MSBuild interprets as being errors.

      I investigated the Microsoft MSBuild targets and tasks and the _vbc.exe _compiler command line to see if there any options we can set to modify the behaviour, but unfortunately there are not.

        Issue Links

          Activity

          Hide
          duncan.pocklington Duncan Pocklington added a comment - - edited

          I don't think there is anything we can realistically do to work round this error in our analyzers. The only thing we could do is not report diagnostics on lines that contain the string " error[\s]:" anywhere in the line.
          There doesn't seem to be a way in the target files/tasks to work round the issue.

          I suggest closing the issue as Won't Fix. The issue isn't specific to the SonarQube VB analyzers (or indeed to any VB analyzer). The build task needs to be fixed by Microsoft.

          Show
          duncan.pocklington Duncan Pocklington added a comment - - edited I don't think there is anything we can realistically do to work round this error in our analyzers. The only thing we could do is not report diagnostics on lines that contain the string " error [\s] :" anywhere in the line. There doesn't seem to be a way in the target files/tasks to work round the issue. I suggest closing the issue as Won't Fix. The issue isn't specific to the SonarQube VB analyzers (or indeed to any VB analyzer). The build task needs to be fixed by Microsoft.
          Hide
          freddy.mallet Freddy Mallet added a comment -

          Agreed Duncan Pocklington, so I'm closing this ticket "Won't Fix"

          Show
          freddy.mallet Freddy Mallet added a comment - Agreed Duncan Pocklington , so I'm closing this ticket "Won't Fix"
          Hide
          amaury.leve Amaury Levé added a comment -

          Any issue will be considered as an error if the line it is reported on (the span doesn't count) contains the following pattern \s+error\s*:.

          After a discussion involving Services team, PMs and .Net Team it was decided to reopen this issue and to provide a mechanism to prevent reporting the issue when the pattern is detected. As part of the fix we should also update the documentation.

          Show
          amaury.leve Amaury Levé added a comment - Any issue will be considered as an error if the line it is reported on (the span doesn't count) contains the following pattern \s+error\s*: . After a discussion involving Services team, PMs and .Net Team it was decided to reopen this issue and to provide a mechanism to prevent reporting the issue when the pattern is detected. As part of the fix we should also update the documentation.
          Hide
          amaury.leve Amaury Levé added a comment - - edited

          The problem was not totally fixed in 4.2. The regex was only partially true.

          Show
          amaury.leve Amaury Levé added a comment - - edited The problem was not totally fixed in 4.2. The regex was only partially true.

            People

            • Assignee:
              amaury.leve Amaury Levé
              Reporter:
              duncan.pocklington Duncan Pocklington
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Due:
                Created:
                Updated:
                Resolved: