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

Closed
m0sa opened this issue Oct 21, 2018 · 3 comments
Closed

Csc task incorrectly forwarding info diagnostics to msbuild logger #30637

m0sa opened this issue Oct 21, 2018 · 3 comments
Labels
Area-Compilers Need More Info The issue needs more information to proceed. Resolution-Answered The question has been answered

Comments

@m0sa
Copy link

m0sa commented Oct 21, 2018

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.

@jaredpar
Copy link
Member

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.

@jaredpar jaredpar added Area-Compilers Need More Info The issue needs more information to proceed. labels Oct 24, 2018
@gafter
Copy link
Member

gafter commented Aug 27, 2019

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

@gafter gafter closed this as completed Aug 27, 2019
@gafter gafter added the Resolution-Answered The question has been answered label Aug 27, 2019
@AxelHu
Copy link

AxelHu commented Jan 15, 2021

Now source generator is available as a new feature in .net 5, anyway for me to show non error/warning message in the output?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Compilers Need More Info The issue needs more information to proceed. Resolution-Answered The question has been answered
Projects
None yet
Development

No branches or pull requests

4 participants