Access Is Denied when Debugging Visual Studio 2022 Preview
Asked Answered
B

5

8

When attempting to debug, any solution/project, in Visual Studio 2022 preview I'm receiving "Access Is Denied"

The directory that the solution exists has all the correct permissions for my user account as well as administrators. I have also tried while running Visual Studio as admin. The output exe will also register Access Is Denied if I try to run it directly, outside visual studio. I can move the exe to another directory and still receive the Access Is Denied message.

I utilize Windows 10 version 21H2, I login using an Azure Active Directory account.

My project paths live in C:\Users(MyAzureName)\Version Control\

Debug Error

Console Error

Permissions

Bantling answered 6/1, 2022 at 17:47 Comment(0)
B
3

I finally figured out the cause of this problem. Our cloud antivirus solution was submitting applications from my Version Control directory to quarantine without notifying me. I have excluded this path from my AV scanning and now my debugging is functioning as normal.

Bantling answered 11/1, 2022 at 15:54 Comment(0)
F
2

Ctrl+F5 worked once. For corp managed systems, the option to change the virus checker settings are limited. Any other ideas appreciated.

Festoonery answered 7/6, 2023 at 19:34 Comment(1)
It worked for me. Thank you :)Good
A
0

Same problem, different solution. Checked the Windows Event Viewer for insight into Access Denied. In Event Viewer treeview, go to Event Viewer/Applications and Services Logs/Visual Studio, and click through events. I discovered references to "Visual Studio Trust Service"!?

In Visual Studio 2022, if you're using Git, go Debug/Options:

(1) go to Source Control/Plug-in Selection, and select Git for Current Source Control plugin;

(2) go to Source Control/Git Global Settings, and verify your Default Location folder is correct for your local repository;

(3) go to Environment/Trust Settings, under Trust Policies, check "Require a Trust Decision before opening content, and click "Add a Folder" to add your local Git repository path as a Trusted Location.

Click OK to save all changes. Rebuild and re-run (with or without Debugging).

In my case, Access Denied disappeared after these changes. I don't believe you need run VS as Local Admin in order to make these changes.

This worked for me, hopefully this might help you too.

Amative answered 11/6 at 15:15 Comment(0)
C
0

In my case, the stream writer object still had a lock on the file because I'd forgotten to close and/or dispose:

streamWriter.Close();

Conservatory answered 26/6 at 22:44 Comment(0)
H
-3

try below

  • Copy your project folder to C:\Users%userprofile%\source\repos

  • Open the project from the above path in VS2022 or your version.

  • Try with CTRL+F5 (if you see access denied, try again)

  • Next try with F5

Halyard answered 4/4, 2023 at 14:26 Comment(1)
The mentioned solution not working with windows Visual Studio 2022.Valparaiso

© 2022 - 2024 — McMap. All rights reserved.