FastReport icon indicating copy to clipboard operation
FastReport copied to clipboard

OutOfMemoryException System.Drawing.Graphics.Save .NET6 System.Drawing.EnableUnixSupport Docker

Open lukasz-walkowiak opened this issue 4 years ago • 3 comments

I have an error when generating report in ASP.NET Core MVC application in .NET6 on docker Linux platform. I added "System.Drawing.EnableUnixSupport": true in runtimeconfig.template.json file. The error is

System.OutOfMemoryException: Out of memory. at System.Drawing.Graphics.Save() at FastReport.GdiGraphics.Save() at FastReport.TextObject.CalcSize() at FastReport.TextObject.CalcHeight() at FastReport.BandBase.CalcHeight() at FastReport.Engine.ReportEngine.PrepareBand(BandBase band, Boolean getData) at FastReport.Engine.ReportEngine.ShowBandToPreparedPages(BandBase band, Boolean getData) at FastReport.Engine.ReportEngine.ShowBand(BandBase band, Boolean getData) at FastReport.Engine.ReportEngine.ShowBand(BandBase band) at FastReport.Engine.ReportEngine.RunDataBand(DataBand dataBand, Int32 rowCount, Boolean keepFirstRow, Boolean keepLastRow) at FastReport.Engine.ReportEngine.RunDataBand(DataBand dataBand) at FastReport.Engine.ReportEngine.RunBands(BandCollection bands) at FastReport.Engine.ReportEngine.RunReportPage(ReportPage page) at FastReport.Engine.ReportEngine.RunReportPages() at FastReport.Engine.ReportEngine.RunReportPages(ReportPage page) at FastReport.Engine.ReportEngine.Run(Boolean runDialogs, Boolean append, Boolean resetDataState, ReportPage page) at FastReport.Report.Prepare(Boolean append) at FastReport.Web.Controllers.ReportController.<.ctor>b__0_0()

lukasz-walkowiak avatar Jun 13 '22 15:06 lukasz-walkowiak

Hello!

Try to build libgdiplus manually This should fix the problem example:

FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base
WORKDIR /app
RUN 
EXPOSE 80
EXPOSE 443

RUN apt update
RUN apt install -y libgif-dev autoconf libtool automake build-essential gettext libglib2.0-dev libcairo2-dev libtiff-dev libexif-dev libpango1.0-dev git
RUN git clone https://github.com/mono/libgdiplus.git
WORKDIR ./libgdiplus
RUN ./autogen.sh --with-pango --prefix=/usr
RUN make
RUN make install

Best regards Marat

MaratAlaev avatar Jul 05 '22 20:07 MaratAlaev

Yes, I can confirm, that the problem is with old version of libgdiplus library. I use docker image with .Net 6 and Debian 12 distribution, this version has installed libgdiplus 6.0.4. I updated manually version to 6.12.0. This is my implementation of dockerfile:

FROM mcr.microsoft.com/dotnet/aspnet:6.0-bullseye-slim AS base

RUN apt-get update && apt-get remove libgdiplus -y && apt autoremove -y && apt-get install -y apt-transport-https dirmngr gnupg ca-certificates 
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF 
RUN echo "deb https://download.mono-project.com/repo/debian stable-buster main" | tee /etc/apt/sources.list.d/mono-official-stable.list
RUN apt-get update && apt-get install -y mono-devel

lukasz-walkowiak avatar Jul 06 '22 18:07 lukasz-walkowiak

I use the following command to pull, the build is successful, but I see the version is still 6.0.4, is there a problem with my operation? RUN git clone https://github.com/mono/libgdiplus.git && cd libgdiplus && git checkout release/6.1

naruto1227 avatar Mar 31 '24 00:03 naruto1227