Skip to content

Simplify compiler messages content #24002

Open

Description

@BillWagner

There are several large issues in the content that covers C# Compiler messages.

  1. Many errors and warnings are not documented. (More than 700 have already been identified here).
  2. There are 623 individual articles that do cover existing errors and warnings. That many different warnings and errors make this content hard to navigate.
  3. The purpose of these articles is to help developers modify their code so it compiles without errors or warnings. That makes this content rather important: developers are effectively blocked when they reach these pages.

Can we reorganize this material around types of errors and warnings into a (somewhat) smaller set of articles that help developers diagnose and fix related issues in their code?

A good starting point is to look at the organization in the C# Error codes in the dotnet/roslyn repository. For newer versions (starting with C# 5), the first digit of the code indicates the version when the error or warning was introduced. Further, those messages are often organized by feature:

  • C# 5 warnings are in the range 4000-4999

  • C# 6 is in the range 5000-5999, 7000-7999 and 8000-8106

  • C# 7 is in the range 8107-8210 and are organized by feature.

  • C# 7.1 is in the range 8300-8315

  • C# 7.2 is in the range 8320-8364 and are organized by feature.

  • C# 7.3 is in 8370-8389

  • C# 8 is in 8400-8750, and organized by feature

  • C# 9 is in the range 8751-8911

  • C# 10 (in progress) starts at 8912

  • C# 5 warnings and errors are almost all about async and await.

  • C# 6 is a mixture of errors and warnings for the features introduced in that version. These could be organized by feature.

  • Errors and warnings for features added after 6 are generally organized by feature. This provides a potential roadmap for a new organization for pages organized around each feature.

One major concern to this plan is how to organize articles for errors and warnings introduced before C# 5. When I scanned the list, two groups stand out: LINQ and dynamic. I can spot some related to generics or partial methods, they aren't groups that way.

Before beginning these changes we need to create a full plan for which errors and warnings would be included in each new article.

Proposed article format

If the concern can be addressed, I propose organizing each article on the following outline:

  • Feature or Subsystem area
    • Table of errors, including code and message
    • A few examples of the correct syntax and uses for the features
    • Links to relevant language reference articles
    • Links to relevant C# spec sections

SEO Concerns

The existing articles have been optimized for each error code and message. The title, H1, and description all include the error and message. Those techniques raise these articles visibility in search for the error code. That may be hard to replicate in a more simplified presentation. Possible actions:

  • F1 keywords will help developers using Visual Studio.
  • The table of errors and messages should help as well.
  • Redirection from existing content should help inherit some of the search rank.

More work here should be done before we begin. If we follow this plan, the new pages should rank in the first page for any relevant compiler error or warning code.


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Activity

  1. Youssef1313 commented on May 1, 2021

    @Youssef1313
    Member

    For newer versions (starting with C# 5), the first digit of the code corresponds to the version when the error or warning was introduced.

    I don't think this is correct. C# 9 error messages are all starting with 8, and C# 6 have errors starting with both 7 and 8.

  2. Youssef1313 commented on May 1, 2021

    @Youssef1313
    Member

    Some concerns/questions:

    • Should pre-Roslyn compiler messages be documented? (i.e, diagnostics from the native compiler that are no longer used in Roslyn) - There was a discussion about that in the past that they should be documented. Is that still true? The native compiler is before Visual Studio 2015.
    • Are there any internal analysis for F1 service available for you? This may give some insight about what are the most non-documented codes being visited from Visual Studio.

    In general, I like the idea of grouping the messages by version & feature. I think I can write a tool that generates the markdown files with initial dummy content (metadata, headings including ID + message text, etc.), this can get us to start grouping those "dummy" pages and see how things can go before writing the actual content.


    The existing articles have been optimized for each error code and message. The title, H1, and description all include the error and message. Those techniques raise these articles visibility in search for the error code. That may be hard to replicate in a more simplified presentation.

    Instead of grouping multiple compiler messages per article, we could also group them by folders - which would preserve the existing structure (i.e, every compiler message has a separate page)

  3. Youssef1313 commented on May 2, 2021

    @Youssef1313
    Member

    Initial thoughts:

    compiler-messages
    ├── warnings [[TOTAL: 262]]
    │   ├── level-1 (173 warnings total)
    │   ├──├── caller-info-warnings
    │   ├──├── doc-comment-warnings
    │   ├──├── dead-code-warnings
    │   ├──├── nullability-warnings
    │   ├──├── cls-warnings
    │   ├──└── misc-warnings
    │   ├── level-2 (41 warnings total)
    │   ├──├── doc-comment-warnings
    │   ├──├── dead-code-warnings
    │   ├──└── misc-warnings
    │   ├── level-3 (24 warnings total)
    │   ├──├── equality-warnings
    │   ├──└── misc-warnings
    │   ├── level-4 (10 warnings total)
    │   ├──└── one page
    │   └── level-5 (14 warnings total)
    │       └── one or two page (mostly about unassigned members?)
    └── errors
        └── Haven't put much thought yet.
    
  4. BillWagner commented on May 3, 2021

    @BillWagner
    MemberAuthor

    @Youssef1313

    I don't think this is correct. C# 9 error messages are all starting with 8, and C# 6 have errors starting with both 7 and 8.

    Thank you. Edited in the description above.

  5. BillWagner commented on May 3, 2021

    @BillWagner
    MemberAuthor

    @Youssef1313

    Should pre-Roslyn compiler messages be documented?

    I'm investigating if we can archive these articles. I'll add a comment once I've done that.

    Are there any internal analysis for F1 service available for you?

    I'm looking for this data now.

    I think I can write a tool that generates the markdown files with initial dummy content (metadata, headings including ID + message text, etc.), this can get us to start grouping those "dummy" pages and see how things can go before writing the actual content.

    This would be a huge help. I'd like to get farther on a possible organization first.

    Instead of grouping multiple compiler messages per article, we could also group them by folders - which would preserve the existing structure (i.e, every compiler message has a separate page)

    This is the most important decision point. And, it may not be all one or the other. Maybe there are some natural groupings we discover, and some errors are on their own page. For the time being, let's keep considering organization around errors and warnings.

  6. BillWagner commented on May 3, 2021

    @BillWagner
    MemberAuthor

    Initial thoughts:

    I like the direction. As we fill in errors, I think we'll have more context for refinement.

  7. BenjaminMichaelis commented on May 4, 2021

    @BenjaminMichaelis
    Contributor

    More discussion at #23032

  8. added
    discussion
    and removed
    ⌚ Not Triaged
    on May 4, 2021
  9. dtdimi commented on Sep 27, 2023

    @dtdimi
    Contributor

    @BillWagner
    Hi Bill,
    was just reading through the issue and noticed that a year ago inputs stopped with the state "open" ...
    Out of curiosity - what's the status now ---

    • finished/implemented/partly implemented
    • if work already done => is there a separate branch

    ???
    Any guidance/tips from your side are highly appreciated!

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

    discussiondotnet-csharp/svcerrors-warnings/subsvc

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions