Click here to Skip to main content
15,502,332 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:

I have a project built in WPF ( Visual Studio 2019). I have functionalities to save and open files from the file system. However, I noticed that none of the functionalities work where interaction with the file system happens. This happens mainly when I try to run from Visual Studio.
On the other hand, if I just double-click my exe from the output path, I don't face this issue.

Can anyone suggest is it because of any Visual Studio account permission. How to solve it?


What I have tried:

Tried by setting it to Release Build from Visual Studio. The issue exists still.
Updated 13-Jun-21 20:09pm

It has nothing to do with Visual Studio. I suspect it has something to do with your code possibly using "CurrentDirectory"?

Nobody can tell because you haven't posted any of your relevant code.
Share this answer
When your run your code in te debugger, it runs under your current user account, there is no "Visual Studio account", so the file permissions are those of your user.

Use the debugger: put a breakpoint on the methods that "interact with the file system" and try looking at the exception object, at it's Inner Exception (if any) and try to see what the error message(s) are - you need those to work out what the heck is happening.

We can't do that for you: we have no idea what your code looks like, or any access to your file system!
Share this answer
Thank you for the suggestion. But what I am wondering is the same exe is being launched when ran from debug folder. Ideally both the cases launch the same exe right, so if it was a problem with code, this has to be seen when direct launching of the exe too.
Share this answer
Richard Deeming 14-Jun-21 10:45am    
If you want to reply to a solution, click the "Have a Question or Comment?" button under that solution and post a comment.

Do not post your comment as a new "solution".

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900