Skip to content

Commit ab40693

Browse files
committed
Create skeleton
1 parent 3e029ce commit ab40693

File tree

3 files changed

+41
-6
lines changed

3 files changed

+41
-6
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
title: Errors and warnings generated by the C# preprocessor
3+
description: Learn how to diagnose and fix errors related to preprocessor tokens how they are used in C# source files.
4+
f1_keywords:
5+
- "CS9297"
6+
- "CS9298"
7+
- "CS9299"
8+
- "CS9314"
9+
helpviewer_keywords:
10+
- "CS9297"
11+
- "CS9298"
12+
- "CS9299"
13+
- "CS9314"
14+
ms.date: 10/07/2025
15+
---
16+
# Preprocessor errors and warnings
17+
18+
The compiler generates the following errors for incorrect use of preprocessor directives:
19+
20+
- **CS9297**: *`#:` directives cannot be after first token in file*
21+
- **CS9298**: *`#:`directives can be only used in file-based programs (`-features:FileBasedProgram`)*
22+
- **CS9299**: *`#:` directives cannot be after `#if` directive*
23+
- **CS9314**: *`#!` directives can be only used in scripts or file-based programs*

docs/csharp/language-reference/toc.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,10 @@ items:
460460
- name: C# compiler messages
461461
href: ./compiler-messages/index.md
462462
items:
463+
- name: Preprocessor errors
464+
href: ./compiler-messages/preprocessor-errors.md
465+
displayName: >
466+
CS9297, CS9298, CS9299, CS9314
463467
- name: Feature or version missing
464468
href: ./compiler-messages/feature-version-errors.md
465469
displayName: >

docs/csharp/misc/sorry-we-don-t-have-specifics-on-this-csharp-error.md

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -620,10 +620,6 @@ f1_keywords:
620620
- "CS9235"
621621
- "CS9236"
622622
# C# 14 errors begin here
623-
## Shebang
624-
- "CS9297"
625-
- "CS9298"
626-
- "CS9299"
627623
## using `extension` as type name. (valid identifiers).
628624
- "CS9306"
629625
## User defined operators
@@ -632,10 +628,22 @@ f1_keywords:
632628
- "CS9311"
633629
- "CS9312"
634630
- "CS9313"
635-
## Shebang
636-
- "CS9314"
637631
## Strings in the data section:
638632
- "CS9315"
633+
## More extension errors
634+
- "CS9316"
635+
- "CS9317"
636+
- "CS9318"
637+
- "CS9319"
638+
- "CS9326"
639+
- "CS9327"
640+
- "CS9328"
641+
- "CS9329"
642+
- "CS9330"
643+
- "CS9331"
644+
- "CS9332"
645+
- "CS9333"
646+
- "CS9334"
639647
helpviewer_keywords:
640648
- "errors [C#], additional information"
641649
---

0 commit comments

Comments
 (0)