DwgWriter.Write after using DxfModel.Clone() throws error

1
FizixMan
2/6/2019 6:36 PM

Loading a DWG file, creating a ".Clone()" copy of it, then writing out that copy via "DwgWriter.Write" throws an error. The error reported is:

Code:
System.NullReferenceException: Object reference not set to an instance of an object.
   at WW.Cad.Model.Tables.DxfDimensionStyle.get_TextStyle()
   at WW.Cad.Model.Tables.DxfDimensionStyleOverrides.get_TextStyle()
   at ?.?()
   at ?.?()
   at ?.?()
   at ?.?()
   at WW.Cad.IO.DwgWriter.Write(Boolean validate)
   at WW.Cad.IO.DwgWriter.Write(String filename, DxfModel model)
   at ConsoleApp9.Program.Main(String[] args) in C:\Users\Owner\source\repos\ConsoleApp9\Program.cs:line 17

The code used to generate the error is:

C# Code:
var model = DwgReader.Read("test.dwg");
var clone = (DxfModel)model.Clone();
DwgWriter.Write("test_out.dwg", clone);

Attached is the "test.dwg" used to generate the above error for reference, but so far this is happening for any DWG I throw at it.

The problem occurs in versions 4.0.38.143 and 4.0.38.144. Version 4.0.38.142 and earlier (tested 4.0.38.132) does not exhibit this error.

Wout
2/7/2019 9:54 AM

Oops, a regression in the cloning when I tried fixing another bug. I've just fixed it, thanks for the report! You can can download the latest version from You resources in your profile.

Thanks for the test data and test code!

- Wout

FizixMan
2/7/2019 3:49 PM

Thanks for the quick turnaround!

Tested and everything is resolved on my end now, thanks.

In the future, is there any other information I should be including or testing for when submitting error reports?

1