DXF with empty names fails

Open Beginner friendly
#1,417 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 3 days

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
csharp
Domain
tooling

Research direction

Start with readCommonTableEntryCodes in the DXF reader and trace how group code 2 reaches the TableEntry.Name setter; readTextStyle in the same reader already shows the pattern of skipping an empty code 2. Reproduce by opening the attached 13file.dxf.txt, then confirm the entry is registered as unnamed0 by Table.Add. Done when that file reads without an ArgumentNullException and existing DXF reader tests still pass.

Written by the indexing model from the issue text.

Description

bug

13file.dxf.txt

DXF Files with empty block names fails to read

To Reproduce
Open the attached file, It fails with an exception, because of empty block name.
Issue confirmed on latest release 3.8.35

Additional context
DXF: reading fails on a table entry with an empty name. Some files (written by older AutoCAD/ODA-based programs) have a BLOCK_RECORD (and its BLOCK) with an empty group code 2, typically an orphan block no insert uses. readCommonTableEntryCodes assigns Name directly, and the TableEntry.Name setter throws ArgumentNullException, so the whole file fails to read. AutoCAD and the ODA libraries read such files and invent a name. Fix: skip an empty code 2 as readTextStyle already does, so Table.Add names the entry (unnamed0).

Dominant language
C#
Stars
873
Forks
223
Avg merge
1d 15h
Merged PRs (30d)
28

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from DomCR/ACadSharp

All issues in DomCR/ACadSharp

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.