Free Support Forum - aspose.com

Bookmark.Text = "" hangs Aspose, spiking CPU

I am trying to clear the contents of a bookmark using

Aspose.Words.Bookmark bMark = doc.Range.Bookmarks[“BTB_Perry_1”];
bMark = “”;

On this particular bookmark, when I execute the above code Aspose.Words hangs and my CPU starts spiking to the max.

I’ve attached a Sample doc, we are using the latest version of Aspose.Words, .NET Version.Sample.zip (12.3 KB)

@v6er,

Thanks for your inquiry. We have tested the scenario using latest version of Aspose.Words for .NET 18.6 with following code example and have not found the shared issue. Please use Aspose.Words for .NET 18.6.

Document doc = new Document(MyDir + @"sample.docx");
Aspose.Words.Bookmark bMark = doc.Range.Bookmarks["BTB_Perry_1"];
bMark.Text = "";

doc.Save(MyDir + @"18.6.docx");

I updated to the latest version of Aspose.

I used the exact code you have listed.

And it still hangs for me on the line bMark.Text = “”;

What version of .NET are you testing this with? We are using .net 4.5.2.

If you execute bMark.Text what do you get back? There should be nothing but a carriage return character in there.

I figured out the cause of the issue, and why you are not able to reproduce. If you use the following code it will reproduce the issue on your side:

        Aspose.Words.Document doc = new Aspose.Words.Document("C:\\SampleDoc.DocX");
        doc.StartTrackRevisions("");
        Aspose.Words.Bookmark bMark = doc.Range.Bookmarks["BTB_Perry_1"];
        bMark.Text = "";

The issue will occure IF you turn on the ability to track revisions. Please confirm this on your side, and if so suggest a fix.

Thanks for your help!

@v6er,

Thanks for sharing the detail. We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-17082. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

The issues you have found earlier (filed as WORDSNET-17082) have been fixed in this Aspose.Words for .NET 18.8 update and this Aspose.Words for Java 18.8 update.