[Mono-list] bug: System.IO.FileStream

Martin Aliger martin_aliger@email.cz
Thu, 3 Oct 2002 10:49:07 +0200 (CEST)


Hi all,

I'm working on simple patch to nant to handle mono class libraries @list files. During this I found one bug (or rather not implemented thing not marked as [MonoTODO]).

-----
using System;
using System.IO;

class StreamTest
{
	public static void Main ()
	{
		System.IO.Stream str=File.OpenRead ("/");
		System.IO.StreamReader rd=new System.IO.StreamReader (str);
		int p=rd.Peek ();
		Console.WriteLine ("{0}", p);
	}
}
-----

Note, that I'm opening _directory_ with IO.FileStream. This is not allowed by specs, but current implementaion allows it. It fails later in Text.Encoding (do not know why there? - not reached in regular files - maybe this could be looked into as well)

Solution is to patch IO.FileStream's ctor to throws UnauthorizedAccessException when opening directory as described in MS docs.

Thanks
Martin

BTW: nant is already working for me. I will contribute it later today

BTW2: --trace is great facility! Maybe this should be extended to produce customizable output or even xml files. It could be better than debugger in some cases. [eg. --trace:nojit,xml] [or integrate to debugger?] [profiling info?]


______________________________________________________________________________
Domácí spotřebiče a elektronika za akční ceny – slevy až 50 %. 
Klikněte na: http://www.obchodni-dum.cz/index.phtml?prov=54&akce=yes