Concurrency error

Stimulsoft Reports.WEB discussion
Post Reply
FT1
Posts: 11
Joined: Sun Mar 03, 2019 1:44 am

Concurrency error

Post by FT1 »

Hello
We are testing your product in our WCF webservice and we are having problems on concurrency.

Our code is very short and simple:
public static MemoryStream RenderPDF(Stream MRT, MemoryStream XML, String QRText)
{
StiReport report = new StiReport();
report.Load(MRT);
report.Dictionary.Resources["DS"].Content = XML.ToArray();
report.Dictionary.Variables["QR"].Value = QRText;
report.Render(false);
MemoryStream Output = new MemoryStream();
report.ExportDocument(StiExportFormat.Pdf, Output);
return Output;
}

The method work fine but each time the method is called simultaneously by 2 or more request we get errors like this:

1)
error CS2021: File name '@C:\Windows\TEMP\4mzh3hau.cmdline' is too long or invalid
error CS2011: Error opening response file 'c:\Windows\Temp\4mzh3hau.cmdline' -- 'The system cannot find the file specified. '.
at Stimulsoft.Report.StiReport.Compile(String path, Stream stream, StiOutputType outputType, Boolean autoCreate, Object standaloneReportType)

2)
Could not find file 'C:\Windows\TEMP\xtbwvatc.dll'..
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)

3)
error CVT1101: cannot open 'c:\Windows\Temp\CSCDBE6AEDB77A44892BD8CFCDDE99BB9B9.TMP' for reading
error CS1583: 'c:\Windows\Temp\CSCDBE6AEDB77A44892BD8CFCDDE99BB9B9.TMP' is not a valid Win32 resource file
warning CS1610: Unable to delete temporary file 'c:\Windows\Temp\CSCDBE6AEDB77A44892BD8CFCDDE99BB9B9.TMP' used for default Win32 resource --
The system cannot find the file specified. .
at Stimulsoft.Report.StiReport.Compile(String path, Stream stream, StiOutputType outputType, Boolean autoCreate, Object standaloneReportType)

4)
error CS2001: Source file 'C:\Windows\TEMP\av1qgpue.0.cs' could not be found
warning CS2008: No source files specified.
at Stimulsoft.Report.StiReport.Compile(String path, Stream stream, StiOutputType outputType, Boolean autoCreate, Object standaloneReportType)

We also tested modifying the Instance Context and Concurrency Mode but the error keep the same. Already tested:
[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall,ConcurrencyMode = ConcurrencyMode.Single)]
[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single,ConcurrencyMode = ConcurrencyMode.Single)]
[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerSession,ConcurrencyMode = ConcurrencyMode.Multiple)]


After browsing your forum for a few minutes we found a reference for this article: "208093845-Using-report-assemblies" so we proceed to open a MRT file in the WindowsForms designer and saving it as .dll file
We also modified our code to this:
public static MemoryStream RenderPDF2(Assembly DLL, MemoryStream XML, String QRText)
{
StiReport report = StiReport.GetReportFromAssembly(DLL);
report.Dictionary.Resources["DS"].Content = XML.ToArray();
report.Dictionary.Variables["QR"].Value = QRText;
report.Render(false);
MemoryStream Output = new MemoryStream();
report.ExportDocument(StiExportFormat.Pdf, Output);
return Output;
}

But, we get an error on the first line:
Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
at System.Reflection.RuntimeModule.GetTypes()
at System.Reflection.Assembly.GetTypes()
at Stimulsoft.Report.StiReport.GetReportsFromAssembly(Assembly assembly) in D:\Stimulsoft\Stimulsoft.Reports\Stimulsoft.Report\StiReport.SaveLoad.cs:line 628
at Stimulsoft.Report.StiReport.GetReportFromAssembly(Assembly assembly) in D:\Stimulsoft\Stimulsoft.Reports\Stimulsoft.Report\StiReport.SaveLoad.cs:line 651
at RPTTest.Librerias.RenderPDF2(Assembly MRT, MemoryStream XML, String QRText)

In order to you reproduce the error I'm attaching to this post the MRT, the DLL and the XML.
Additional information:
The QRText can be any string
The MRT works fine on our first version of the code, we only get error on simultaneous request
The DLL was generated from the MRT using the Winforms Designer

Your reply can be oriented to solve the concurrency problem (we keep using the MRT) or the GetReportFromAssembly (we switch to DLL )

Best Regards

Francesco Tradardi
Attachments
resources.zip
(24.99 KiB) Downloaded 133 times
Lech Kulikowski
Posts: 6247
Joined: Tue Mar 20, 2018 5:34 am

Re: Concurrency error

Post by Lech Kulikowski »

Hello,

We need some time to investigate the issue, we will let you know about the result.

Thank you.
Lech Kulikowski
Posts: 6247
Joined: Tue Mar 20, 2018 5:34 am

Re: Concurrency error

Post by Lech Kulikowski »

Hello,

There are problems with WCF and compilation on different systems.
We recommend using the Interpretation mode instead of Compilation.

> Your reply can be oriented to solve the concurrency problem (we keep using the MRT) or the GetReportFromAssembly (we switch to DLL )

Please send us a full sample project which reproduces the issue for analysis.

Thank you.
FT1
Posts: 11
Joined: Sun Mar 03, 2019 1:44 am

Re: Concurrency error

Post by FT1 »

Oh well,
Interpretation mode turn us back to not been able to select a particular position in a table since the expression "{Document_NOT.DataTable.Rows[1]["Note"]}" is not compatible with that mode
Back to step one, any thoughts?
Why is not possible to load the pre-compiled report?
Regards
Lech Kulikowski
Posts: 6247
Joined: Tue Mar 20, 2018 5:34 am

Re: Concurrency error

Post by Lech Kulikowski »

Hello,

Please send us a full sample project which reproduces the issue for analysis.

Thank you.
FT1
Posts: 11
Joined: Sun Mar 03, 2019 1:44 am

Re: Concurrency error

Post by FT1 »

Hello, you have the sample report on resources.zip and the sample code on the body of the post, isn't that enough?
Lech Kulikowski
Posts: 6247
Joined: Tue Mar 20, 2018 5:34 am

Re: Concurrency error

Post by Lech Kulikowski »

Hello,

No, we need a full sample project which reproduces the issue.

Thank you.
Post Reply