Free Support Forum - aspose.com

AddClone method throws an exception for a specific slide

Hi,

We recently migrated from Aspose.slides for .NET v16.4 to v.18.6.

However after migration when we tested our code that creates a pptx file by cloning slides from another pptx file, the addclone method fails with below exception on Slide 12. Attaching the source PPTX file here.

As you can see, there is only stack trace but no exception message. Please help us to understand why this exception occurs.

at Aspose.Slides. .wa8r69bpjelbwra2fgpw8kanh2e4nd6x ​ (Theme )
at Aspose.Slides. .( )
at Aspose.Slides.Theme.Theme.()
at Aspose.Slides.Theme.BaseOverrideThemeManager.CreateThemeEffective()
at Aspose.Slides.BaseSlide.(SchemeColor )
at Aspose.Slides. .( )
at Aspose.Slides. .get_Color()
at Aspose.Slides.ColorFormat.get_Color()
at Aspose.Slides. .4hmw786gb6bg6nl44xwpa7lnuad2ke5c ​ (IColorFormat , IColorFormat )
at Aspose.Slides. .Equals( , )
at Aspose.Slides. .4hmw786gb6bg6nl44xwpa7lnuad2ke5c ​ (ILineFillFormat , ILineFillFormat )
at Aspose.Slides. .Equals( , )
at Aspose.Slides. .4hmw786gb6bg6nl44xwpa7lnuad2ke5c ​ (ILineFormat , ILineFormat )
at Aspose.Slides. .Equals( , )
at System.Collections.Generic.Dictionary2.FindEntry(TKey key) at System.Collections.Generic.Dictionary2.TryGetValue(TKey key, TValue& value)
at Aspose.Slides. .97y2mnxmm9m9kvpy29a5r9zkdkwz6n54 ​ (& )
at Aspose.Slides.​ .(IShape , , )
at Aspose.Slides. .(IConnector , , ​ )
at Aspose.Slides. .( ​ , IGroupShape , ​ )
at Aspose.Slides. .(IGroupShape , , ​ )
at Aspose.Slides.​ .(IBaseSlide , , ​ )
at Aspose.Slides. .(Slide )
at Aspose.Slides. .(IPresentation , ILayoutSlide , ISlide )
at Aspose.Slides.SlideCollection.AddClone(ISlide sourceSlide, ILayoutSlide destLayout)
at Aspose.Slides.SlideCollection.AddClone(ISlide sourceSlide, IMasterSlide destMaster, Boolean allowCloneMissingLayout)
at Aspose.Slides.SlideCollection.AddClone(ISlide sourceSlide)
at KP360.eMed.STP.Files.DownloadManager.ConvertToPPTx(EOMPresentation presentation, EntUser user)Updated CaseBasedDeck Speaker Version_Slide12_CloneFails.zip (9.9 MB)

Thanks!
Florence

@jonathan.alfisi,

I have observed your comments. Can you please share sample project to reproduce issue so that we may further investigate to help you out.

Hi Adnan,

Using Slide number 12 from the attached presentation, try creating a new presentation using addclone() method for slide #12. You should be seeing the issue. The Aspose slides for .NET version is v 18.6.

We cant share our source code as it is and we don’t have ample time to help you debug the issue, by writing sample code for you.

We purchased this recently to overcome the bugs with V16.4. But v18.6 is breaking badly.

Please provide an update asap.

Thanks!
Florence

@jonathan.alfisi,

I have worked with source file shared by you using Aspose.Slides for .NET 18.7 and unable to observe any issue. I have also shared my generated result and sample code with you for your kind reference. Please check attachment. Can you please try to use Aspose.Slides latest version 18.7 on your end and if there is still an issue than please share environment details with us so that we may further investigate to help you out.Aspose_outclone12.zip (6.0 MB)Clone.zip (475 Bytes)

Hi Adnan,

Thanks, we will try and let you know how it behaves with v 18.7.

Thanks!
Florence

Hi Adnan,

Slide # is 11, not 12. I was able to reproduce it with v 18.6 as well as v18.7.

using (Presentation srcPres = new Presentation(@“C:\Work\SP\8f8453c5-4fe5-47f8-8175-e5b16edab230~09US18EBP0040_Updated CaseBasedDeck Speaker Version.pptx”))
{

            //Instantiate Presentation class for destination PPTX (where slide is to be cloned)
            using (Presentation destPres = new Presentation(@"C:\Work\SP\8f8453c5-4fe5-47f8-8175-e5b16edab230~09US18EBP0040_Updated CaseBasedDeck Speaker Version.pptx"))
            {
                //Clone the desired slide from the source presentation to the end of the collection of slides in destination presentation

                int slidecount = destPres.Slides.Count;
                for (int i = 1; i < slidecount; i++)
                {
                    destPres.Slides.RemoveAt(slidecount - i);
                }
                ISlideCollection slds = destPres.Slides;

                slds.AddClone(srcPres.Slides[10]);
                destPres.Slides.RemoveAt(0);

                //Write the destination presentation to disk
                destPres.Save(@"C:\Work\SP\FinalOutput.ppsx", SaveFormat.Ppsx);

                return View();
            }
        }
    }

Exception:

Source Error:

Line 30: ISlideCollection slds = destPres.Slides;
Line 31:
Line 32: slds.AddClone(srcPres.Slides[10]);
Line 33: destPres.Slides.RemoveAt(0);
Line 34:

