We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Problem to save DWG file (crash with System.Collections.Generic.KeyNotFoundException error)

Hi Aspose team,

I used your sample code (a bit extended) to loop through hyperlinks and to make change if I find word aspose with some other strings.

When I try to save new file I am getting error:

Unhandled Exception: System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at . ?()
at .Write()
at ? .Write()
at Aspose.CAD.FileFormats.Cad.CadImage.SaveData(Stream stream)
at Aspose.CAD.DataStreamSupporter.Save(Stream stream)
at Aspose.CAD.DataStreamSupporter.Save(String filePath)
at Aspose_CAD.AutoCAD.UpdateHyperlink(String filename) in…

Am I doing something wrong?
I tried with different CAD formats (2000-2013) but always the same issues.

All test documents are stored in CAD folder.
Project is attached here.


AutoCADSaveProblem.zip (1.2 MB)


I have observed the issue shared by you and request you to please try using latest Aspose.CAD for .NET 20.1 on your end. In case there is still an issue please share with us.


please check attached project as I use Aspose.CAD 20.1.



I have worked with the sample project shared by you and have observed the issue specified. An issue with ID CADNET-1040 has been created in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be notified once the issue will be fixed.