BinLogReader does not recognize Csc's Info-level messages · Issue #930 · KirillOsenkov/MSBuildStructuredLog · GitHub
Skip to content

BinLogReader does not recognize Csc's Info-level messages #930

Open

Description

@daiplusplus

I'm writing a quick-and-dirty Linqpad script that uses BinLogReader to dump all C# and SSDT compiler messages from a .binlog to a CSV file such that the CSV file should contain exactly the same content as Visual Studio's Errors List (so Errors, Warnings, and Infos).

The problem is that "Info"-level warnings from csc are being treated by BinLogReader the exact same as any other stdout output from csc: they're not being parsed as BuildWarningEventArgs (i.e. with .Code and .File properties correctly set),, but kept as BuildMessageEventArgs with all empty properties, while their .Message property contains the raw packed string, which I really don't want to have to try to match/parse myself.

Currently I'm somewhat able to workaround this by relying on the .SenderName property being "Csc", but relying on that means I also get other csc stdout text like the "Microsoft (R) Visual C# Compiler version 4.12.0-3.25076.6 (449a6208)" messages, which I want to filter-out, but as far as BinLogReader is concerned they're all just plain ol' stdout text.

The other problem is that it's not just Csc in my MSBuild script: my SLN also includes SSDT projects (.sqlproj) which also generates warnings which also seem to be parsed inconsistently (...by both BinLogReader and Visual Studio itself: sometimes VS' Error List shows my SSDT warnings with everything in the Message column while all other columns (like Code, File, Project, etc) are all empty.


Here's a screenshot of what my CSV looks like in Excel (after converting it to a Table):

Image

In the screenshot above, I've selected the bottom few rows (in the dark grey) to indicate which are the "Info CS9236" messages, in contrast to the rest of the messages which were correctly parsed as BuildWarningEventArgs with their .Code and .File properties set.


This means the behaviour is also seen in the MSBuild Binlog Viewer itself too:

(With my apologies for the atrocious MSPaint redaction job)

Image

In the above screenshot, the csc.exe Warning messages are correctly identified with the yellow icons, but the Info-level messages are kept together with ordinary stdout text, just like in my CSV above.

Activity

  1. KirillOsenkov commented on Feb 21, 2026

    @KirillOsenkov
    Owner

    From what I can see there are only two cases in Roslyn that emit messages: ErrorCode.INF_UnableToLoadSomeTypesInAnalyzer and ErrorCode.INF_TooManyBoundLambdas (yours).

    When Roslyn logs the message, they don't give us any structure like they do for warnings or errors.

    We just receive a BuildMessageEventArgs where these fields are not set, and all the info is in the message string:

    Image

    Unfortunately I don't have better ideas than to use a Regex to parse these out.

  2. daiplusplus commented on Feb 24, 2026

    @daiplusplus
    Author

    Forgive my ignorance, but how are all of the other Info-level messages reported by (or to) the build system?

  3. KirillOsenkov commented on Feb 24, 2026

    @KirillOsenkov
    Owner

    I'm not quite sure myself, I'd have to go look that up. But whatever it is, it is not a binlog viewer problem. I'd say the Roslyn Csc task needs to log informational messages with preserving file, line, column and error code info. I could go track it down but unfortunately I'm too busy and this is outside the scope.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions