Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix crash when Data Source starts with a comma#3250

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

Midhunnnk
Copy link
Contributor

Fixes#3110
this PR fixes a crash inADP.IsEndpoint(...) caused by an unsafe call toLastIndexOf('\\', length - 1, length - 1) when the Data Source in the connection string starts with a comma (e.g."Data Source=,").

Whenlength == 0, the method would previously throw anArgumentOutOfRangeException.

---Fix
Added a defensive check to ensurelength > 0 before callingLastIndexOf, which prevents invalid index access.

--- Tests

  • Added a new unit test:ConnectionString_WithOnlyComma_ShouldNotThrow
  • The test confirms that the exception is no longer thrown
  • Verified the test fails without the fix and passes with it

This is my first open-source contribution — excited to be part of the project! Let me know if you'd like any changes.

cheenamalhotra reacted with heart emoji
@Midhunnnk
Copy link
ContributorAuthor

@dotnet-policy-service agree

@paulmedynskipaulmedynski self-assigned thisApr 1, 2025
Copy link
Contributor

@paulmedynskipaulmedynski left a comment

Choose a reason for hiding this comment

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

Great fisrt open-source contribution! Little bugs like these can be very frustrating for users, so we appreciate you taking the time to fix one :)

@paulmedynski
Copy link
Contributor

/azp run

@azure-pipelinesAzure Pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@Midhunnnk
Copy link
ContributorAuthor

@paulmedynski Thank you for the feedback, it helps a lot 😄 I've updated the test name and replaced Record.Exception with Assert.Throws() as suggested. Let me know if you'd like anything else adjusted — happy to improve further!

@cheenamalhotra
Copy link
Member

/azp run

@cheenamalhotracheenamalhotra added this to the6.1-preview1 milestoneApr 1, 2025
@azure-pipelinesAzure Pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Contributor

@paulmedynskipaulmedynski left a comment

Choose a reason for hiding this comment

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

Changes look great - thanks!

@mdaiglemdaigle self-assigned thisApr 2, 2025
@paulmedynskipaulmedynski merged commit9d71471 intodotnet:mainApr 2, 2025
123 checks passed
@codecovCodecov
Copy link

codecovbot commentedApr 2, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 0.00%. Comparing base(1247ca4) to head(ccbf510).
Report is 11 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@##             main   #3250       +/-   ##==========================================- Coverage   72.69%       0   -72.70%==========================================  Files         303       0      -303       Lines       59718       0    -59718     ==========================================- Hits        43414       0    -43414+ Misses      16304       0    -16304
FlagCoverage Δ
addons?
netcore?
netfx?

Flags with carried forward coverage won't be shown.Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report?Share it here.

🚀 New features to boost your workflow:
  • ❄️Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@ErikEJErikEJErikEJ left review comments

@cheenamalhotracheenamalhotracheenamalhotra approved these changes

@paulmedynskipaulmedynskipaulmedynski approved these changes

Labels
None yet
Projects
None yet
Milestone
6.1-preview1
Development

Successfully merging this pull request may close these issues.

ArgumentOutOfRange when datasource starts with comma
5 participants
@Midhunnnk@paulmedynski@cheenamalhotra@ErikEJ@mdaigle

[8]ページ先頭

©2009-2025 Movatter.jp