-
Notifications
You must be signed in to change notification settings - Fork 6k
Add C# errors introduced in C# 12 to appropriate files #49377
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 3 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
251189c
checkpoint - scratch pad for errors
BillWagner 4589ff0
Move errors to correct theme.
BillWagner f676788
Final edits
BillWagner fd4a6a6
Update docs/csharp/language-reference/compiler-messages/lambda-expres…
BillWagner 18600b6
fix build warnings
BillWagner fa37d46
Merge branch 'csharp-12-errors' of https://github.com/BillWagner/docs…
BillWagner f9176ad
Apply suggestions from code review
BillWagner 3513447
Apply suggestions from code review
BillWagner 07bf2a7
Apply suggestions from code review
BillWagner File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,6 +18,7 @@ | |
| - "CS9098" # ERR_ImplicitlyTypedDefaultParameter: Implicitly typed lambda parameter '{0}' cannot have a default value. | ||
| - "CS9099" # WRN_OptionalParamValueMismatch: The default parameter value does not match in the target delegate type. | ||
| - "CS9100" # WRN_ParamsArrayInLambdaOnly: Parameter has params modifier in lambda but not in target delegate type. | ||
| - "CS9236" # INF_TooManyBoundLambdas: Compiling requires binding the lambda expression at least {0} times. | ||
| helpviewer_keywords: | ||
| - "CS0748" | ||
| - "CS0835" | ||
|
|
@@ -35,6 +36,7 @@ | |
| - "CS9098" | ||
| - "CS9099" | ||
| - "CS9100" | ||
| - "CS9236" | ||
| ms.date: 05/04/2023 | ||
| --- | ||
| # Errors and warnings when using lambda expressions and anonymous functions | ||
|
|
@@ -64,6 +66,10 @@ | |
| - [**CS9099**](#lambda-expression-delegate-type): *The default parameter value does not match in the target delegate type.* | ||
| - [**CS9100**](#lambda-expression-delegate-type): *Parameter has params modifier in lambda but not in target delegate type.* | ||
|
|
||
| The compiler also produces the following *informational* message: | ||
|
|
||
| - [**CS9236**](#syntax-limitations-in-lambda-expressions): *Compiling requires binding the lambda expression at least count times. Consider declaring the lambda expression with explicit parameter types, or if the containing method call is generic, consider using explicit type arguments.* | ||
|
|
||
| ## Syntax limitations in lambda expressions | ||
|
|
||
| Some C# syntax is prohibited in lambda expressions and anonymous methods. Using invalid constructs in a lambda expression causes the following errors: | ||
|
|
@@ -90,7 +96,12 @@ | |
|
|
||
| - **CS8971**: *InterpolatedStringHandlerArgument has no effect when applied to lambda parameters and will be ignored at the call site.* | ||
|
|
||
| Certain expressions cause the compiler to emit the following informational warning: | ||
|
|
||
| - **CS9236**: *Compiling requires binding the lambda expression at least count times. Consider declaring the lambda expression with explicit parameter types, or if the containing method call is generic, consider using explicit type arguments.* | ||
|
|
||
| The complexity of the lambda expressions and how they invoke other lambda expressions is negatively impacting compiler performance. The reason is that the compiler must infer parameter and argument types through the lambda expressions and the potential types takes time. | ||
BillWagner marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ## Lambda expression parameters and returns | ||
|
Check failure on line 104 in docs/csharp/language-reference/compiler-messages/lambda-expression-errors.md
|
||
|
|
||
| These errors indicate a problem with a parameter declaration: | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.