Source File: C:\Florence\AsposeClone\AsposeClone\Controllers\Default1Controller.cs Line: 32

Stack Trace:

[NullReferenceException: Object reference not set to an instance of an object.]
Aspose.Slides.BaseSlide.get_Presentation() +51
Aspose.Slides. .gdkjy92pcy8czf6mmz2d5n35dzrbe4rj ​(Theme ) +1339
Aspose.Slides. .() +351
Aspose.Slides.Theme.Theme.() +114
Aspose.Slides.Theme.BaseOverrideThemeManager.CreateThemeEffective() +46
Aspose.Slides.BaseSlide.CreateThemeEffective() +55
Aspose.Slides.BaseSlide.(SchemeColor ) +167
Aspose.Slides. .( ) +1239
Aspose.Slides. .() +43
Aspose.Slides. .get_Color() +57
Aspose.Slides.ColorFormat.get_Color() +112
Aspose.Slides. .bqgmrp7h66c2z6nv2b2lqu8jknq5tu2u ​(IColorFormat , IColorFormat ) +113
Aspose.Slides. .Equals( , ) +166
Aspose.Slides. .bqgmrp7h66c2z6nv2b2lqu8jknq5tu2u ​(ILineFillFormat , ILineFillFormat ) +170
Aspose.Slides. .Equals( , ) +166
Aspose.Slides. .bqgmrp7h66c2z6nv2b2lqu8jknq5tu2u ​(ILineFormat , ILineFormat ) +821
Aspose.Slides. .Equals( , ) +166
System.Collections.Generic.Dictionary2.FindEntry(TKey key) +195 System.Collections.Generic.Dictionary2.TryGetValue(TKey key, TValue& value) +13
Aspose.Slides. .d2whtzh367ekgf7awt9vdlgr4jkeqy47 ​(& ) +94
Aspose.Slides. .(IShape , ​ , ) +327
Aspose.Slides. .(IGeometryShape , ​ , ) +69
Aspose.Slides. .(IConnector , ​ , ) +196
Aspose.Slides. .( ​ , IGroupShape , ) +2215
Aspose.Slides. .(IGroupShape , ​ , ) +921
Aspose.Slides. .(IBaseSlide , , ) +362
Aspose.Slides. .(Slide ) +322
Aspose.Slides. .(IPresentation , ILayoutSlide , ISlide ) +697
Aspose.Slides.SlideCollection.AddClone(ISlide sourceSlide, ILayoutSlide destLayout) +346
Aspose.Slides.SlideCollection.AddClone(ISlide sourceSlide, IMasterSlide destMaster, Boolean allowCloneMissingLayout) +1537
Aspose.Slides.SlideCollection.AddClone(ISlide sourceSlide) +790
AsposeClone.Controllers.Default1Controller.Index() in C:\Florence\AsposeClone\AsposeClone\Controllers\Default1Controller.cs:32
lambda_method(Closure , ControllerBase , Object[] ) +101
System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +59
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary2 parameters) +435 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary2 parameters) +60
System.Web.Mvc.<>c__DisplayClassd.b__a() +145
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func1 continuation) +433 System.Web.Mvc.<>c__DisplayClassf.<InvokeActionMethodWithFilters>b__c() +72 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList1 filters, ActionDescriptor actionDescriptor, IDictionary2 parameters) +323 System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +844 System.Web.Mvc.Controller.ExecuteCore() +130 System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +123 System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +39 System.Web.Mvc.<>c__DisplayClass8.<BeginProcessRequest>b__4() +68 System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +41 System.Web.Mvc.Async.<>c__DisplayClass81.b__7(IAsyncResult _) +39
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +137
System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +56
System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +37
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +63
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +38
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9748741
System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +48
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +159

Thanks!
Florence

@jonathan.alfisi,

I have worked with sample code shared by you using Aspose.Slides for .NET 18.7 and unable to observe any issue. I have also shared my generated result with you for your kind reference. Can you please share environment details with us for further investigation so that we can help you out.FinalOutput.zip (4.7 MB)

Hi Adnan,

We are using visual studio 2010. The MVC website is on .NET Framework 4.

Hosted on IIS 8.5 in Windows Server 2012 R2. It is also reproducible on my local machine - Windows 7 Professional SP1.

The issue is happening at slide 11, not 12. I hope you tried with slide 11(Index 10) only.

Please let me know if you need additional details.

Thanks!
Florence

@jonathan.alfisi,

I have observed your comments. An issue with ID SLIDESNET-40428 has been added in our issue tracking system to further investigate and help you out in this matter. This thread has been linked with the issue so that you may be automatically notified once the issue will be resolved.

Hi Adnan,

We are on a very tight scehdule, we cant indefinitely wait without knowing an ETA on the issue.
We migrated to v18.6 to get rid of issue with v16.4.
With v18.6 (and .7) failing in places were v16.4 worked, we are at the risk of losing our customers.

Could you please confirm if you are able to see the issue? Also, please provide a time frame when the fix will be available.

Thanks!
Florence

@jonathan.alfisi,

I have observed your comments and like to inform that i am unable to observe any issue. We will investigate issue in more details so that we can help you out. I also like to inform that in Aspose.Slides forum the issues are selected for investigation on first come first serve basis. Also the first priority for scheduling and resolution is given to paid Enterprise and priority support customers. Then Aspose.Slides normal or free support customers issues are scheduled and resolved on first come and first come serve basis. I will share the further information regarding ETA with you as soon.

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