Skip to content

[release/6.5] Fix HierarchyId parsing for numbers outside Int32 range#2362

Open
Copilot wants to merge 2 commits intorelease/6.5from
copilot/port-ef6-pull-2359
Open

[release/6.5] Fix HierarchyId parsing for numbers outside Int32 range#2362
Copilot wants to merge 2 commits intorelease/6.5from
copilot/port-ef6-pull-2359

Conversation

Copy link
Contributor

Copilot AI commented Mar 5, 2026

Port of dotnet/ef6#2359

HierarchyId fails to parse valid IDs containing numbers outside the Int32 range (e.g. SQL Server file table path_locator defaults), throwing ArgumentException due to int.TryParse overflow.

// Previously threw ArgumentException; now works correctly
var hid = HierarchyId.Parse("/239196746533516.54209197962074.2160059995/");

Changes

  • HierarchyId.cs: Change _nodes from int[][] to long[][]; switch parsing to long.TryParse; fix new[] { 1 }new[] { 1L } in GetDescendant
  • Rename helpers: IntArrayToStirngLongArrayToString (IEnumerable<long>); CompareIntArraysCompareLongArrays (long[], long locals); update all call sites
  • HierarchyIdUnitTests.cs: Add tests for parsing IDs with out-of-Int32-range numbers and for comparison operators on large values

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • 4myvsblobprodcus32.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet dotnet build src/EntityFramework/EntityFramework.csproj -c Debug (dns block)
  • vb4vsblobprodcus33.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet dotnet build src/EntityFramework/EntityFramework.csproj -c Debug (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

)

Co-authored-by: AndriySvyryd <6539701+AndriySvyryd@users.noreply.github.com>
Copilot AI changed the title [WIP] Port changes from EF6 pull request 2359 Fix HierarchyId parsing for numbers outside Int32 range Mar 5, 2026
@AndriySvyryd AndriySvyryd changed the title Fix HierarchyId parsing for numbers outside Int32 range [release/6.5] Fix HierarchyId parsing for numbers outside Int32 range Mar 5, 2026
@AndriySvyryd AndriySvyryd marked this pull request as ready for review March 5, 2026 17:56
@roji roji assigned AndriySvyryd and unassigned roji Mar 15, 2026
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.

3 participants