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

Free Support Forum - aspose.com

ExecuteWithRegions() crashes with Object reference not set to an instance of an object

aspose.zip (95.1 KB)

Attached is example solution with test merge data and test template loaded. When you try to process the template with this merge date this will crash on execute with regions.

However doing either one of the following will stop template from crashing:

  • setting UnconditionalMergeFieldsAndRegions = false
  • removing TravelInsured region from the template
  • removing Secondary recordsets from the merge data
  • fixing broken mergefield ‘RD_MDValuablesUV_TotalSI_JwlWatch_Worldw’

We are aware that underlying issue is that the mentioned mergefield is incorrect (and we are fixing this in our template) however we thought it was strange that the template would process without crashing if we eg. change UnconditionalMergeFieldsAndRegions to false.

We would really appreciate if you could review this case and either change the behavior (prevent processing of the template from crashing) or let us know what is the reason for this behavior so we could double check our code and templates to prevent similar issues in the future.



Thanks for your inquiry. To ensure a timely and accurate response, please attach the following resources here for testing:

  • You are creating the template document using Aspose.Words. Please create and attach template document using MS Word.
  • You have shared your complete project. Please create a simplified console application that helps us to reproduce your problem on our end and attach it here for testing.
  • Please share the data source in the form of XML.

As soon as you get these pieces of information ready, we will start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip and upload them.

Hi Tahir,

this is not a complete project. This is the same simplified console app that we were sending with our other tickets and that was already accepted by you. Unfortunately the cases we log are usually a bit more complex than one method not working. This requires more complicated set up to show you how the issue replicates.

Both XML file and .dotx template are already attached - they are in the InputFiles directory in attached zip.
We are not creating template using Aspose here - there is an MS Word template attached.



Thanks for sharing the detail. We are working over your query and will get back to you soon.


We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-18167. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

is there an update on this issue?


This issue has been resolved and its fix is available in the latest version of Aspose.Words for .NET 19.3.

The issues you have found earlier (filed as WORDSNET-18167) have been fixed in this Aspose.Words for .NET 19.3 update and this Aspose.Words for Java 19.3 update.