Skip to content

Commit 200895f

Browse files
BillWagnerCopilot
andauthored
Add new compiler errors for #: and consolidate all existing preprocessor errors (#48947)
* Create skeleton * Consolidate all existing errors Consolidate existing errors and warnings related to preprocessor directives into this one file. * Add additional files I had copilot search for additional files that I had missed earlier in the appropriate folders. These are the ones it found. * Found a few more files searching In step 3, use the source from roslyn to find any additional errors and warnings that haven't been covered. * Combine related errors Create combined sections for related errors and warnings. Provide links to relevant language-reference articles. * build issues * proofread * Apply suggestions from code review Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: Copilot <[email protected]>
1 parent c9a8e03 commit 200895f

29 files changed

+576
-745
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Copilot prompts to consolidate error codes.
2+
3+
## Add a single existing file into the new consolidated article.
4+
5+
Add the contents of cs1027.md to the preprocessor-errors.md file, sort that file by 'source_path_from_root'. Add a redirection for cs1027.md to point to preprocessor-errors.md, add "cs1027: to the list of display names in the TOC for preprocessor-errors.md. Finally, delete cs1027.md
6+
7+
## Search for other related articles that may be missed.
8+
9+
Search all files in the docs/csharp/language-reference/compiler-messages and the docs/csharp/misc folder for any other errors and warnings that involve preprocessor tokens. Give me a list to review for possible additional consolidation.
10+
11+
## Final search in roslyn source
12+
13+
To make sure you've found all related errors, we'll check the source. Look in `CSharpResources.resx` for any elements where the `<value>` element is a message related to preprocessor tokens. The symbolic constant for that value is in the `name` attribute on the parent `data` element. Find that value in `ErrorCodes.cs`. It will map to the compiler error code, where the code is "CS" followed by the number as a four digit number. Build a list of any not already added to preprocessor-errors.md
14+
15+
## Build consolidated sections
16+
17+
Examine the highlighted section. Other H2s with similar themes should be combined in a similar format. The recommendations to fix the errors should point to language reference articles that explain the impacted syntax.
18+
19+
To do that, make a new H2 section for the theme. Remove all the H2s for the individual error codes that are part of that theme. Where applicable, the new H2 can include text or examples from the H2s you remove.
20+
21+
The list of errors at the top of the file should remain in numerical order, so it's easy for readers to scan. Each impacted error code should now have a link to the anchor tag for the new section. Repeat the list in the new section, but without the anchors, as shown in the highlighted text.
22+
23+
Start with CS1024 and other errors that indicate "Not a valid preprocessor directive"

.openpublishing.redirection.csharp.json

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,10 @@
363363
"source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs1683.md",
364364
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/assembly-references"
365365
},
366+
{
367+
"source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs1691.md",
368+
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors"
369+
},
366370
{
367371
"source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs0270.md",
368372
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/array-declaration-errors"
@@ -1834,6 +1838,70 @@
18341838
"source_path_from_root": "/docs/csharp/misc/cs1020.md",
18351839
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/overload-resolution"
18361840
},
1841+
{
1842+
"source_path_from_root": "/docs/csharp/misc/cs1024.md",
1843+
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors"
1844+
},
1845+
{
1846+
"source_path_from_root": "/docs/csharp/misc/cs1025.md",
1847+
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors"
1848+
},
1849+
{
1850+
"source_path_from_root": "/docs/csharp/misc/cs1027.md",
1851+
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors"
1852+
},
1853+
{
1854+
"source_path_from_root": "/docs/csharp/misc/cs1028.md",
1855+
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors"
1856+
},
1857+
{
1858+
"source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs1029.md",
1859+
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors"
1860+
},
1861+
{
1862+
"source_path_from_root": "/docs/csharp/misc/cs1030.md",
1863+
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors"
1864+
},
1865+
{
1866+
"source_path_from_root": "/docs/csharp/misc/cs1032.md",
1867+
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors"
1868+
},
1869+
{
1870+
"source_path_from_root": "/docs/csharp/misc/cs1038.md",
1871+
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors"
1872+
},
1873+
{
1874+
"source_path_from_root": "/docs/csharp/misc/cs1040.md",
1875+
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors"
1876+
},
1877+
{
1878+
"source_path_from_root": "/docs/csharp/misc/cs1517.md",
1879+
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors"
1880+
},
1881+
{
1882+
"source_path_from_root": "/docs/csharp/misc/cs1560.md",
1883+
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors"
1884+
},
1885+
{
1886+
"source_path_from_root": "/docs/csharp/misc/cs1576.md",
1887+
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors"
1888+
},
1889+
{
1890+
"source_path_from_root": "/docs/csharp/misc/cs1578.md",
1891+
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors"
1892+
},
1893+
{
1894+
"source_path_from_root": "/docs/csharp/misc/cs1633.md",
1895+
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors"
1896+
},
1897+
{
1898+
"source_path_from_root": "/docs/csharp/misc/cs1634.md",
1899+
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors"
1900+
},
1901+
{
1902+
"source_path_from_root": "/docs/csharp/misc/cs1635.md",
1903+
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors"
1904+
},
18371905
{
18381906
"source_path_from_root": "/docs/csharp/misc/cs1100.md",
18391907
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/extension-declarations"
@@ -1994,10 +2062,30 @@
19942062
"source_path_from_root": "/docs/csharp/misc/cs1686.md",
19952063
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/lambda-expression-errors#syntax-limitations-in-lambda-expressions"
19962064
},
2065+
{
2066+
"source_path_from_root": "/docs/csharp/misc/cs1692.md",
2067+
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors"
2068+
},
2069+
{
2070+
"source_path_from_root": "/docs/csharp/misc/cs1694.md",
2071+
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors"
2072+
},
2073+
{
2074+
"source_path_from_root": "/docs/csharp/misc/cs1695.md",
2075+
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors"
2076+
},
2077+
{
2078+
"source_path_from_root": "/docs/csharp/misc/cs1696.md",
2079+
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors"
2080+
},
19972081
{
19982082
"source_path_from_root": "/docs/csharp/misc/cs1706.md",
19992083
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/lambda-expression-errors#syntax-limitations-in-lambda-expressions"
20002084
},
2085+
{
2086+
"source_path_from_root": "/docs/csharp/misc/cs1709.md",
2087+
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/preprocessor-errors"
2088+
},
20012089
{
20022090
"source_path_from_root": "/docs/csharp/misc/cs1714.md",
20032091
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/assembly-references"

docs/csharp/language-reference/compiler-messages/cs1029.md

Lines changed: 0 additions & 34 deletions
This file was deleted.

docs/csharp/language-reference/compiler-messages/cs1691.md

Lines changed: 0 additions & 38 deletions
This file was deleted.

docs/csharp/language-reference/compiler-messages/nullable-warnings.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ helpviewer_keywords:
9898
- "CS8634"
9999
- "CS8636"
100100
- "CS8637"
101+
- "CS8668"
101102
- "CS8639"
102103
- "CS8643"
103104
- "CS8644"
@@ -214,6 +215,7 @@ The following warnings indicate that you haven't set the nullable context correc
214215
- **CS8632** - *The annotation for nullable reference types should only be used in code within a `#nullable` annotations context.*
215216
- **CS8636** - *Invalid option for `/nullable`; must be `disable`, `enable`, `warnings` or `annotations`*
216217
- **CS8637** - *Expected `enable`, `disable`, or `restore`*
218+
- **CS8668** - *Expected `warnings`, `annotations`, or end of directive*
217219

218220
To set the nullable context correctly, you have two options:
219221

0 commit comments

Comments
 (0)