all groups > dotnet general > may 2005 >
You're in the

dotnet general

group:

IOException!!!!!!


IOException!!!!!! Thaynann
5/8/2005 8:27:12 PM
dotnet general: can anyone tell me why i sometimes get an IOExcaption with the following code

line1: fs = new FileStream(file, FileMode.Append, FileAccess.Write);
line2: stream = new StreamWriter(fs);

the problem happens with the above and also with stream =
File.AppendText(file)

can anyone help?
Re: IOException!!!!!! Peter Rilling
5/8/2005 8:55:53 PM
What is the exact exception message? Lots of things can cause an
IOException.

[quoted text, click to view]

Re: IOException!!!!!! Thaynann
5/10/2005 4:39:14 PM
all it gives me is an IOException.....i have tried catching the derived
exceptions from the IOException class, like DirectoryNotFoundException and
FileNotFoundException, etc...but it skips them and only catches the base
IOException.

[quoted text, click to view]
Re: IOException!!!!!! Jon Skeet [C# MVP]
5/11/2005 7:07:22 AM
[quoted text, click to view]

But what is the *message* of the exception?

--
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet
Re: IOException!!!!!! Thaynann
5/11/2005 9:10:10 PM
i have this to catch the exception

catch(Exception e){ return e.Message;}

and all it returns is "IOException"..thats all e.Message contains.

[quoted text, click to view]
Re: IOException!!!!!! Jon Skeet [C# MVP]
5/12/2005 12:00:00 AM
[quoted text, click to view]

I suggest you print out the whole exception - stack trace and
everything. That may help.

--
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet
Re: IOException!!!!!! Thaynann
5/18/2005 9:13:02 PM
how do i print out the stack trace...im using the Compact Framework, is it
possible

[quoted text, click to view]
Re: IOException!!!!!! Jon Skeet [C# MVP]
5/19/2005 7:20:10 AM
[quoted text, click to view]

Well, instead of returning e.Message, return e.ToString().
Alternatively, catch it in the debugger and examine the stack trace
there.

--
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet
AddThis Social Bookmark Button