Skip to content

Skip used handles when assigning one from the handle seed - #1267

Open
sommcz wants to merge 1 commit into
DomCR:masterfrom
sommcz:fix/zero-handle-seed
Open

sommcz wants to merge 1 commit into
DomCR:masterfrom
sommcz:fix/zero-handle-seed

Conversation

@sommcz

@sommcz sommcz commented Sep 30, 2026 •

Copy link
Copy Markdown

Description

What failed: reading an R12 DXF with $HANDSEED 0 threw ArgumentException: ... same key ... Key: 0. AddCadObject assigned the seed as the new handle, and handle 0 is the document's own.

Fix: CadDocument.AddCadObject skips handles already in use before assigning one from the seed. With a valid seed nothing changes.

Tasks done in this PR

  • Fix in CadDocument.AddCadObject.
  • Regression test DxfHandleSeedTests.ReadR12WithZeroHandleSeed: fails on master, passes with the fix.
  • Existing tests unaffected: full suite gives the same results as on master.

Related Issues / Pull Requests

Notes for reviewer

  • ArcTests.CreateFromBulgeTest and ArcTests.GetCenter fail on master too in our environment (Linux, .NET 10 SDK); unrelated.
  • Also checked on 600 real DXF files: the affected ones now read, the rest give identical output.

This branch has not been deployed

No deployments
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.

DxfReader.Read throws ArgumentException: ... same key ... Key: 0 for R12 files with $HANDSEED 0

1 participant