Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RazorEngine System.OutOfMemoryException #77

Open
pacharbit opened this issue Jan 13, 2023 · 1 comment
Open

RazorEngine System.OutOfMemoryException #77

pacharbit opened this issue Jan 13, 2023 · 1 comment

Comments

@pacharbit
Copy link

pacharbit commented Jan 13, 2023

Hi, I have a problem when generating reports with SealLibrary. Compiling Razor views seems to be a problem (see below).
Our architecture:

an API project (.Net6),
that implements an in-house report generation project ("ReportBuilder" ) (.Net6),
that implements a generic in-house reportbuilder package ("Net.Report.Builder") (.Net6),
which integrates SealReportLibrary.NETCore 6.7.2.

When we execute directly the ReportBuilder project in debug mode from VS (or call the ReportBuilder.exe via cmd), the reports are well generated.
Do you have an idea ?
Many thanks for your help.
Pierre

2023-01-12 17:44:32.6537|0|ERROR|ReportBuilder.ReportLauncher|BuildReport|Error: System.OutOfMemoryException: Insufficient memory to continue the execution of the program.
at System.Runtime.InteropServices.Marshal.AllocHGlobal(IntPtr cb)
at System.Runtime.InteropServices.Marshal.AllocHGlobal(Int32 cb)
at System.Reflection.Internal.StreamMemoryBlockProvider.ReadMemoryBlockNoLock(Stream stream, Boolean isFileStream, Int64 start, Int32 size)
at System.Reflection.PortableExecutable.PEReader..ctor(Stream peStream, PEStreamOptions options, Int32 size)
at Microsoft.CodeAnalysis.ModuleMetadata.CreateFromStream(Stream peStream, PEStreamOptions options)
at RazorEngine.Roslyn.CSharp.RoslynCompilerServiceBase.SelectMetadataReference.Visit(Assembly assembly)
at RazorEngine.Compilation.ReferenceResolver.CompilerReference.DirectAssemblyReference.Visit[T](ICompilerReferenceVisitor1 visitor) at RazorEngine.Roslyn.CSharp.RoslynCompilerServiceBase.<>c.<GetMetadataReferences>b__8_0(CompilerReference reference) at System.Linq.Enumerable.SelectListIterator2.ToArray()
at System.Linq.Enumerable.ToArray[TSource](IEnumerable1 source) at RazorEngine.Roslyn.CSharp.RoslynCompilerServiceBase.GetMetadataReferences(IEnumerable1 references)
at RazorEngine.Roslyn.CSharp.RoslynCompilerServiceBase.CompileType(TypeContext context)
at RazorEngine.Templating.RazorEngineCore.CreateTemplateType(ITemplateSource razorTemplate, Type modelType)
at RazorEngine.Templating.RazorEngineCore.Compile(ITemplateKey key, Type modelType)
at RazorEngine.Templating.RazorEngineService.CompileAndCacheInternal(ITemplateKey key, Type modelType)
at RazorEngine.Templating.RazorEngineService.GetCompiledTemplate(ITemplateKey key, Type modelType, Boolean compileOnCacheMiss)
at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
at RazorEngine.Templating.DynamicWrapperService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.b__0(TextWriter writer)
at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
at Net.Report.Builder.ReportBuilderBase.AddHeader(PdfConverter converter)
at Net.Report.Builder.ReportBuilderBase.SetPdfConfiguration(PdfConverter converter)
at Net.Report.Builder.ReportBuilderBase.GeneratePDFResult()
at Net.Report.Builder.ReportBuilderBase.GenerateReport(ReportFormat format)
at ReportBuilder.Reports.ReportGenerator.GenerateReport(IReportBuilder reportBuilder, Parameters parameters) in C:\dev\ReportBuilder\Reports\ReportGenerator.cs:line 66
at ReportBuilder.Reports.ReportGenerator.Generate(Parameters parameters) in C:\dev\ReportBuilder\Reports\ReportGenerator.cs:line 24

@ariacom
Copy link
Owner

ariacom commented Mar 8, 2024

Check that your report models do not return a huge amount of data.
Normally 10'000 rows is a certain limit, it has no sense to return more data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants