Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Thu May 08, 2014 7:42 am

Hi all, I have a problem with doc conversion.

I have a web service which convert incoming stream to pdf. If i send one doc it's OK but if i send 10 docs, i have a problem with one document. The exception i receive is :

Message :
Collection was modified; enumeration operation may not execute.

Stack Trace :
at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
at System.Collections.Generic.Dictionary`2.Enumerator.MoveNext()
at spr2078.20(spr2546 A_0)
at spr2078.18(spr2546 A_0, Boolean A_1)
at spr2078.18(spr2546 A_0)
at spr3633.0(spr5149 A_0, spr5679 A_1, spr5788 A_2)
at spr3633.0(spr5149 A_0, spr5788 A_1)
at spr3633.5(spr5788 A_0)
at spr3633.6(spr5788 A_0)
at Spire.Pdf.PdfNewDocument.Save(Stream stream)
at Spire.Doc.Document.0(Stream A_0, ToPdfParameterList A_1)
at Spire.Doc.Document.SaveToStream(Stream stream, ToPdfParameterList paramList)
at ACJU.CTR.BT0012.CourrierCtr.Helpers.OfficeConversions.FromDocToPdf(Stream DocumentSource)


Can you help me to understand this error ?

secr.sdi@jura.ch
 
Posts: 6
Joined: Wed Apr 23, 2014 12:13 pm

Thu May 08, 2014 8:28 am

Hello,

Thanks for your feedback. Please provide us your document which has the problem.

Thanks,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Thu May 08, 2014 1:43 pm

I consume a web service to convert doc/docx/xls/xlsx to pdf, with ~15 documents to convert :

If I do one request after anothere one it's OK
if I do 15 request at the same time I have a failure on one (whatever the document to convert)

It seems to have problems in parallel conversions, is there a behavior to know for this case ?

secr.sdi@jura.ch
 
Posts: 6
Joined: Wed Apr 23, 2014 12:13 pm

Thu May 08, 2014 3:51 pm

For example an XLS error :

Message
Object is currently in use elsewhere


StackTrace
at System.Drawing.Image.Save(Stream stream, ImageCodecInfo encoder, EncoderParameters encoderParams)
at spr384.0(Stream A_0, Int32 A_1, List`1 A_2, List`1 A_3)
at spr1194.1(Stream A_0, Int32 A_1, List`1 A_2, List`1 A_3)
at spr1194.6(Stream A_0)
at spr76.0(Stream A_0, Int32 A_1, List`1 A_2, List`1 A_3)
at spr1194.1(Stream A_0, Int32 A_1, List`1 A_2, List`1 A_3)
at spr5020.0(Stream A_0, Int32 A_1, List`1 A_2, List`1 A_3)
at spr1194.1(Stream A_0, Int32 A_1, List`1 A_2, List`1 A_3)
at spr5020.0(Stream A_0, Int32 A_1, List`1 A_2, List`1 A_3)
at spr1194.1(Stream A_0, Int32 A_1, List`1 A_2, List`1 A_3)
at spr1194.6(Stream A_0)
at spr5158.0(Stream A_0, Int32 A_1)
at spr5158.0(ExcelVersion A_0)
at spr5158.1(ExcelVersion A_0)
at Spire.Xls.Core.Parser.Biff_Records.RecordArrayList.CalculateRecordsStreamPos()
at Spire.Xls.Core.Spreadsheet.XlsWorkbook.WorkbookExcel97Serializator.Serialize(Stream stream, XlsWorkbook book, ExcelSaveType saveType)
at Spire.Xls.Core.Spreadsheet.XlsWorkbook.SaveAs(Stream stream, ExcelSaveType saveType, ExcelVersion version)
at Spire.Xls.Core.Spreadsheet.XlsWorkbook.SaveToPdf(Stream stream, FileFormat fileFormat, ConverterSetting imageOrPrintOptions)
at Spire.Xls.Workbook.SaveToStream(Stream Stream, FileFormat fileFormat)


?

secr.sdi@jura.ch
 
Posts: 6
Joined: Wed Apr 23, 2014 12:13 pm

Fri May 09, 2014 7:29 am

Another error :

Message
Object reference not set to an instance of an object.


StackTrace
at spr3658.9()
at spr2078.18(spr4915 A_0)
at spr1327.18(spr2546 A_0)
at spr3633.0(spr5149 A_0, spr5679 A_1, spr5788 A_2)
at spr3633.0(spr5149 A_0, spr5788 A_1)
at spr3633.5(spr5788 A_0)
at spr3633.6(spr5788 A_0)
at Spire.Pdf.PdfNewDocument.Save(Stream stream)
at Spire.Doc.Document.0(Stream A_0, ToPdfParameterList A_1)


Errors appears on whatever document im the batch but this document alone, no problem...

secr.sdi@jura.ch
 
Posts: 6
Joined: Wed Apr 23, 2014 12:13 pm

Fri May 09, 2014 7:32 am

Hello,

Thanks for your additional information. We recommand you used the AppDomain class to simulate the multi-threading, and it would be more safer.
If there are any questions, welcome to get it back to us.
Thanks,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Fri May 09, 2014 7:58 am

Ok, I will try your suggestion, thanks.

In my wcf web service, I added the decorator :
Code: Select all
[ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Single, InstanceContextMode = InstanceContextMode.Single)]

and now the web service is runing as a singleton and I have no problems.

I will give you a feed back.

Thanks

secr.sdi@jura.ch
 
Posts: 6
Joined: Wed Apr 23, 2014 12:13 pm

Fri May 09, 2014 8:40 am

Hello,

Thanks for your reply.

If there are any questions, welcome to get it back to us.

Sincerely,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Return to Spire.Doc