cart: empty [ Login ]

DxfReader closes stream despite CloseStreamAfterReading=false

1 
provegard
2/21/2023 10:46 PM

Hi! I discovered a difference between DwgReader and DxfReader when CloseStreamAfterReading is false. This code works:

C# Code:
var inputStream = new MemoryStream(Resources.small_dwg); var reader = new DwgReader(inputStream) { CloseStreamAfterReading = false }; reader.Read(); reader.Dispose(); inputStream.Position = 0; // ok
This code doesn't:
C# Code:
var inputStream = new MemoryStream(Resources.small_dxf); var reader = new DxfReader(inputStream) { CloseStreamAfterReading = false }; reader.Read(); reader.Dispose(); inputStream.Position = 0; // throws: System.ObjectDisposedException : Cannot access a closed Stream
Apparently DwgReader obeys CloseStreamAfterReading in its Dispose implementation, whereas DxfReader doesn't. CadLib version: 6.0.0-rc25 Best regards, Per

Wout
2/22/2023 5:32 PM

Hi Per, It's a bug indeed, it'll be fixed in the next version. Version 6.0.0-rc25 is a trial version by the way, you are evaluating the 6.0 multi-platform version? - Wout

provegard
2/22/2023 5:39 PM

Hi Wout, Great, thanks! I have introduced CadLib at a new client, so I'm using the evaluation version until the purchase of a real license has been finalized. Per

Wout
2/23/2023 1:22 AM

Hi Per, I've uploaded a new 6.0 multi platform version to nuget (version 6.0.0-rc25). - Wout

provegard
3/17/2023 1:17 PM

Hi Wout, I just tested with rc32 (multi-platform version), and the fix works great! By the way, I noticed that the nuspec files for the real packages still say: * This is an evaluation version only. (WW.Cad) * To try the software, a trial license must be obtained... (WW) It doesn't matter, of course. It just caught my eye. :) Per

1