3

Description

When launching any Console Application, the code stops running immediately on an AccessViolationException (Additional information: Attempted to read or write protected memory. This is often an indication that other memory is corrupt). More info included in the next section.

Technical Symptoms

The Call Stack only contains external code:

Exception:Thrown: "The message filter indicated that the application is busy. >(Exception from HRESULT: 0x8001010A (RPC_E_SERVERCALL_RETRYLATER))" (System.Runtime.InteropServices.COMException) A System.Runtime.InteropServices.COMException was thrown: "The message filter indicated that the application is busy. (Exception from HRESULT: 0x8001010A (RPC_E_SERVERCALL_RETRYLATER))" Time: 12/10/2015 10:59:55 AM Thread:vshost.NotifyLoad[15344]

I created a new Console Application, containing only Console.WriteLine("Hello world!");

Running the new Hello world app results in the same exception and an identical call stack.

Background

I suspect this has nothing to do with the issue, as I will explain, but I feel it is important to answer the obvious question, "what were you doing when the issue happend?" The last change I made was adding an extension to my Selenium Driver to hotkey logout from an application:

    public static void logout(this IWebDriver Driver)
    {
        Driver.FindElement(By.TagName("body")).Click();
        new Actions(Driver)
            .SendKeys(Keys.Control + Keys.Shift + "x")
            .Perform();
    }

I also made a change in my App.Config file for one of my projects, but reverting this had no impact either.

Removing this code (the Driver extension and/or the App.Config change) does not resolve this issue. Retrieving a previous check-in does not resolve the issue. I am the only person currently working on this solution.

Discoveries

As mentioned, this is happening for an empty Console Application. Windows Form Applications launch fine. Unit Test Projects launch fine as well.

Research

I've spent hours looking into this. It seems like every similar issue I have looked into is pertinent to debugging only or a .NET version. For me, the issue occurs with a Release as well. Additionally, I have been using .NET 4.5 without any issues or changes on that front. I can't find any articles that seem worth posting, but I might be overlooking something.

Visual Studio Info

Microsoft Visual Studio Ultimate 2013 Version 12.0.30501.00 Update 2 .NET Version 4.6.00081 (just noticed it says 4.5 in my project properties, though) Running as Administrator

Feedback

When Running from devenv.exe /SafeMode, Visual Studio loaded with:

An exception was encountered while constructing the content of this frame. This information is also logged in "C:\Users\UserName\AppData\Roaming\Microsoft\VisualStudio\12.0\ActivityLog.xml".

Exception details: System.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)) at Microsoft.VisualStudio.Shell.Interop.IVsShell5.LoadPackageWithContext(Guid& packageGuid, Int32 reason, Guid& context) at Microsoft.VisualStudio.Platform.WindowManagement.WindowFrame.GetPackage() at Microsoft.VisualStudio.Platform.WindowManagement.WindowFrame.ConstructContent()

Additionally, when trying to run, I get an error message of "Error while trying to run project: Invalid Pointer" (again, VS in devenv.exe /SafeMode - see how to run visual studio without plugin and all third party feature if unfamiliar)

Please let me know if I can provide any additional information.

Community
  • 1
  • 1
  • 1
    `SendKeys` is surely made for a WinForms context. More correctly, inside a Windows Forms message pump. Edit: Looks like the hotkey has been installed in the OS. You might want to figure out what that code does. – leppie Dec 10 '15 at 17:37
  • 1
    So this only happens when running in the IDE? Tried running with addins disabled (devenv.exe /safemode) – Alex K. Dec 10 '15 at 17:37
  • 1
    It seems like your Driver is using and keeping active the Console process, or blocking it for some reason. If it auto starts look for a way to disable it, i think your problem is not related to your code, it is related to the code environment, try to compile your hello world app and run it on another PC, if it works is not the compiler, try running VS without extensions as @AlexK. mentioned above. If this keeps happening, try using Windows System Restore utility to a date before the latest change, if it works then your local system environment went corrupt, AND do a backup of your code before! – kevinrodriguez-io Dec 10 '15 at 17:45
  • @AlexK. - Thanks for the feedback. I tried this and there were some different Exceptions upon load. VS prompts "Error while trying to run project: Invalid pointer" when trying to execute from devenv.exe. I updated the question with this under the "Feedback" header. Thanks again – Steven Repka Dec 10 '15 at 19:32
  • 1
    @darkndream - Thank you for the feedback as well. The HelloWorld app runs fine on another PC. I will look into the System Restore Utility and post the results – Steven Repka Dec 10 '15 at 19:33
  • Did this recently start happening? i.e. was your app working, now suddenly not? – Peter Ritchie Dec 10 '15 at 21:38
  • @PeterRitchie Yes. The app (and all other console apps for that matter) were working fine yesterday morning, then suddenly stopped working. – Steven Repka Dec 11 '15 at 15:15
  • Same problem here. Any chance to solve it? – lostcitizen Jan 18 '16 at 12:40
  • I think the problem may come from updating the system to windows 10, maybe the reinstallation of VS10 will solve the problem... – lostcitizen Jan 18 '16 at 12:54
  • Did you try to create new user and create the same app in its environment? – Alex Kudryashev Jun 17 '16 at 03:06

2 Answers2

0

It may be because when you name the project you can't put spaces, I put them and it gave me a AccessViolationException aswell, try using capitals to separate your words, but only use letters and no spaces to be sure.

0

I also faced this issue with Visual Studio 2010. More interestingly I had several projects in my solution (Console application, WPF application, Windows Forms application) but it was failing only when, I was setting the project which was of type "Console Application" as start up project. Following change finally helped me nail down the issue: Go to project properties of the console application project -> Go to "Debug" tab -> Go to "Enable Debuggers" section in right pane -> Check the "Enable unmanaged code debugging" check box as shown in the snapshot below. Root cause of why it happened is still not known to me. Only thing which I observed as fishy was that there were lot of windows updates which had got installed on my machine the previous night which mostly constituted of office updates and OS updates (More than a dozen KB articles).

enter image description here

RBT
  • 24,161
  • 21
  • 159
  • 240