Error while trying to run project: Access is denied

12,608

Right click on the Winform or WPF Project > Properties > Debug tab > tick Enable native code debugging.

enter image description here

UPDATE: Use this answer to fix the Registry A Hive in VS2017 (it has its own registry):

https://stackoverflow.com/a/45579640/495455

Share:
12,608
Jeremy Thompson
Author by

Jeremy Thompson

Hello fellow SO'r, I am a developer with a long professional history of work with web and Microsoft technologies. I am passionate about C#, VB.Net, Winforms, Web (jQuery, ASP.Net, IIS), SQL and am into a lot of tools for DevOps, Debugging, Performance, Threading, IDE and etc. My background in coding started with VB and C++, then classic asp and onto .Net. At various times I have worked for Datacom, Massive Interactive, Macquarie Bank, GraysOnline.com, MLC, SKM/Jacobs Engineering, the Reserve Bank of Australia, National Australia Bank and more. The highlight of my career was working for Microsoft Australia in Professional Developer PSS. Solving developer support cases for Microsoft Gold and Premiere customers has helped me to answer on here. I like answering the bounty questions and helping people out who are really stuck, "as if your job depends on it". I currently work at the NAB Cloud Guild as a trainer, best practice engineer and escalation engineer across NAB for cloud matters. Dip. Business, MCP, MCAD.Net, MCSD.Net, MCT (06/07), AWS CP, AWS CSA, AWS SOA, AZ900, AZ204, AZ303, AZ304

Updated on June 29, 2022

Comments

  • Jeremy Thompson
    Jeremy Thompson almost 2 years

    Trying to Start a Winform solution With Debugging in Visual Studio 2017 causes this error:

    Error while trying to run project: Access is denied.

    enter image description here

    Running Without Debugging works and starts the project without the error.

    enter image description here

    This guy reported the same issue with a WPF project to Microsoft Developer Community (beta testing) but there is no solution: https://developercommunity.visualstudio.com/content/problem/39737/error-while-trying-to-run-project-unable-to-start-3.html

    A ProcessMonitor Trace reveals its an Access Denied in the Registry:

    39:45.7
    devenv.exe
    RegCreateKey    \REGISTRY\A\{3883977B-E889-4804-9494-B5A8BC8E3F1D}\Software\Microsoft\VisualStudio\15.0_8708a912\DialogPage
    ACCESS DENIED
    Desired Access: Maximum Allowed
    

    Since its an Application Hive Registry Key it cannot be changed in RegEdit. UPDATE: You can change this, see my updated answer.

    How can I debug projects?

    Note: Answering my own question to help others in the future.

  • trailmax
    trailmax almost 7 years
    that's a strange solution for such problem [scratching head]. I've almost asked if you are running VS as admin, but I'd never expected this checbox to make a difference
  • Jeremy Thompson
    Jeremy Thompson almost 7 years
    Totally! It took me a lot of trial and error to work this out, usually troubleshooting gives you clues to help diagnose problems and narrow down the issue, for this one as you can see I took a complete stab in the dark. The Start Without Debugging was the only thing I had to go on.