Skip to content

Fix incorrect exception type in DataTableReader.GetOrdinal documentation #11461

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
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Jun 17, 2025

The documentation for DataTableReader.GetOrdinal(string name) incorrectly stated in the Remarks section that an IndexOutOfRangeException is thrown when a column name is not found. This contradicted both the method's Exceptions section and the supporting code examples, which correctly indicate that an ArgumentException is thrown.

Changes Made

  • Updated line 1501 in xml/System.Data/DataTableReader.xml to change IndexOutOfRangeException to ArgumentException in the remarks section

Verification

The fix aligns the documentation with:

  1. The method's own Exceptions section which lists ArgumentException for invalid column names
  2. The code example in the snippets which catches ArgumentException when calling GetOrdinal
  3. The actual behavior of the method as implemented

This is a minimal documentation-only change that resolves the inconsistency without affecting any functionality.

Fixes #11442.


💡 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.

Co-authored-by: jeffhandley <1031940+jeffhandley@users.noreply.github.com>
@Copilot Copilot AI changed the title [WIP] Documentation incorrectly states that an IndexOutOfRangeException is thrown Fix incorrect exception type in DataTableReader.GetOrdinal documentation Jun 17, 2025
@Copilot Copilot AI requested a review from jeffhandley June 17, 2025 08:58
Copilot finished work on behalf of jeffhandley June 17, 2025 08:58
Copy link
Member

@jeffhandley jeffhandley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jeffhandley jeffhandley marked this pull request as ready for review June 17, 2025 09:04
@jeffhandley jeffhandley enabled auto-merge (squash) June 17, 2025 09:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Documentation incorrectly states that an IndexOutOfRangeException is thrown
2 participants