ixmilia / dxf

MIT License
221 stars 67 forks source link

Unsupported code pair of dxf is swallowed #200

Closed margaritadubkova closed 1 year ago

margaritadubkova commented 1 year ago

Hallo

Unsupported code pair in a dxf file is swallowed. We cannot open the dxf in AutoCad, but ixMilia load file without errors. Please throw an Exception if code is not supported.

Our proposal:

In DxfCodePair.ExpectedType.cs at the line 97 change to:

throw new DxfReadException($"Unsupported code {code} at line {lineNumber}", lineNumber ?? 0); instead of "expected = typeof(string); // unsupported code, assume string so the value can be swallowed"

also add extra argument "lineNumber" to the method DxfCodePair.ExpectedType(int code, int? lineNumber = null)

and in DxfTextReader at the line 74 add extra argument _lineNumber var expectedType = DxfCodePair.ExpectedType(code, _lineNumber);

Thank you in advance.

brettfo commented 1 year ago

One of the goals for this project is to be able to open any DXF, even if it's not strictly supported by AutoCAD. In fact, issue #106 was for a DXF generated by a third-party app that output a type code that's not defined by the DXF spec.

I'm curious, though, what's the code that isn't defined that you're seeing? What ENTITY/OBJECT is it under?

margaritadubkova commented 1 year ago

Thank you, we will search another solution.