Thanks to visit codestin.com
Credit goes to github.com

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

Merged
merged 2 commits into from
Jun 18, 2025

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.

@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
@jeffhandley jeffhandley requested a review from gewarren June 18, 2025 01:14
@jeffhandley
Copy link
Member

@gewarren I don't understand why this change is resulting in the OpenPublishing.Build warnings for unaffected files. You?

@gewarren gewarren closed this Jun 18, 2025
auto-merge was automatically disabled June 18, 2025 07:08

Pull request was closed

@gewarren gewarren reopened this Jun 18, 2025
@gewarren
Copy link
Contributor

@gewarren I don't understand why this change is resulting in the OpenPublishing.Build warnings for unaffected files. You?

That was a transient warning that appears from time to time. Close/reopen made it go away.

@gewarren gewarren merged commit a33f8fb into main Jun 18, 2025
7 of 9 checks passed
@gewarren gewarren deleted the copilot/fix-11442 branch June 18, 2025 08:24
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
3 participants