From videos you’ll see that versions 18.11 and 18.9 are randomly kill documents by saving files with 0 bytes size. Version 18.7 works ok.
Unfortunately this time I cannot provide sample project as this is part of bigger project. Also before saving I checked fs.length and it is always correct with number of bytes of existing file.
Btw. I am opening file, make changes in memory and saving back (overwrite) to do original file.
Videos: OneNote.zip (1.2 MB)
Here are sample files from videos but I do not think that they are root-cause as like said save works with 18.7:
We tried to reproduce this issue using the code sample provided but we are unable to reproduce this issue with Aspose.Note for .NET 18.11. The document is saving successfully. Can you please provide steps to reproduce this issue along with complete code sample in case we may have missed something.
It is requested to kindly share .NET SDK version that is being used as we are still unable to reproduce this issue. It would be great if you could just create simple project for us reproducing this error.
Error message that I am getting is “Object is currently in use elsewhere.”
and stack file is like provided before:
at System.Drawing.Graphics.set_PageUnit(GraphicsUnit value)
at . (String , Font )
at .(String , )
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.Node.(SizeF ) at Aspose.Note.CompositeNode1.6vw7a38rx8hq7gf3sc2fzmpqyry3cca8 (SizeF )
at Aspose.Note.Node.(SizeF )
at Aspose.Note.CompositeNode1.6vw7a38rx8hq7gf3sc2fzmpqyry3cca8 (SizeF ) at Aspose.Note.Node.(SizeF ) at Aspose.Note.TableRow.6vw7a38rx8hq7gf3sc2fzmpqyry3cca8 (SizeF ) at Aspose.Note.Node.(SizeF ) at Aspose.Note.CompositeNode1.6vw7a38rx8hq7gf3sc2fzmpqyry3cca8 (SizeF )
at Aspose.Note.Node.(SizeF )
at Aspose.Note.CompositeNode1.6vw7a38rx8hq7gf3sc2fzmpqyry3cca8 (SizeF ) at Aspose.Note.Node.(SizeF ) at Aspose.Note.CompositeNode1.6vw7a38rx8hq7gf3sc2fzmpqyry3cca8 (SizeF )
at Aspose.Note.Outline.6vw7a38rx8hq7gf3sc2fzmpqyry3cca8 (SizeF )
at Aspose.Note.Node.(SizeF )
at Aspose.Note.CompositeNode`1.6vw7a38rx8hq7gf3sc2fzmpqyry3cca8 (SizeF )
at Aspose.Note.Page.6vw7a38rx8hq7gf3sc2fzmpqyry3cca8 (SizeF )
at Aspose.Note.Node.(SizeF )
at Aspose.Note.Page.()
at Aspose.Note.Page.get_PageLayoutSize()
at . ()
at . ( )
at . ()
at .(Document )
at .(Document , Stream , OneSaveOptions )
at .(Document , Stream , SaveOptions )
at .(Document , Stream , SaveFormat )
at Aspose.Note.Document.Save(Stream stream, SaveFormat format)
at…
I am running multi document processing where each document is opened in a separate thread but they run in parallel. Now after searching and checking stack file it looks like that you are using System.Drawing.Graphics.set_PageUnit(GraphicsUnit value) and according to different search results this is not thread safe which is killing Aspose components and making them not usable for multithread processing.
If I disable and process document one by one nothing is corrupted.
Just search for ““object is currently used elsewhere” + System.Drawing.Graphics.set_PageUnit”.
As I do not experience this issue with 18.7 (at least I was not able to recreate it) I suppose that you made some changes between that and higher versions. I’ll try now to convert my test project to multithread project.
IMPORTANT: I believe that I saw similar also with Powerpoint and/or maybe Visio files. Will try to recreate but would be great if you can check with responsible colleagues if they are doing something similar to what is in OneNote. This is really bad, bad issue as it simply kills documents.
P.S. I tried this project also with Aspose.Note 18.7 and it worked ok.
Thank you for such a detailed feedback and the project file.
We have tested to find out the error but the provided project is working fine. We add OpenFile(“1.one”) right after th5.Start(“5.one”) and on exception occur on this line:
doc.Save(fs, SaveFormat.One)
However, we found that updateHyperlinks() methos is always getting “doc” with “Nothing” resulting following exceptions
Exception thrown: 'System.IO.IOException' in mscorlib.dll
Exception thrown: 'System.NullReferenceException' in OneNote.Bugs.exe
Exception thrown: 'System.ArgumentException' in mscorlib.dll
Moreover, we are investigating this and will update you soon.
Here recommendation was:
You should dispose the Graphics object when you’re done drawing and not keep a reference to it in the class. curveGraphics should be a local variable of plotGraph.
It was confirmed that this resolved the problem.
Are you disposing Graphics objects?
And a blog entry with more details: https://blogs.msmvps.com/peterritchie/2008/01/28/quot-object-is-currently-in-use-elsewhere-quot-error/
Thank you for your feedback. We have logged this issue with ID “NOTENET-2749” for further investigation. We will update you here once we have more information to share.
Thank you for writing back to us. We have reproduced the issue partially, we are not getting “object is currently used elsewhere” but files are saving with 0. So we have logged this issue for investigation.
Moreover, we will share our findings on provided sample project soon.
thanks for hotfix. I just replaced DLL in test project and all works good. I’ll continue with tests in main project but this looks promising. Most likely I can share next feedback tomorrow.
The issues you have found earlier (filed as NOTENET-2749) have been fixed in Aspose.Note for .NET 19.3. This message was posted using BugNotificationTool from Downloads module by Amjad_Sahi