IO Permission Error, Form Won't Load

G

ge0193387

I have an object on my form the does reading from a file and another
that writes to a file. Simple operation just Readline()/Writeline().
I had a problem previously where my form would throw up an error on
run (not build).

An error occurred creating the form. See Exception.InnerException for
details. The error is: Request for the permission of type
'System.Security.Permissions.FileIOPermission, mscorlib,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
failed.

I copied the code into a new solution and it worked until I saved it
at which point it promptly broke. It originally saved onto a network
drive, I've tried copying it to the desktop because I know .NET has
network drive issues. Any suggestions on fixing this are much
appreciated.

Also note that the exception is not stopping on a line it just stops
immediately upon run. All the files are defined by the user via
OpenFileDialog. I've tried commenting out all the line containing the
streamreader/streamwriter with no affect.
 
G

ge0193387

Alrighty, after working on it for a while I had an epiphany and
managed to fix the problem by moving the file locally (desktop I found
is not local). It now works but that does not explain why it was
breaking on load. If anyone has any suggestions on that portion of it
I would be happy to hear it since I'll have to move it back to a
network location once I'm done.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top