We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Random Invalid Operation Exception on saving workbook

Thread ID:

Created:

Updated:

Platform:

Replies:

73920 May 26,2008 06:29 AM UTC Mar 12,2012 10:24 PM UTC ASP.NET Web Forms (Classic) 11
loading
Tags: XlsIO
Sarah
Asked On May 26, 2008 06:29 AM UTC

For some time I have been randomly receiving an InvalidOperationException when saving a workbook. This only happens when I am adding images and using a thread pool.

I have attached some sample code which generates 1000 workbooks. This code generally gets the error every couple of hundred workbooks generated.

I'm using syncfusion version 6.2 VS 2005 but I have experienced this problem with previous versions of xlsio too.



SyncfusionBug.zip

Yavanaarasi G [Syncfusion]
Replied On May 27, 2008 12:19 PM UTC

Hi Sarah,

Thank you for your interest in Syncfusion products.

I am not able to reproduce the issue that you have mentioned. Here the 1000 workbooks are created with the images without throws any exception.

Here is the screenshot:
http://help.syncfusion.com/samples/F-73920.png


Could you please provide your System configuration and the IE version so that we could reproduce the issue in that environment and provide you a solution?

Regards,
G.Yavana


Sarah
Replied On May 28, 2008 01:06 AM UTC

Hi,

Here is the info:

