0
Answer

System.AccessViolationException

Kevin Scott

Kevin Scott

19y
2.5k
1

Hello,
I have a Visual Studio C# project which has been working, but has ceased.  I am getting the following exception:

System.AccessViolationException was unhandled
  Message="Attempted to read or write protected memory. This is often an indication that other memory is corrupt."
  Source="Microsoft.VisualStudio.HostingProcess.Utilities"
  StackTrace:
       at Microsoft.VisualStudio.HostingProcess.VSHostInterop.SetForegroundWindow(IntPtr hWnd)
      
 at Microsoft.VisualStudio.HostingProcess.HostProc.RunParkingWindowThread()
       
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       
at System.Threading.ThreadHelper.ThreadStart()

I have tried to set up debugging on the first line of the main method of my program, but this exception is thrown before that point.  Are there any C# gurus who have any ideas on this?

Thanks,
KS