[test] Fix sporadic Mono.Debugger.Soft ThreadpoolIOsinglestep failure.
authorAleksey Kliger <aleksey@xamarin.com>
Mon, 1 Aug 2016 20:13:00 +0000 (16:13 -0400)
committerAleksey Kliger <aleksey@xamarin.com>
Mon, 1 Aug 2016 20:13:00 +0000 (16:13 -0400)
ReadAsync size arg should not be greater than array.Length - offset.

mcs/class/Mono.Debugger.Soft/Test/dtest-app.cs

index 6587c37c0b5fc0aea66cbf2af2f2b3f8586b88ff..6617c146f6e138bb2e93ff51df41e1db164d1d84 100644 (file)
@@ -1570,8 +1570,11 @@ public class Tests : TestsBase, ITest2
                        var streamIn = c.GetStream ();
                        var bs = new byte[nbytes];
                        int nread = 0;
+                       int nremain = nbytes;
                        while (nread < nbytes) {
-                               nread += await streamIn.ReadAsync (bs, nread, nbytes);
+                               int r = await streamIn.ReadAsync (bs, nread, nremain);
+                               nread += r;
+                               nremain -= r;
                        }
                        streamIn.Close ();
                        return bs;