Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Thu Jun 25, 2015 4:13 pm

I have written a very simple application to remove the comments from a word document using the free edition.

If I remove all the comments from a file, then try and repeat the process I get a NullReference Exception in the Spire.Doc.dll when loading the file for the second time.

System.NullReferenceException was unhandled
HResult=-2147467261
Message=Object reference not set to an instance of an object.
Source=Spire.Doc
StackTrace:
at sprᲑ.ᜏ(XmlReader A_0, ParagraphItemCollection A_1)
at sprᲑ.ᜐ(XmlReader A_0, ParagraphItemCollection A_1)
at sprᲑ.ᜎ(XmlReader A_0, IDocumentObject A_1)
at sprᲑ.ᜍ(Stream A_0)
at sprᲑ.ᜁ(sprᡵ A_0)
at sprᲑ.ᜁ(Document A_0)
at sprᲑ.ᜀ(String A_0, Document A_1)
at Spire.Doc.Document.ᜌ(String A_0)
at Spire.Doc.Document.LoadFromFile(String fileName, FileFormat fileFormat, String password)
at Spire.Doc.Document.ᜀ(String A_0, String A_1)
at Spire.Doc.Document.LoadFromFile(String fileName)
at ClearWordComments.Form1.button1_Click(Object sender, EventArgs e) in c:\Users\Darren\Documents\Visual Studio 2013\Projects\ClearWordComments\ClearWordComments\Form1.cs:line 26
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.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(IntPtr 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 ClearWordComments.Program.Main() in c:\Users\Darren\Documents\Visual Studio 2013\Projects\ClearWordComments\ClearWordComments\Program.cs:line 17
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()
InnerException:

If I load and make a small change in MS Word and repeat the process and it all works.

dazfitzg
 
Posts: 5
Joined: Thu Jun 25, 2015 3:28 pm

Fri Jun 26, 2015 2:02 am

Hello,

Thanks for your inquiry.
Could you please offer us your sample file and share your code with us? It would be helpful to replicate the issue and work out the solution for you ASAP.
Please kindly note that firstly you need to compress it and upload.

Best Regards,
Sweety

E-iceblue support team
User avatar

sweety1
 
Posts: 539
Joined: Wed Mar 11, 2015 1:14 am

Thu Jul 02, 2015 3:17 am

Hello,

Has your issue been resolved? If not, Could you please offer us your sample file and share your code with us?

Best Regards,
Sweety

E-iceblue support team
User avatar

sweety1
 
Posts: 539
Joined: Wed Mar 11, 2015 1:14 am

Return to Spire.Doc