Skip to content

Request: Tweak the ILC error output to improve diagnosability #118788

Description

@jevansaks

When turning on ILC's detailed error output (TrimmerSingleWarn=false), we get an output line per IL error which is great. But there's two tweaks I'd like to request:

  1. Format the error output to align with MSBuild's error output.

Our build system filters output to errors of a particular format. It looks for almost all of the formats in https://learn.microsoft.com/en-us/visualstudio/msbuild/msbuild-diagnostic-format-for-tasks?view=vs-2022, but it expects the (line) or (line,col) for the origin. Thus, my request is that the IL errors be formatted not like:

ILC error IL1005: ...

But instead like:

ILC(0): error IL1005: ...

  1. Provide the originating assembly for errors like IL1005

When we get IL1005 the message is only the originating namespace and method, but not the assembly. Especially in cases like C#/WinRT which generate source into your assembly in the same namespace, this leaves me hunting around for which assembly is having the problem. E.g.:

ILC error IL1005: WinRT.AuthoringMetadataTypeInitializer.GetMetadataTypeMapping(Type): Method will always throw because: Failed to load type 'X' from assembly 'Y'

If we could just add the originating assembly here, that would help a lot:

ILC error IL1005: AssemblyZZZ!WinRT.AuthoringMetadataTypeInitializer.GetMetadataTypeMapping(Type): Method will always throw because: Failed to load type 'X' from assembly 'Y'

Activity

  1. added
    needs-area-label
    on Aug 15, 2025
  2. added
    untriaged
    on Aug 15, 2025
  3. added and removed
    needs-area-label
    on Aug 15, 2025
  4. dotnet-policy-service commented on Aug 15, 2025

    @dotnet-policy-service
    Contributor

    Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas
    See info in area-owners.md if you want to be subscribed.

  5. jkotas commented on Aug 15, 2025

    @jkotas
    Member

    ILC(0)

    (0) looks weird. There are many error messages produced by established tools for Windows that do not have the line numbers. For example, link test.obj produces LINK : fatal error LNK1181: cannot open input file 'test.obj'. Can we use formatting like that?

  6. jevansaks commented on Aug 15, 2025

    @jevansaks
    Author

    Yes, it looks like if there's a space after the tool name that will work, so could we do:

    ILC : error IL1005: AssemblyZZZ!WinRT.AuthoringMetadataTypeInitializer.GetMetadataTypeMapping(Type): Method will always throw because: Failed to load type 'X' from assembly 'Y'
    
  7. added a commit that references this issue on Aug 15, 2025
    04dc072
  8. added this to the 11.0.0 milestone on Aug 20, 2025
  9. removed
    untriaged
    on Aug 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    • Status
      No status

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions