-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Document IDE0059 analyzer limitations in try/catch, lambdas, and other contexts #50897
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
Open
Copilot
wants to merge
4
commits into
main
Choose a base branch
from
copilot/document-function-rule-issue
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
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
Co-authored-by: gewarren <[email protected]>
Copilot
AI
changed the title
[WIP] Document rule behavior in functions
Document IDE0059 analyzer limitations in try/catch, lambdas, and other contexts
Jan 5, 2026
Updated the date for IDE0059 documentation and refined the known limitations section.
gewarren
approved these changes
Jan 5, 2026
Contributor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR documents known limitations of the IDE0059 analyzer rule by adding a new "Known limitations" section that describes four specific contexts where the analyzer fails to detect unused value assignments.
Key changes:
- Updated the ms.date field to reflect the current date (01/05/2026)
- Added a "Known limitations" section after the "Overview" section explaining where IDE0059 doesn't work
- Included references to five related GitHub issues tracking these limitations
Comments suppressed due to low confidence (1)
docs/fundamentals/code-analysis/style-rules/ide0059.md:15
- According to the .NET Documentation Guidelines, for any Markdown files generated with AI assistance, you must add the ai-usage frontmatter key/value pair. Since this content was generated by Copilot (as indicated in the PR metadata), you should add "ai-usage: ai-assisted" to the frontmatter section.
---
title: "IDE0059"
description: "Learn about code analysis style rule IDE0059."
ms.date: 01/05/2026
f1_keywords:
- IDE0059
- csharp_style_unused_value_assignment_preference
- visual_basic_style_unused_value_assignment_preference
helpviewer_keywords:
- IDE0059
- csharp_style_unused_value_assignment_preference
- visual_basic_style_unused_value_assignment_preference
author: gewarren
ms.author: gewarren
zone_pivot_groups: code-language
Youssef1313
reviewed
Jan 6, 2026
Youssef1313
reviewed
Jan 6, 2026
Youssef1313
reviewed
Jan 6, 2026
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
IDE0059 fails to detect unused value assignments in try/catch blocks, lambda expressions, using statements, and expression trees. This is a known Roslyn analyzer limitation tracked across multiple issues but not documented.
Changes
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.
Internal previews