Please do not reply to this email- if you want to comment on the bug, go to the URL shown below and enter your comments there.
Changed by [EMAIL PROTECTED] http://bugzilla.ximian.com/show_bug.cgi?id=80392 --- shadow/80392 2006-12-28 22:26:55.000000000 -0500 +++ shadow/80392.tmp.11697 2006-12-28 22:26:55.000000000 -0500 @@ -0,0 +1,61 @@ +Bug#: 80392 +Product: Mono: Class Libraries +Version: 1.2 +OS: +OS Details: +Status: NEW +Resolution: +Severity: +Priority: Wishlist +Component: CORLIB +AssignedTo: [EMAIL PROTECTED] +ReportedBy: [EMAIL PROTECTED] +QAContact: [EMAIL PROTECTED] +TargetMilestone: --- +URL: +Cc: +Summary: AsyncResult broken + +An invalid operation exception should be thrown when i pass an AsyncResult +from one object into the EndXXX of another object. Mono doesn't care. This +can be a very bad thing. + +Run the attached testcase. In MS.NET an InvalidOperation exception is +thrown on the call to EndRead as i passed in the wrong async result. + +using System; +using System.IO; +class Borked +{ + static void Main(string[] args) + { + byte[] data = System.Text.Encoding.ASCII.GetBytes("This is my +really long test string in which to test async reading with"); + using (FileStream s = File.Create("tempFile.temp")) + for (int i = 0; i < 10000; i++) + s.Write(data, 0, data.Length); + + byte[] buffer1 = new byte[102400]; + byte[] buffer2 = new byte[102400]; + FileStream s1 = new FileStream("tempFile.temp", FileMode.Open, +FileAccess.Read); + FileStream s2 = new FileStream("tempFile.temp", FileMode.Open, +FileAccess.Read); + + IAsyncResult result1 = s1.BeginRead(buffer1, 0, 102400, null, null); + IAsyncResult result2 = s2.BeginRead(buffer2, 0, 102400, null, null); + try + { + Console.WriteLine("Bytes read: " + s2.EndRead(result1)); + } + catch (Exception ex) + { + Console.WriteLine(ex); + } + s1.Dispose(); + s2.Dispose(); + File.Delete("tempFile.temp"); + Console.WriteLine("You should have seen an exception"); + Console.ReadLine(); + } +} _______________________________________________ mono-bugs maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-bugs
