Skip to content

Csc task incorrectly forwarding info diagnostics to msbuild logger #30637

@m0sa

Description

@m0sa

Version Used:

Microsoft (R) Visual C# Compiler version 2.9.0.63208 (958f235)
Copyright (C) Microsoft Corporation. All rights reserved.

Steps to Reproduce:

  1. Create an arbitrary csproj with an analyzer that output at least one Info level diagnostic
  2. Create a custom ILogger implementation that handles the IEventSource.MessageRaised event
  3. Attach it to an msbuild execution, e.g. msbuild Project1.csproj /logger:ILogger.dll

Expected Behavior:
The ILogger gets a structured BuildMessageEventArgs, containing the parsed:

  • BuildMessageEventArgs.Code = "INFO"
  • BuildMessageEventArgs.File
  • BuildMessageEventArgs.LineNumber
  • BuildMessageEventArgs.ColumnNumber
  • BuildMessageEventArgs.Message

Actual Behavior:

The BuildMessageEventArgs.Message contains the full line in the cannonical msbuild format.


The issue here is that Log.LogMessageFromText and CannonicalError only handle errors and warnings. I'm raising this issue here, since MSBuild has no notion of DiagnosticSeverity.Info.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions