We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

NullReferenceException when removing a shape that has animation


We are currently having a issue with the latest Aspose.Slides library (version when removing a shape that has animation set to it.

Here are two code samples that reproduce the issue:

- Scenario 1: the PowerPoint document already contains a shape that has animation:

private static void Scenario1()
var presentation = new PresentationEx(“shapeWithAnimation.pptx”);
var slide = presentation.Slides[0];


presentation.Save(“shapeWithAnimation-2.pptx”, SaveFormat.Pptx);

- Scenario 2: the PowerPoint document contains a shape without animation; animation is added via code:

private static void Scenario2()
var presentation = new PresentationEx(“shapeWithoutAnimation.pptx”);
var slide = presentation.Slides[0];
var shape = slide.Shapes[0];

slide.Timeline.MainSequence.AddEffect(shape, EffectTypeEx.Fly, EffectSubtypeEx.Bottom, EffectTriggerTypeEx.OnClick);


presentation.Save(“shapeWithoutAnimation-2.pptx”, SaveFormat.Pptx);

In both cases the presentation.Save(…) call fails with the following exception:

System.NullReferenceException was unhandled
Message=Object reference not set to an instance of an object.
at Aspose.Slides.Pptx.Animation.TimeLineEx. ( tl)
at Aspose.Slides.Pptx.SlideEx. ( saveContext)
at Aspose.Slides.Pptx.PresentationEx. ( context, outputType)
at Aspose.Slides.Pptx.PresentationEx.Write(Stream stream, type, PptxOptions options)
at Aspose.Slides.Pptx.PresentationEx.Save(Stream stream, SaveFormat format, SaveOptions options)
at Aspose.Slides.Pptx.PresentationEx.Save(String fname, SaveFormat format)
at Console_AsposeTests.AsposeSlides.Scenario1() in c:\WORK\WORK_TEST\TestProj1\Console_AsposeTests\AsposeSlides.cs:line 24
at Console_AsposeTests.AsposeSlides.Run() in c:\WORK\WORK_TEST\TestProj1\Console_AsposeTests\AsposeSlides.cs:line 14
at Console_AsposeTests.Program.Main() in c:\WORK\WORK_TEST\TestProj1\Console_AsposeTests\Program.cs:line 15
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()

The expected result is that the Save operation should not fail and the saved object should not contain the removed shape.

Thank you,
Bogdan Rusu,
IBM Romania.

Hi Bogdan Rusu,

I have worked with the presentation files shared by you and have been able to reproduce the issue specified. An issue with ID SLIDESNET-34153 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 automatically notified once the issue will be resolved.

We are sorry for your inconvenience,

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

This message was posted using Notification2Forum from Downloads module by Aspose Notifier.