Free Support Forum - aspose.com

System.NullReferenceException: When saving with Aspose.Word

When we open a certain Word document (one we didn't create ourselves) with aspose.words.net 10.0.0.0, and try to save it (unchanged) we get the following error:

System.NullReferenceException: Object reference not set to an instance of an object.
at x28925c9b27b37a46.x98739d759efb5fe7.get_x1be93eed8950d961()
at x28925c9b27b37a46.x98739d759efb5fe7.x8a92b04b9d325900()
at x28925c9b27b37a46.x98739d759efb5fe7.xeea9b43f0c912fdb(Node xda5bf54deb817e37)
at x28925c9b27b37a46.x7e263f21a73a027a..ctor(Node start, Boolean includeStart, Node end, Boolean includeEnd)
at xfbd1009a0cbb9842.xea2bba93b9ce5dd9..ctor(Field field)
at xfbd1009a0cbb9842.xea2bba93b9ce5dd9.xf098323036d9ec26(Field xe01ae93d9fe5a880)
at xfbd1009a0cbb9842.xe11422ab90fb5f3b..ctor(Field field, Boolean moveToFirstToken)
at xfbd1009a0cbb9842.x2d380f6141585930..ctor(Field field, x5e36356bc92c609b updateContext, x6ed66b5cf8da2955 switchResolver)
at xfbd1009a0cbb9842.x985dd08fd338eeea..ctor(Field field, x5e36356bc92c609b updateContext, x6ed66b5cf8da2955 switchResolver)
at xfbd1009a0cbb9842.x985dd08fd338eeea..ctor(Field field)
at Aspose.Words.Fields.Field.get_xbb2aa6ad14d08a82()
at x9e260ffa1ac41ffa.x163859bfa28558c4.xfd30c9fe530c9b34(FieldSeparator xed9a565596a6ae3f)
at x9e260ffa1ac41ffa.x163859bfa28558c4.VisitFieldSeparator(FieldSeparator fieldSeparator)
at Aspose.Words.Fields.FieldSeparator.Accept(DocumentVisitor visitor)
at Aspose.Words.CompositeNode.x464d2134480a7bf2(DocumentVisitor x672ff13faf031f3d)
at Aspose.Words.CompositeNode.xf7ae36cd24e0b11c(DocumentVisitor x672ff13faf031f3d)
at Aspose.Words.Paragraph.Accept(DocumentVisitor visitor)
at Aspose.Words.CompositeNode.x464d2134480a7bf2(DocumentVisitor x672ff13faf031f3d)
at Aspose.Words.CompositeNode.xf7ae36cd24e0b11c(DocumentVisitor x672ff13faf031f3d)
at Aspose.Words.Body.Accept(DocumentVisitor visitor)
at x9e260ffa1ac41ffa.x163859bfa28558c4.x51ee56decc29a9da(Section xb32f8dd719a105db)
at x9e260ffa1ac41ffa.x163859bfa28558c4.x160a0bf4de8f6bd0()
at x9e260ffa1ac41ffa.x163859bfa28558c4.x8cac5adfe79bc025(x8556eed81191af11 x5ac1382edb7bf2c2)
at Aspose.Words.Document.xf381a641001e6830(Stream xcf18e5243f8d5fd3, String xafe2f3653ee64ebc, SaveOptions xc27f01f21f67608c)
at Aspose.Words.Document.Save(String fileName, SaveOptions saveOptions)
at Aspose.Words.Document.Save(String fileName)

In the attachement I included the code I used to open and save the word document with aspose and the stacktrace it produces on Save. I also included the word doc causing this Aspose crash.

Hope you can get this fixed as soon as possible.

Regards,

Robert Wielink<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Sr. Software Engineer

Infoland BV

Hi Robert,

Thanks for your request. I cannot reproduce the problem on my side. I used the latest version of Aspose.Words for testing. You can download the latest version from here:

http://www.aspose.com/community/files/51/.net-components/aspose.words-for-.net/category1188.aspx

Best regards,

I wasn't aware there was already a newer version available.

I tested it in 10.2.0 and it seems to work.

Thanks.

Regards,

Robert Wielink