views:

221

answers:

1

I'm attempt to debug a program I wrote, but I'm running into a problem with the StreamReader function. I'm specifically getting a Could not find a part of the path issue while debugging when it hits this function. Being that I was in the debugger, I checked the variable to make sure the path was correct and that it resolved to a valid file, which it did.

Specifically the code is

  StreamReader fsio = new StreamReader(respFileLoc);

Where the respFileLoc variable is a string that contains the location of the file.

I've looked around and I'm assuming this error has something to do with file permissions, but my question is, how do I set the proper permissions? How does the debugger run the program (in what user level) and can I change it?

I'd prefer not to run this program outside of the debugger because of the nature of the application could mess up my operating environment and I'm using breakpoints in the debugger to prevent this from happening.

A: 

You've already checked that the file does indeed exists, so my next step would be to check that I have permission to that file. You might read about The FileIOPermission class. I have not used it, but it appears it might be helpful in resolving permissions issues.

Charlie Salts
That pretty much did it, thanks.
Tyler