Converting a PowerPoint Presentation to PDF in C# Crashes on Debian

I cannot share, because it’s not a docker solution,
but I can describe all the steps to reproduce.

Short Description
Deploy self-contained .NET package to the azure python 3.10 application service with libfontconfig1 and libfreetype6 installed and see that application is failing to run with the next error:

terminate called after throwing an instance of ‘std::logic_error’
what(): basic_string::_M_construct null not valid
Aborted (core dumped)

When executed empty pdf file is generated, so library is actually called but cannot be used because of this critical error :frowning:
Windows build is working fine with the same powerpoint file.

Details

Next code is used:

using (var presentation = new Aspose.Slides.Presentation(sourcePresentation))
{
    // save the presentation to PDF
    presentation.Save(outputFile, Aspose.Slides.Export.SaveFormat.Pdf);
}

Project settings:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net6.0</TargetFramework>
    <RootNamespace>tool</RootNamespace>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Aspose.Slides.NET6.CrossPlatform" Version="23.11.0" />
  </ItemGroup>

</Project>

Self-contained package is created in windows using next command:

dotnet publish -r linux-x64 -o ../backend/tools/linux-x64 -c Release --self-contained true -p:PublishSingleFile=true

Environment

Create next azure service:

web app service python 3.10

This will deploy next env:

PRETTY_NAME=“Debian GNU/Linux 11 (bullseye)”
NAME=“Debian GNU/Linux”
VERSION_ID=“11”
VERSION=“11 (bullseye)”
VERSION_CODENAME=bullseye
ID=debian

Deploy application: Self-contained .net tool package and powerpoint slides example using next command

az webapp up --name {your web app name}

  • Connect in azure using ssh (there is an option in the web app interface)

  • Install next packages

sudo apt-get install libfontconfig1
sudo apt-get install libfreetype6

  • Try to run tool to convert example powerpoint

You might have issue with failing to resolve is packed as self-contained package.
To avoid using ‘import native libraries bug’ libraries that are distributed are renamed from libaspose.slides.drawing.capi_x86_64_libstdcpp_libc2.23 to liblibaspose.slides.drawing.capi_x86_64_libstdcpp_libc2.23 and next path is set before executing a tool:

export LD_LIBRARY_PATH=/home/site/wwwroot/

After that whel all libraries references are resolved I have next exception:

terminate called after throwing an instance of ‘std::logic_error’
what(): basic_string::_M_construct null not valid
Aborted (core dumped)

Empty pdf is created.

@IevgenN,
Thank you for contacting support.

To help us reproduce the error on our end and investigate the case faster, could you please share a sample project and presentation file you used?

2 posts were split to a new topic: Converting a PowerPoint Presentation to PDF in C# Crashes on Linux

@andrey.potapov don’t have a file now, but it’s dummy project with the two lines to convert pptx to pdf.
Config of the project is attached (.NET 6.0 is used)

It’s fails on Debian and empty PDF is generated.

@IevgenN,
Thank you for the additional information, I will get back to you soon.

@IevgenN,
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): SLIDESNET-44395

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

Hello,

I have the same Issu.

I try to buld a docker with a simple code to convert PPTX to PDF
And get the same error.

Do you have an Example Dockerfile where we can let run this code?

@Tivian_XI,
The issue has been planned to be fixed in Aspose.Slides for .NET 24.2. This release will be published in the second half of February.

With Aspose.Slides for .NET 23.10 (from the ZIP package), you can use the following Dockerfile for Debian:

FROM mcr.microsoft.com/dotnet/sdk:6.0-bookworm-slim AS build

WORKDIR /source
COPY *.csproj .
RUN dotnet restore
COPY . .
RUN dotnet publish --no-restore -o /app

FROM mcr.microsoft.com/dotnet/runtime:6.0-bookworm-slim

RUN apt-get update && apt-get install -y \
 libfontconfig1 \
 libfreetype6

WORKDIR /app
COPY --from=build /app .

ENTRYPOINT ["./CrossPlatformApp"]

The issues you found earlier (filed as SLIDESNET-44395) have been fixed in Aspose.Slides for .NET 24.2 (ZIP, MSI).
You can check all fixes on the Release Notes page.
You can also find the latest version of our library on the Product Download page.

Thank you very much for the verry quick fix.

It works fine!

But it is slower then under windows.
It is possible to make it faster?

@Tivian_XI,
I am working on the question and will get back to you soon.

@Tivian_XI,
Thank you for your patience. Could you please provide more details to reproduce the problem you are experiencing? It would be great if you described the problem in a new forum thread.

1 Like