我正在尝试AccessViolationException
"尝试读取或写入受保护的内存..."当代码尝试调用简单Windows窗体的MyBase.ShowDialog()
时。
它是使用visual studio 2008用vb.NET framework 3.5编码的Windows表单应用程序。
我已经浏览了互联网,但一无所获。
stackTrace说:
en System.Windows.Forms.UnsafeNativeMethods.CallWindowProc(IntPtr wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
en System.Windows.Forms.NativeWindow.DefWndProc(Message& m)
en System.Windows.Forms.ToolTip.WndProc(Message& msg)
en System.Windows.Forms.ToolTip.ToolTipNativeWindow.WndProc(Message& m)
en System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
en System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
en System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
en System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
en System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
en System.Windows.Forms.Application.RunDialog(Form form)
en System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
en System.Windows.Forms.Form.ShowDialog()
关键在于它甚至不会一直发生,表格声明如下:
<CLSCompliant(True)> Public Class FMensaje
Inherits System.Windows.Forms.Form
引发异常的函数:
Public Overloads Function Show(ByVal strMensaje As String, ByVal enmTMensaje As en_TipoMensaje) As MsgBoxResult
Try
lblAviso.Text = strMensaje
...
MyBase.ShowDialog()
Me.BringToFront()
Application.DoEvents()
Show = m_mbrResultado
Catch ex As Exception
End Try
End Function
任何帮助都将不胜感激。