public override int Read(byte[] buffer, int offset, int size) {
if (buffer==null) {
throw new ArgumentNullException("buffer");
}
if (offset<0 || offset>buffer.Length) {
throw new ArgumentOutOfRangeException("offset");
}
if (size<0 || size>buffer.Length-offset) {
throw new ArgumentOutOfRangeException("size");
}
try{
return base.Read(buffer, offset, size);
}
catch(Exception e){
try{
if (NclUtilities.IsFatal(e)) throw;
if(e is System.IO.InvalidDataException || e is InvalidOperationException || e is IndexOutOfRangeException){
Close();
}
}
catch{
}
throw e;
}
}
}