-Windows XP Service Pack 2 (but I've also seen it happen on Windows Server 2003)
-Visual Studio 2005
-IE 6.0
-.NET Framework 2.0 sp1

Did you check the output window or set a breakpoint in the Catch though? As the sample just does Debug.Print to show which ones failed and which files were successful. It's not an unhandled exception.

Thanks!

>Hi Sarah,

Thank you for your interest in Syncfusion products.

I am not able to reproduce the issue that you have mentioned. Here the 1000 workbooks are created with the images without throws any exception.

Here is the screenshot:
http://help.syncfusion.com/samples/F-73920.png


Could you please provide your System configuration and the IE version so that we could reproduce the issue in that environment and provide you a solution?

Regards,
G.Yavana




Yavanaarasi G [Syncfusion]
Replied On May 28, 2008 12:06 PM UTC

Hi Sarah,

Thank you for your update.

Could you please provide the stack trace details of the exception so that we have forward this issue to our developers and will provide you a better solution?

Regards,
G.Yavana



Sarah
Replied On May 28, 2008 11:56 PM UTC

Here are the details, thanks.

InvalidOperationException
Source: System.Drawing
Message: Object is currently in use elsewhere.


at System.Drawing.Image.Save(Stream stream, ImageCodecInfo encoder, EncoderParameters encoderParams)
at System.Drawing.Image.Save(Stream stream, ImageFormat format)
at Syncfusion.XlsIO.Parser.Biff_Records.MsoDrawing.MsoBitmapPicture.InfillInternalData(Stream stream, Int32 iOffset, ArrayList arrBreaks, ArrayList arrRecords)
at Syncfusion.XlsIO.Parser.Biff_Records.MsoDrawing.MsoBase.FillArray(Stream stream, Int32 iOffset, ArrayList arrBreaks, ArrayList arrRecords)
at Syncfusion.XlsIO.Parser.Biff_Records.MsoDrawing.MsoBase.FillArray(Stream stream)
at Syncfusion.XlsIO.Parser.Biff_Records.MsoDrawing.MsofbtBSE.InfillInternalData(Stream stream, Int32 iOffset, ArrayList arrBreaks, ArrayList arrRecords)
at Syncfusion.XlsIO.Parser.Biff_Records.MsoDrawing.MsoBase.FillArray(Stream stream, Int32 iOffset, ArrayList arrBreaks, ArrayList arrRecords)
at Syncfusion.XlsIO.Parser.Biff_Records.MsoDrawing.MsoContainerBase.InfillInternalData(Stream stream, Int32 iOffset, ArrayList arrBreaks, ArrayList arrRecords)
at Syncfusion.XlsIO.Parser.Biff_Records.MsoDrawing.MsofbtBstoreContainer.InfillInternalData(Stream stream, Int32 iOffset, ArrayList arrBreaks, ArrayList arrRecords)
at Syncfusion.XlsIO.Parser.Biff_Records.MsoDrawing.MsoBase.FillArray(Stream stream, Int32 iOffset, ArrayList arrBreaks, ArrayList arrRecords)
at Syncfusion.XlsIO.Parser.Biff_Records.MsoDrawing.MsoContainerBase.InfillInternalData(Stream stream, Int32 iOffset, ArrayList arrBreaks, ArrayList arrRecords)
at Syncfusion.XlsIO.Parser.Biff_Records.MsoDrawing.MsoBase.FillArray(Stream stream, Int32 iOffset, ArrayList arrBreaks, ArrayList arrRecords)
at Syncfusion.XlsIO.Parser.Biff_Records.MsoDrawing.MsoBase.FillArray(Stream stream)
at Syncfusion.XlsIO.Parser.Biff_Records.MSODrawingGroupRecord.FillDataList(Stream stream, Int32 iStartIndex)
at Syncfusion.XlsIO.Parser.Biff_Records.MSODrawingGroupRecord.InfillInternalData(ExcelVersion version)
at Syncfusion.XlsIO.Parser.Biff_Records.MSODrawingGroupRecord.GetStoreSize(ExcelVersion version)
at Syncfusion.XlsIO.Parser.Biff_Records.OffsetArrayList.CalculateRecordsStreamPos()
at Syncfusion.XlsIO.Parser.Biff_Records.OffsetArrayList.UpdateBiffRecordsOffsets()
at Syncfusion.XlsIO.Implementation.WorkbookImpl.WorkbookExcel97Serializator.Serialize(String fullName, WorkbookImpl book, ExcelSaveType saveType)
at Syncfusion.XlsIO.Implementation.WorkbookImpl.SaveAs(String FileName, ExcelSaveType saveType, ExcelVersion version)
at Syncfusion.XlsIO.Implementation.WorkbookImpl.SaveAs(String FileName)
at Syncfusion.XlsIO.Implementation.WorkbookImpl.Close(Boolean SaveChanges, String Filename)
at SyncfusionBug.Dowork.CreateFile() in C:\temp\SyncfusionBug\SyncfusionBug\DoWork.vb:line 19
at SyncfusionBug._Default.WorkItemDo(Object state) in C:\temp\SyncfusionBug\SyncfusionBug\Default.aspx.vb:line 21


Yavanaarasi G [Syncfusion]
Replied On May 29, 2008 11:41 AM UTC

Hi Sarah,

Thank you for providing the details.

The issue may occur due to high memory usage. Could you please provide the sample image "Test.gif" so that we could test in our side and provide you a solution?

Regards,
G.Yavana


Sarah
Replied On May 30, 2008 03:17 AM UTC

Here's an example image with which I've been able to reproduce the issue. Thanks




Test_4fdb01e5.zip

Yavanaarasi G [Syncfusion]
Replied On May 30, 2008 10:33 AM UTC

Hi Sarah,

Thank you providing the sample image.

We have forwarded this issue to our developers. We will update you once we get back from them.

Regards,
G.Yavana


Sarah
Replied On April 16, 2010 04:15 AM UTC

We are still experiencing this problem intermittently after having upgraded to version 8.103.0.30 of Syncfusion.

I have noticed that when saving as Excel 2007 the problem does not appear to occur. Unfortunately we do need to use Excel 2003.

If your developers could take another look at the problem it would be appreciated. Thanks

Sarah
Replied On June 18, 2010 03:12 AM UTC

A workaround for this problem is to use a lock statement around the Image.Save in the MsoBitmapPicture class. There is also a Generic List in MSODrawingGroupRecord which has a similar issue.

It would be good if a solution to this problem could be included in a future release of xlsio.


Michael Hansen
Replied On March 12, 2012 10:17 PM UTC

Did you ever solve this issue? We have the very same issue when saving bitmap images using ExcelVersion Excel97to2003. We are running a simple console application and using Syncfusion ver 9.203.0.137.

Stacktrace:

System.InvalidOperationException: Object is currently in use elsewhere.


at System.Drawing.Image.Save(Stream stream, ImageCodecInfo encoder, EncoderParameters encoderParams)
at System.Drawing.Image.Save(Stream stream, ImageFormat format)
at Syncfusion.XlsIO.Parser.Biff_Records.MsoDrawing.MsoBitmapPicture.InfillInternalData(Stream stream, Int32 iOffset, List`1 arrBreaks, List`1 arrRecords)
at Syncfusion.XlsIO.Parser.Biff_Records.MsoDrawing.MsoBase.FillArray(Stream stream, Int32 iOffset, List`1 arrBreaks, List`1 arrRecords)
at Syncfusion.XlsIO.Parser.Biff_Records.MsoDrawing.MsoBase.FillArray(Stream stream)
at Syncfusion.XlsIO.Parser.Biff_Records.MsoDrawing.MsofbtBSE.InfillInternalData(Stream stream, Int32 iOffset, List`1 arrBreaks, List`1 arrRecords)
at Syncfusion.XlsIO.Parser.Biff_Records.MsoDrawing.MsoBase.FillArray(Stream stream, Int32 iOffset, List`1 arrBreaks, List`1 arrRecords)
at Syncfusion.XlsIO.Parser.Biff_Records.MsoDrawing.MsoContainerBase.InfillInternalData(Stream stream, Int32 iOffset, List`1 arrBreaks, List`1 arrRecords)
at Syncfusion.XlsIO.Parser.Biff_Records.MsoDrawing.MsofbtBstoreContainer.InfillInternalData(Stream stream, Int32 iOffset, List`1 arrBreaks, List`1 arrRecords)
at Syncfusion.XlsIO.Parser.Biff_Records.MsoDrawing.MsoBase.FillArray(Stream stream, Int32 iOffset, List`1 arrBreaks, List`1 arrRecords)
at Syncfusion.XlsIO.Parser.Biff_Records.MsoDrawing.MsoContainerBase.InfillInternalData(Stream stream, Int32 iOffset, List`1 arrBreaks, List`1 arrRecords)
at Syncfusion.XlsIO.Parser.Biff_Records.MsoDrawing.MsoBase.FillArray(Stream stream, Int32 iOffset, List`1 arrBreaks, List`1 arrRecords)
at Syncfusion.XlsIO.Parser.Biff_Records.MsoDrawing.MsoBase.FillArray(Stream stream)
at Syncfusion.XlsIO.Parser.Biff_Records.MSODrawingGroupRecord.FillDataList(Stream stream, Int32 iStartIndex)
at Syncfusion.XlsIO.Parser.Biff_Records.MSODrawingGroupRecord.InfillInternalData(ExcelVersion version)
at Syncfusion.XlsIO.Parser.Biff_Records.MSODrawingGroupRecord.GetStoreSize(ExcelVersion version)
at Syncfusion.XlsIO.Parser.Biff_Records.OffsetArrayList.CalculateRecordsStreamPos()
at Syncfusion.XlsIO.Parser.Biff_Records.OffsetArrayList.UpdateBiffRecordsOffsets()
at Syncfusion.XlsIO.Implementation.WorkbookImpl.WorkbookExcel97Serializator.Serialize(Stream stream, WorkbookImpl book, ExcelSaveType saveType)
at Syncfusion.XlsIO.Implementation.WorkbookImpl.SaveAs(Stream stream, ExcelSaveType saveType)
at Syncfusion.XlsIO.Implementation.WorkbookImpl.SaveAs(Stream stream)


Michael Hansen
Replied On March 12, 2012 10:24 PM UTC

I might also add that this only occurs when multiple threads are calling IWorkbook.Save concurrently. We currently need to sync our threads before calling Save and this complicates things and lowers performance. Please help.


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;