TRUPTI

TRUPTI

  • NA
  • 4
  • 3.9k

System.AccessViolationException was unhandled

Mar 25 2013 2:17 AM
Hi,

My C# app throws the following exception:

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

  1. static void Main()
  2.         {
  3.             Application.EnableVisualStyles();
  4.             Application.SetCompatibleTextRenderingDefault(false);          
  5.             Application.Run(new Login());  // get exception at this line(wen i try to enter details in text box)        
  6.  
  7.         }

The stack trace is as follows :

" at System.Windows.Forms.UnsafeNativeMethods.CallWindo wProc(IntPtr wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)\r\n at System.Windows.Forms.NativeWindow.DefWndProc(Messa ge& m)\r\n at System.Windows.Forms.Control.WndProc(Message& m)\r\n at System.Windows.Forms.Control.ControlNativeWindow.W ndProc(Message& m)\r\n at System.Windows.Forms.NativeWindow.DebuggableCallba ck(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)\r\n at System.Windows.Forms.UnsafeNativeMethods.DispatchM essageW(MSG& msg)\r\n at System.Windows.Forms.Application.ComponentManager. System.Windows.Forms.UnsafeNativeMethods.IMsoCompo nentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)\r\n at System.Windows.Forms.Application.ThreadContext.Run MessageLoopInner(Int32 reason, ApplicationContext context)\r\n at System.Windows.Forms.Application.ThreadContext.Run MessageLoop(Int32 reason, ApplicationContext context)\r\n at WindowsFormsApplication1.Program.Main() in D:\\TRUPTI\\02-02-2013-RNSB WithPaymentEdit\\RNSB\\RNSB\\Program.cs:line 25\r\n at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)\r\n at Microsoft.VisualStudio.HostingProcess.HostProc.Run UsersAssembly()\r\n at System.Threading.ExecutionContext.Run(ExecutionCon text executionContext, ContextCallback callback, Object state)\r\n at System.Threading.ThreadHelper.ThreadStart()"