We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Cloning a document fails with NullReferenceException

Thread ID:





98226 Feb 15,2011 05:33 PM UTC Jun 9,2011 08:28 AM UTC ASP.NET Web Forms (Classic) 6
Tags: DocIO
Asked On February 15, 2011 05:33 PM UTC

I am currently evaluating DocIO and I found a problems when trying to clone a document.

The following code fails on the second line with a null reference exception:

IWordDocument templateDoc = new WordDocument(templatePath);
WordDocument saveDoc = templateDoc.Clone();

The details of the exception are:

System.NullReferenceException was unhandled
Message="Object reference not set to an instance of an object."
at Syncfusion.DocIO.DLS.XmlParagraphItem.CloneImpl()
at Syncfusion.DocIO.DLS.ParagraphItemCollection.CloneItemsTo(ParagraphItemCollection items)
at Syncfusion.DocIO.DLS.WParagraph.CloneParagraph(Boolean cloneItems)
at Syncfusion.DocIO.DLS.WParagraph.CloneImpl()
at Syncfusion.DocIO.DLS.EntityCollection.CloneTo(EntityCollection destColl)
at Syncfusion.DocIO.DLS.WTextBody.CloneImpl()
at Syncfusion.DocIO.DLS.WSection.CloneImpl()
at Syncfusion.DocIO.DLS.EntityCollection.CloneTo(EntityCollection destColl)
at Syncfusion.DocIO.DLS.WordDocument.ImportContent(IWordDocument doc, Boolean importStyles)
at Syncfusion.DocIO.DLS.WordDocument..ctor(WordDocument doc)
at Syncfusion.DocIO.DLS.WordDocument.CloneImpl()
at Syncfusion.DocIO.DLS.WordDocument.Clone()
at TestMailMergeApp.frmTestMailMerge.RunMergeWithDocIO(Int32 recordCount) in C:\Users\NWhymark\Documents\Visual Studio 2008\Projects\TestMailMerge\TestMailMergeApp\frmTestMailMerge.cs:line 174
at TestMailMergeApp.frmTestMailMerge.btnRunDocIo_Click(Object sender, EventArgs e) in C:\Users\NWhymark\Documents\Visual Studio 2008\Projects\TestMailMerge\TestMailMergeApp\frmTestMailMerge.cs:line 263
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at TestMailMergeApp.Program.Main() in C:\Users\NWhymark\Documents\Visual Studio 2008\Projects\TestMailMerge\TestMailMergeApp\Program.cs:line 21
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()

Any help appreciated.

Poornima R [Syncfusion]
Replied On February 16, 2011 06:10 AM UTC

Hi John,

Thank you for your interest in Syncfusion Products.

Could you please provide us with the template word document which you are trying to clone. So that we can analyze the exact cause of the issue and provide you with clear details.

Please let us know if you have any questions.


Replied On February 16, 2011 10:16 AM UTC


Thanks for replying, I have attached the document which is causing the problem.


Test Letter_b76550b6.zip

Poornima R [Syncfusion]
Replied On February 17, 2011 09:29 AM UTC

Hi John,

Thank you for your update.

We were able to reproduce the mentioned issue. We suspect this could be a defect. We have forwarded this issue to our development team for further analysis.

Could you please report this issue through Direct Trac Developer Support System
https://www.syncfusion.com/account/login?ReturnUrl=%2fsupport%2fdirecttrac%2fincidents because you can take the advantage of the expertise of a dedicated support engineer and a guaranteed response time and we hope you will take advantage of this system
as well. If you have already reported, please ignore this.

Please let me know if you have any questions.


Jonathan McIlwaine
Replied On June 6, 2011 03:59 PM UTC


this issue (#4698) seems to be corrected in Version but we still have the problem.

Our Syncfusion.DocIO.Base.dll Version : 8.403.0.10


Jonathan McIlwaine
Replied On June 8, 2011 07:58 AM UTC

i would like to add an update to my post, it's not the cloning of a document which raise an error, it's a section in the document.


Poornima R [Syncfusion]
Replied On June 9, 2011 08:28 AM UTC

Hi Ferdinand,

Thank you for your update.

The mentioned “Null reference” exception issue has been fixed in our latest version that is rolled out and available for download under the below location. Please try upgrading to our latest version and let us know if this helps you.


Please let us know if you have any questions.



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon