Always receive AccessViolationException


  • I am trying use MS Visual C# 2010 Express to learn C#. But I ALWAYS recieve an AccessViolationExcpetion. Even if I simply start a new project, with no code of my own, when I click the debug button, I receive the following error. Any help would be appreciated.

    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


       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, Boolean ignoreSyncCtx)

       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)

       at System.Threading.ThreadHelper.ThreadStart()


    6 septembrie 2011 19:54

Toate mesajele

  • Hi John,

    This is really wired. Could you please have a try:

    1. Run Visual Studio as Administrator.

    2. Execute devenv /setup under Visual Studio Command Prompt.

    3. Check your hardware and ensure that drivers are installed correctly (Display drivers especially).


    Wish this helps.

    6 septembrie 2011 21:10
  • Sounds like a bad installation to me.  Try running a repair on VS.

    Michael Taylor - 9/6/2011

    7 septembrie 2011 01:18
  • Hi JohnC5,

    It's really strange that the IDE reports an AccessViolationExeption with no code in the project, please have a try as below


    1. Restart your MS Visual C# 2010 and build a new project, debug it without code in it;


    2. If the suggestion above doesn’t work, you can try to repair your IDE, put your Visual C# 2010 disk into your CD-ROM and double click the setup to run it, you can see the setup welcome screen, then click Change or Remove Microsoft Visual C# 2010, you will find you have run the Maintenance Mode, after the setup program loading the components in few minutes, click the next, and then click the Repair/Reinstall link to repair your Visual C# 2010


    I wish the suggestion above could help you.

    Allen Li [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    8 septembrie 2011 09:39