"Attempted to read or write protected memory" on FormControl.Open(stream) - InfoPath Dev
in

InfoPath Dev

"Attempted to read or write protected memory" on FormControl.Open(stream)

Last post 11-21-2008 06:45 AM by RLJ@TCSC. 0 replies.
Page 1 of 1 (1 items)
Sort Posts: Previous Next
  • 11-21-2008 06:45 AM

    "Attempted to read or write protected memory" on FormControl.Open(stream)

    Background:

    I am hosting InfoPath documents within a managed WinForm application using the FormControl control. I am using the FormController.cs and NativeCommands.cs classes from Microsoft's HostedApplication sample. My application launches a WinForm with FormControl to host varying InfoPath documents. When the WinForm is closed, the FormClosing against first closes the FormControl.XmlForm using the FormController.Close method. Using FormController.Close instead of FormControl.XmlForm.Close allowed me to specify using an OLE command instead of the object model to perform the close. I was getting a hard crash when trying to use the object model's close. The OLE command worked perfectly. It is a .NET 2.0/3.0 application using InfoPath 2007 to open documents created in InfoPath 2003. The InfoPath 2003 documents have VB.Net code behind.

    Problem:

    My users will open a new form with a hosted InfoPath document dozens of times a day. In my testing, after a few form instance creations, I start getting an error message at formControl1.Open(Stream stream). I am loading Xml into a memory stream and then loading that stream into the FormControl. The error message is "Attempted to read or write protected memory, this usually means that memory is corrupt". I paraphrased the last part.

    Has anyone run into this and come up with a fix?

    Thanks,

    Roger.

Page 1 of 1 (1 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.