Free Support Forum - aspose.com

Slides constructor throws System.NullReferenceException if InterruptionToken will be interrupted while constructor is working

Hello,

i passed a InterruptionTokenSource to SlideConversionLoadOptions and use the options in the Presentation constructor. If the InterruptionTokenSource will be cancelled while the constructor is working, the constructor throws a System.NullReferenceException.

This occurs only if the file is large (18 MB) and the constructor takes a while and only the FIRST time i call the Presentation constructor.

This error occurs after update to version 20.7.0.0 (Slides).

Knd Regards,
Andy

@AStelzner

Can you please try using latest Aspose.Slides for .NET 20.8 on your end. In case the issue persist, please provide the sample project along with source presentation reproducing the issue on your end.

Hello,

updated to 20.8, behavior is the same.

The sample (see code below, replace Powerpoint) is very simple :wink:

Here you can see, that if the Token is already interrupted or will be interrupted during constructor is running if Powerpoint is very large (in my real project), a System.NullReferenceException will be thrown.
A OperationCancelledException would be nicer :wink:

class Program
{
    static void Main(string[] args)
    {
        var interruptionTokenSource = new InterruptionTokenSource();
        var loadOptions = new SlideConversionLoadOptions(interruptionTokenSource.Token);
        interruptionTokenSource.Interrupt();
        
        try
        {
            var presentation = new Presentation("Test.ppt", loadOptions);
        }
        catch (Exception exception)
        {
            Console.WriteLine(exception);
        }
    }
}

internal class SlideConversionLoadOptions : LoadOptions
{
    public SlideConversionLoadOptions(IInterruptionToken interruptionToken)
    {
        InterruptionToken = interruptionToken;
    }
}

Kind Regards,
Andy

@AStelzner

Can you please provide the source presentation file that has been used in test so that I may add a ticket for investigation in our issue tracking system after verifying it.

With this presentation the behavior can be reproduced:

PP_3.zip (5.6 MB)

Kind regards,
Andy

@AStelzner

An issue with ID SLIDESNET-42135 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.

The issues you have found earlier (filed as SLIDESNET-42135) have been fixed in this update.