Thread Safety

Stimulsoft Reports.NET discussion
Post Reply
joro
Posts: 63
Joined: Wed Jan 27, 2010 7:35 am

Thread Safety

Post by joro »

Hello!

I am wondering if your methods are thread safe.
I have multiple threads which are creating and saving reports to the filesystem. The report template is always the same one - i always use "myreport.mrt" as template.
Sometimes i get strange exceptions when i load or compile the report. If I look into it, it seems that multiple threads are calling the Report.Load() or Report.Compile() methd at the same time. So my question is: Are these methods thread safe? There are service calls in these methods, are these services thread safe?

I hope you can help me on this.
I post the exceptions/stacktraces i got:
exception 1, when trying Report.Load(string path):
Mesage:
Unable to cast object of type 'System.String' to type 'Stimulsoft.Report.Dictionary.StiDataParameter'.
Stacktrace:
at Stimulsoft.Report.Dictionary.StiDataParametersCollection.OnInsert(Int32 index, Object value)
at System.Collections.CollectionBase.System.Collections.IList.Add(Object value)
at Stimulsoft.Base.Serializing.StiSerializing.DeserializeObject(Object obj, StiPropertyInfoCollection props)
at Stimulsoft.Base.Serializing.StiSerializing.DeserializeObject(Object obj, StiPropertyInfoCollection props)
at Stimulsoft.Base.Serializing.StiSerializing.DeserializeObject(Object obj, StiPropertyInfoCollection props)
at Stimulsoft.Base.Serializing.StiSerializing.Deserialize(Object obj, Stream stream, String application)
at Stimulsoft.Report.SaveLoad.StiXmlReportSLService.Load(StiReport report, Stream stream)
at Stimulsoft.Report.StiReport.Load(StiReportSLService service, Stream stream)
at Stimulsoft.Report.StiReport.Load(Stream stream)
at Stimulsoft.Report.StiReport.Load(String path)

Exception 2, when trying to Report.Compile()
Message:
Collection was modified; enumeration operation may not execute.
Stacktrace:
at System.Collections.ArrayList.ArrayListEnumeratorSimple.MoveNext()
at Stimulsoft.Base.Services.StiServiceContainer.GetServices(Type serviceType, Boolean getEnabled, Boolean callBeforeGetService)
at Stimulsoft.Base.Services.StiServiceContainer.GetServices(Type serviceType, Boolean getEnabled)
at Stimulsoft.Base.Services.StiServiceContainer.GetServices(Type serviceType)
at Stimulsoft.Report.CodeDom.StiFunctionsParser.Parse(StiReport report, StiComponent ownerComponent, String& text, Boolean isScript, StiExpression expression, Boolean checkTotals)
at Stimulsoft.Report.CodeDom.StiCodeDomFunctions.ParseFunctionsInternal(Int32& functionIndex, StiCodeDomSerializator serializator, String propertyName, StiComponent comp, String& text, StiExpression expression, Boolean isScript)
at Stimulsoft.Report.CodeDom.StiCodeDomFunctions.ParseFunctions(StiCodeDomSerializator serializator, String propertyName, StiComponent comp, String& text, StiExpression expression, Boolean isScript)
at Stimulsoft.Report.CodeDom.StiCodeDomFunctions.ParseFunctions(StiCodeDomSerializator serializator, String propertyName, String text)
at Stimulsoft.Report.CodeDom.StiCodeDomFunctions.ParseFunctions(StiCodeDomSerializator serializator, String text)
at Stimulsoft.Report.CodeDom.StiCodeDomVariables.SerializeVariablesToCode(StiCodeDomSerializator serializator, StiReport report)
at Stimulsoft.Report.CodeDom.StiCodeDomVariables.Serialize(StiCodeDomSerializator serializator, StiReport report)
at Stimulsoft.Report.CodeDom.StiCodeDomSerializator.Serialize(StiReport report, String name, StiLanguage language, Boolean serializeData, Boolean saveForInheritedReports, Object standaloneReportType)
at Stimulsoft.Report.CodeDom.StiCodeDomSerializator.Serialize(StiReport report, String name, StiLanguage language, Object standaloneReportType)
at Stimulsoft.Report.StiReport.ScriptUpdate(Object standaloneReportType, Boolean allowUseResources)
at Stimulsoft.Report.StiReport.Compile(String path, Stream stream, StiOutputType outputType, Boolean autoCreate, Object standaloneReportType)
at Stimulsoft.Report.StiReport.Compile(String path, Stream stream, StiOutputType outputType, Boolean autoCreate)
at Stimulsoft.Report.StiReport.Compile(String path, StiOutputType outputType, Boolean autoCreate)
at Stimulsoft.Report.StiReport.Compile(String path, StiOutputType outputType)
at Stimulsoft.Report.StiReport.Compile(StiOutputType outputType)
at Stimulsoft.Report.StiReport.Compile()



best regards
joro
Andrew
Posts: 4109
Joined: Fri Jun 09, 2006 3:58 am

Thread Safety

Post by Andrew »

Hello,

Some time ago we made some optimizations of code for multi-threading and, at that moment, eliminated all identified problems.
Please send us a simple test project which reproduces the problem you mentioned.
It will help us quickly identify problems and resolve them.

Thank you.
joro
Posts: 63
Joined: Wed Jan 27, 2010 7:35 am

Thread Safety

Post by joro »

FYI

Stimulsoft support has looked into the issue and fixed it.
It will be available in the next prerelease build.

Thanks again for the quick response.
Keep up the good work.

joro
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Thread Safety

Post by Alex K. »

Hello,

We are always glad to help you!
Let us know if you need any additional help.
Thank you.
Post Reply