Previous versions work fine.
Exception:
Code: Select all
System.AggregateException: One or more errors occurred. (Exception in PdfFonts.GetFontMetrics, font 'Arial' step #50: 'Operations that change non-concurrent collections must have exclusive access. A concurrent update was performed on this collection and corrupted its state. The collection's state is no longer correct.') (Exception in PdfFonts.GetFontMetrics, font 'Arial' step #50: 'Operations that change non-concurrent collections must have exclusive access. A concurrent update was performed on this collection and corrupted its state. The collection's state is no longer correct.') (Exception in PdfFonts.GetFontMetrics, font 'Arial' step #50: 'Operations that change non-concurrent collections must have exclusive access. A concurrent update was performed on this collection and corrupted its state. The collection's state is no longer correct.') (Exception in PdfFonts.GetFontMetrics, font 'Arial' step #50: 'Operations that change non-concurrent collections must have exclusive access. A concurrent update was performed on this collection and corrupted its state. The collection's state is no longer correct.') (Exception in PdfFonts.GetFontMetrics, font 'Arial' step #50: 'Operations that change non-concurrent collections must have exclusive access. A concurrent update was performed on this collection and corrupted its state. The collection's state is no longer correct.')
---> System.Exception: Exception in PdfFonts.GetFontMetrics, font 'Arial' step #50: 'Operations that change non-concurrent collections must have exclusive access. A concurrent update was performed on this collection and corrupted its state. The collection's state is no longer correct.'
at Stimulsoft.Report.Export.PdfFonts.GetFontMetrics(Font font, PdfFontInfo currentFontInfo, UInt16[] glyphMap, Boolean isWpf)
at Stimulsoft.Report.Export.PdfFonts.InitFontsData(Boolean isWpf)
at Stimulsoft.Report.Export.StiPdfExportService.ExportPdf1(StiReport report, Stream stream, StiPdfExportSettings settings)
at Stimulsoft.Report.Export.StiPdfExportService.ExportPdf(StiReport report, Stream stream, StiPdfExportSettings settings)
at Stimulsoft.Report.StiReport.ExportDocument(StiExportFormat exportFormat, StiExportService exportService, Stream stream, StiExportSettings settings)
at Stimulsoft.Report.StiReport.ExportDocument(StiExportFormat exportFormat, Stream stream, StiExportSettings settings)
at Program.CreateReport() in C:\Dev\lnb_new\backend\src\ConsoleApp1\Program.cs:line 47
Code: Select all
public static void Main(string[] args)
{
var tasks = new List<Task>
{
Task.Factory.StartNew(CreateReport),
Task.Factory.StartNew(CreateReport),
Task.Factory.StartNew(CreateReport),
Task.Factory.StartNew(CreateReport),
Task.Factory.StartNew(CreateReport)
};
Task.WaitAll(tasks.ToArray());
Console.WriteLine("Done!");
}
private static Task CreateReport()
{
StiLicense.Key = _licenseKey;
StiOptions.Export.Pdf.CreatorString = "Stimulsoft";
var template = File.ReadAllBytes("Report.mrt");
var report = new StiReport();
report.Load(template);
var memoryStream = new MemoryStream();
report.Render(false);
var settings = new StiPdfExportSettings { PdfComplianceMode = StiPdfComplianceMode.A1 };
report.ExportDocument(StiExportFormat.Pdf, memoryStream, settings);
memoryStream.Seek(0, SeekOrigin.Begin);
return Task.CompletedTask;
}