I just ran into this problem also. (undocumented exception thrown when
Streamwriter is handed a buffer with wierd characters in it).
I was also able to get around it by specifying utf8 as the encoding
for Streamwriter. (Thank you Amy L!)
But I have some questions:
1- Isn't utf8 supposed to be the default mode for streamwriter? If so
why does specifying the default fix the problem?
2- I had opend up the file for appendding and was executing a
"WriteLine(String);" command when I got that exception. The problem is
the streamwriter handle is now 'broken'. You can't write anything
else to the file, you can't close it. The only way around it this
problem is to exit the program.
This seems like a bug in the streamwriter, it should have at the very
least closed the handle so I wouldn't have to exit the program.
Thanks
Phil Ouellette.