System.AccessViolationException: Attempted to read or write protme

O

oksi

Hello,

I have application that hosts Microsoft Word for creating Word .xml templates.

It was tested with WindowsXP and Vista, Word 2003 and Word 2007.
Everything worked fine until today when it was installed on a client machine
(Windows XP).

This is the error we get:

************** Exception Text **************

System.AccessViolationException: Attempted to read or write protected
memory. This is often an indication that other memory is corrupt.

at Word.Range.get_XML(Boolean DataOnly)

at WordDataSetTemplateEditor.frmWordControl.btnSave_Click(Object sender,
EventArgs e)

at System.Windows.Forms.Control.OnClick(EventArgs e)

at System.Windows.Forms.Button.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.OnMessage(Message& m)

at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)

at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg,
IntPtr wparam, IntPtr lparam)





************** Loaded Assemblies **************

mscorlib

Assembly Version: 2.0.0.0

Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)

CodeBase:
file:///c:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll

----------------------------------------

JonasDocumentTemplateDesigner

Assembly Version: 1.0.0.0

Win32 Version: 1.0.0.0

CodeBase:
file:///C:/Program%20Files/Jonas%20Software/JonasDocumentTemplateDesigner/JonasDocumentTemplateDesigner.exe

----------------------------------------

System.Windows.Forms

Assembly Version: 2.0.0.0

Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)

CodeBase:
file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll

----------------------------------------

System

Assembly Version: 2.0.0.0

Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)

CodeBase:
file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll

----------------------------------------

System.Drawing

Assembly Version: 2.0.0.0

Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)

CodeBase:
file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll

----------------------------------------

System.Configuration

Assembly Version: 2.0.0.0

Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)

CodeBase:
file:///C:/WINDOWS/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll

----------------------------------------

System.Xml

Assembly Version: 2.0.0.0

Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)

CodeBase:
file:///C:/WINDOWS/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll

----------------------------------------

WinWordControl

Assembly Version: 1.0.3210.16625

Win32 Version: 1.0.3210.16625

CodeBase:
file:///C:/Program%20Files/Jonas%20Software/JonasDocumentTemplateDesigner/WinWordControl.DLL

----------------------------------------

Interop.Word

Assembly Version: 8.3.0.0

Win32 Version: 8.3.0.0

CodeBase:
file:///C:/Program%20Files/Jonas%20Software/JonasDocumentTemplateDesigner/Interop.Word.DLL

----------------------------------------

System.Data

Assembly Version: 2.0.0.0

Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)

CodeBase:
file:///C:/WINDOWS/assembly/GAC_32/System.Data/2.0.0.0__b77a5c561934e089/System.Data.dll

----------------------------------------

office

Assembly Version: 12.0.0.0

Win32 Version: 12.0.4518.1014

CodeBase:
file:///C:/Program%20Files/Jonas%20Software/JonasDocumentTemplateDesigner/office.DLL

----------------------------------------

CustomMarshalers

Assembly Version: 2.0.0.0

Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)

CodeBase:
file:///C:/WINDOWS/assembly/GAC_32/CustomMarshalers/2.0.0.0__b03f5f7f11d50a3a/CustomMarshalers.dll

----------------------------------------

TemplateFiller

Assembly Version: 1.0.0.0

Win32 Version: 1.0.0.0

CodeBase:
file:///C:/Program%20Files/Jonas%20Software/JonasDocumentTemplateDesigner/TemplateFiller.DLL

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

The application makes call to wordCtl.Application.ActiveDocument.SaveAs(
function, after the file was saved our application tries to read the
document's content to write down the information about MergeFields in this
document template.

it fails on this line of code:

wordCtl.Application.ActiveDocument.Content.get_XML(false)


Applicaiton references Interop.Word (runtime Version v2.0.50727/Version
8.3.0.0) and Interop.Microsoft.Office.Core(v1.1.4322/2.4.0.0_


Can you see the reason of that exception happening?


Thank you,

Oksana
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top