Exception in exe of Visual Studio 2008 forms application RRS feed

  • Question

  • System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
    at System.Windows.Forms.UnsafeNativeMethods.IOleInPlaceObject.GetWindow(IntPtr& hwnd)
    at System.Windows.Forms.AxHost.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)

    My project has c# networking in Program.cs.

    My application runs as server and i have iocomps installed in it.

    I recieve the above error after running my exe when the client gets connected to my system.

    If i remove the iocomps i dont get the above error. I dont get this error in my sln. I get it only in my exe.

    Wednesday, December 19, 2012 8:45 AM

All replies

  • This is a problem with your code communicating with iocomps.  Since we don't know anything about your code we aren't really going to be able to help you.  The exception indicates that the unmanaged code is referencing memory while processing a UI message from Windows.  I recommend that you step through your code where you're making the call and see if there is any additional information.  The error is occurring when trying to get the ActiveX control (I assume iocomps) hosted.  This could be caused by any number of reasons including security, bad parameters, missing binaries, pointers that are not being delegated properly or calling UI code on a non-UI thread.  Without any knowledge of iocomps and how it works there is no way to know for sure. 

    Michael Taylor - 12/19/2012

    Wednesday, December 19, 2012 2:58 PM