DwgWriter silently loses SummaryInfo property values ≥16,383 chars; larger values corrupt the file for ODA-based readers
Maintainers usually reply within 3 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 66/100
Research direction
Start by running the self-contained C# repro, then inspect DwgWriter.writeSummaryInfo and the DwgStreamWriterAC21.WriteTextUnicode path named in the issue. Compare behavior at the 16,382/16,383-character boundary and check the generated file with an ODA-based reader. Done means long values either round-trip intact or fail loudly without producing a corrupt file.
Written by the indexing model from the issue text.
Description
Summary
A SummaryInfo custom-property value of 16,383 characters or more is silently lost by the DWG write path, and depending on size the written file is corrupt for ODA-based readers (DWG TrueView / AutoCAD refuse it with "The drawing file requires recovery"). DwgReader reads the same file back without complaint and simply drops the property, so a write→read round-trip check cannot detect either the data loss or the corruption.
Verified on 3.6.51, 3.7.1 (latest release), and master @ 91ae384a — identical behavior on all three.
Repro (self-contained, no external files)
using ACadSharp;
using ACadSharp.Entities;
using ACadSharp.IO;
using CSMath;
foreach (int len in new[] { 16000, 16382, 16383, 16500 })
{
var doc = new CadDocument();
doc.Header.Version = ACadVersion.AC1032;
doc.Entities.Add(new Line { StartPoint = new XYZ(0, 0, 0), EndPoint = new XYZ(1000, 0, 0) });
string payload = new string('A', len);
doc.SummaryInfo.Properties.Add("test.prop", payload);
var ms = new MemoryStream();
using (var w = new DwgWriter(ms, doc)) { w.Write(); }
using var r = new DwgReader(new MemoryStream(ms.ToArray()));
var back = r.Read();
bool has = back.SummaryInfo.Properties.TryGetValue("test.prop", out var got);
Console.WriteLine($"len={len,6}: {(has ? (got == payload ? "intact" : $"CORRUPT ({got.Length} chars)") : "PROPERTY LOST")}");
}
Output (identical on 3.6.51 and 3.7.1, 2026-08-31):
len= 16000: intact
len= 16382: intact
len= 16383: PROPERTY LOST
len= 16500: PROPERTY LOST
Details
- The boundary is exactly 16,382 → 16,383 characters, independent of content/encoding (ASCII and Hebrew behave identically), which points at a 14-bit/
Int16char-count limit in the text writer (16,383 × 2 bytes =Int16.MaxValue), i.e. theDwgStreamWriterAC21.WriteTextUnicodepath used byDwgWriter.writeSummaryInfo. - The length appears to wrap mod 32,768: a 40,000-char value reads back as 7,233 chars.
- With larger real-world values we observed several corruption shapes in the written bytes (key lost with duplicated value fragments, wrapped length fields, large zero padding); two of three such files were rejected by DWG TrueView with the recovery dialog, while
DwgReaderaccepted all of them and silently dropped the property.
Expected
Either the full value round-trips, or the writer throws / truncates loudly. Silent loss plus a file that other CAD tools reject is the worst combination, because the library's own reader cannot see it.
Workaround we use
Cap every SummaryInfo property value below the boundary (we use 16,000 chars) before writing.
- Dominant language
- C#
- Stars
- 873
- Forks
- 223
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 28
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from DomCR/ACadSharp
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 3 days
-
DWG writer: text styles get the text-style table as their xref block handlePossibly taken @menes97 claimed this 4 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 81/100
Maintainers usually reply within 3 days
-
Difficulty 1/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 3 days
-
DwgWriter writes a null shape-file handle for SHAPE entities (WriteShapes = true)Possibly taken @menes97 claimed this 4 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 3 days
-
DwgReader reads a color-book entity's Color as ByBlock instead of the book's colorPossibly taken @menes97 claimed this 4 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 3 days
Similar issues
-
hand-to-AI
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
CactuseSecurity/firewall-orchestrator#5803 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Maintainers usually reply within 1 day
-
bug python
Difficulty 1/5 Under an hour Newbie friendliness 88/100
ilia-sokolov/OfficeAgent.NET#89 ·
Maintainers usually reply within 13 days