Free Support Forum - aspose.com

(C#/.Net Core) Creating Presentations in AWS Lambda environment does not work (libdl missing)

Hi all,

I’m currently trying to create presentation out of a AWS Lambda function. Unfortunately, during the initialization of Aspose.Slides, a Exception is thrown:

One or more errors occurred. (The type initializer for ‘Gdip’ threw an exception.): AggregateException
at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
at lambda_method(Closure , Stream , Stream , LambdaContextInternal )

at System.Drawing.SafeNativeMethods.Gdip.GdipCreateBitmapFromScan0(Int32 width, Int32 height, Int32 stride, Int32 format, HandleRef scan0, IntPtr& bitmap)
at System.Drawing.Bitmap…ctor(Int32 width, Int32 height, PixelFormat format)
at Aspose.Slides.Slide.GetThumbnail(Size imageSize)
at .( , IPresentation )
at .(IPresentation , Stream , PresentationTypeEx , IPptxOptions , InterruptionToken )
at Aspose.Slides.Presentation.Save(Stream stream, SaveFormat format, ISaveOptions options)
at Aspose.Slides.Presentation.Save(String fname, SaveFormat format)
at serverless_pptexporter_processor_csharp.Function.FunctionHandler(String input, ILambdaContext context) in C:\Users\Max\source\repos\ppt\ppt\Function.cs:line 54
Unable to load shared library ‘libdl’ or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: liblibdl: cannot open shared object file: No such file or directory: DllNotFoundException
at Interop.Libdl.dlopen(String fileName, Int32 flag)
at System.Drawing.SafeNativeMethods.Gdip.LoadNativeLibrary()
at System.Drawing.SafeNativeMethods.Gdip…cctor()

It looks like the dependency “Libdl” is missing or can’t be found in this linux environment. I’ve already added the NuGet package “System.Drawing.Common” to my project, but this didn’t help.

Does anybody know how to get this working?

Thank you
Best regards
Max

@maxpower7,

I have observed the issue shared by you and request you to please provide the sample project and source presentation (if any) that is reproducing the issue on your end. We will be able to investigate the issue further on our end on provision of requested information.

@mudassir.fayyaz, thanks a lot for your help

Attached is the sample VS project. The source code is very simple:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

using Amazon.Lambda.Core;
using Aspose.Slides;
using Aspose.Slides.Export;

// Assembly attribute to enable the Lambda function’s JSON input to be converted into a .NET class.
[assembly: LambdaSerializer(typeof(Amazon.Lambda.Serialization.Json.JsonSerializer))]

namespace AsposeSlides_AWSLambda_CSharp
{
public class Function
{

    public string FunctionHandler(string input, ILambdaContext context)
    {

        Presentation presentation = new Presentation();
        ISlide slide = presentation.Slides[0];
        presentation.Save("/tmp/NewPresentation_out.pptx", SaveFormat.Pptx);
        
        return "Done";
    }
}

}

I did not use a source presentation.
Thanks again for your support!

@maxpower7,

Thank you sharing the information. An issue with ID SLIDESNET-41073 has been created in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be notified once the issue will be fixed.

Thanks @mudassir.fayyaz

Please let me know, as soon as you know, if this is a issue that has to be fixed on your end or if it is just a configuration problem. I’d like to order the paid version of Aspose.Slides but this requirements is mandatory for me. If it`s a bug and takes some time, I’m probably have to choose another tool or the Java version of Aspose. However, I’d prefer to use the C# version of Aspose.Slides. Thank you

@maxpower7,

Sure, we will share good news with you soon.

Hi @Adnan.Ahmad , I just wanted to check if this has been fixed. Thanks

@simon.melcher,

Thank you for sharing the feedback.

@mudassir.fayyaz,

I did not give a feedback :slight_smile: I was just asking for the status of this issue.

Thank you

@simon.melcher,

I regret to share that at present the issue is still unresolved. We request for your patience till the time the issue gets resolved.

Hi @mudassir.fayyaz,

I’m also facing the same issue.what is status of the isssue.

@Harshavardhan_Reddy,

I have verified from our issue tracking system and regret to share that at present the issue is unresolved. We request for your patience till the time the issue gets resolved. We will share notification with you as soon as the issue will be fixed.