Free Support Forum - aspose.com

Multithread document processing corrupts OneNote docs (saved with 0 bytes)

Hi Aspose team,

if I run processing of OneNote documents in multithread mode (each document is separate thread) some of documents (randomly) get corrupted as during save of document exception: “An item with the same key has already been added” is happening.

From stack file I see:

at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
at System.Collections.Generic.Dictionary2.Insert(TKey key, TValue value, Boolean add) at Aspose.Note.Fonts.FontsSubsystem.GetFontFamily(String fontName) at .(String , Single , FontStyle , ) at .() at .(Char ) at .(String ) at .(String , Single , TextStyle , IList1 , HorizontalAlignment , Single , )
at Aspose.Note.RichText.(Single )
at Aspose.Note.RichText.6vw7a38rx8hq7gf3sc2fzmpqyry3cca8 (SizeF )
at Aspose.Note.CompositeNode1.6vw7a38rx8hq7gf3sc2fzmpqyry3cca8 (SizeF ) at Aspose.Note.CompositeNode1.6vw7a38rx8hq7gf3sc2fzmpqyry3cca8 (SizeF )
at Aspose.Note.Outline.6vw7a38rx8hq7gf3sc2fzmpqyry3cca8 (SizeF )
at Aspose.Note.Page.6vw7a38rx8hq7gf3sc2fzmpqyry3cca8 (SizeF )
at Aspose.Note.Page.()
at Aspose.Note.Page.get_PageLayoutSize()
at . ()
at . ( )
at . ()
at .(Document )
at .(Document , Stream , OneSaveOptions )
at ..(Object )
at .[T](Document , SaveOptions , Action`1 )
at .(Document , Stream , SaveOptions )
at .(Document , String , SaveOptions )
at .(Document , String , SaveFormat )
at Aspose.Note.Document.Save(String fileName, SaveFormat format)

To recreate the problem please run attached project in debug mode as this is very you can easily see the problem.

If you let processing until the end you will see that some documents will be with 0 bytes.

Project:
OneNote.Bugs.MultiThread.DocCorruption.zip (4.0 MB)

As I tested with 50+ documents and they are bigger than 50MB I am uploading them to the Box:

https://app.box.com/s/jppgqcioz0j7e1iaado3t6ehijqu85w2

Please copy documents to debug folder of the application and put them in Docs\OneNote.

Thanks in advance,
Oliver

@dr.doc,
Thank you for your query. We are downloading the sample data and will provide our feedback after testing this issue soon.

@dr.doc,
I have tried this scenario with the sample project and .ONE files downloaded from above link. I am afraid that I could not observe any issue as no zero byte file is created and all files are of more than 2MB size at the end. Could you please run the test again and check the output files after couple of seconds as initially files are created with Zero byte size in the folder but within a few seconds the size becomes normal along the completion of threads.