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

Csc task incorrectly forwarding info diagnostics to msbuild logger #30637

m0sa opened this issue Oct 21, 2018 · 2 comments

Csc task incorrectly forwarding info diagnostics to msbuild logger #30637

m0sa opened this issue Oct 21, 2018 · 2 comments


Copy link

@m0sa m0sa commented Oct 21, 2018

Version Used:

Microsoft (R) Visual C# Compiler version (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.

Copy link

@jaredpar jaredpar commented Oct 24, 2018

This behavior is currently "By Design". The compiler doesn't output any informational diagnostics today: on the command line or via MSBuild. This is why they don't show up in the logger.

Why do you believe they should appear here? Note: the set of info diagnostics can change from version to version of the compiler. It's info. That's also part of the reason that we don't expose them. It's meant for host consumption only.

Copy link

@gafter gafter commented Aug 27, 2019

@m0sa Please reopen if you want to follow up here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.