Answered by:
Lost FIleIOPermissions in SpecialFolders

-
I did search for an answer to this but couldn't find anything that related and is probably something simple I am overlooking but I can't find it.
I have been writing/updating a VB program for the past 8 years or so and saving data to the MyDocuments folder as well as reading/writing to the QuickBooks datafile, XML files, and text files located there. Everything works fine if I compile and run using VS2015 but I recently decided to upgrade to VS2017. The code compiles without error but will not read or write to any folder located in My.Computer.FileSystem.SpecialDirectories. StreamReader/StreamWriter return "no permission" exceptions as well as XMLWriter, OleDB connections, etc. I can have full access to other folders such as D:\Temp but not "MyDocuments" (D:\!Data) or any other of the "SpecialDirectories".
Bringing the code back up in VS2015 compiles and works just fine but I can't find a setting in VS2017 that is different and that turns off those privileges.
Any help or suggestions would be appreciated!
Rich Lucas
- Edited by rlucas50 Friday, April 28, 2017 7:16 AM
Question
Answers
-
Finally, I just uninstalled VS2017 totally, rebooted, re-installed VS2017 from scratch, and problem solved. Everything works as expected.
Thanks to those who did reply with helpful suggestions!
Rich Lucas
- Proposed as answer by Jack Zhai-MSFTMicrosoft contingent staff, Moderator Monday, May 01, 2017 1:48 AM
- Marked as answer by rlucas50 Monday, May 01, 2017 3:43 PM
All replies
-
-
-
Something got giggled when you moved to VS2017.
It was probably just waiting to happen. Maybe it's time to enhance your code with some Permissions
Have a look at the FileIOPermission Class: https://msdn.microsoft.com/en-us/library/system.security.permissions.fileiopermission(v=vs.110).aspx
-
Finally, I just uninstalled VS2017 totally, rebooted, re-installed VS2017 from scratch, and problem solved. Everything works as expected.
Thanks to those who did reply with helpful suggestions!
Rich Lucas
- Proposed as answer by Jack Zhai-MSFTMicrosoft contingent staff, Moderator Monday, May 01, 2017 1:48 AM
- Marked as answer by rlucas50 Monday, May 01, 2017 3:43 PM
-
Hi Lucas,
If your issue's been resolved, please help mark a reply as answer.
Have a nice day.
Best regards,
Fletch
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
- Edited by Fletch ZhouMicrosoft contingent staff Monday, May 01, 2017 5:47 AM