You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 24, 2021. It is now read-only.
@@ -71,24 +75,33 @@ public RequestStream(Stream stream, long expectedLength, long thresholdLength, b
71
75
72
76
if(!this.stream.CanSeek)
73
77
{
74
-
this.MoveToWritableStream();
78
+
vartask=this.MoveToWritableStream();
79
+
80
+
task.Wait();
81
+
82
+
if(task.IsFaulted)
83
+
{
84
+
thrownewInvalidOperationException("Unable to copy stream",task.Exception);
85
+
}
75
86
}
76
87
77
88
this.stream.Position=0;
78
89
}
79
90
91
+
/// <summary>
92
+
/// Finalizes an instance of the <see cref="RequestStream"/> class.
93
+
/// </summary>
80
94
~RequestStream()
81
95
{
82
96
this.Dispose(false);
83
97
}
84
98
85
-
privatevoidMoveToWritableStream()
99
+
privateTaskMoveToWritableStream()
86
100
{
87
101
varsourceStream=this.stream;
88
-
89
102
this.stream=newMemoryStream(BufferSize);
90
103
91
-
sourceStream.CopyTo(this.stream);
104
+
returnsourceStream.CopyToAsync(this);
92
105
}
93
106
94
107
/// <summary>
@@ -143,7 +156,7 @@ public override long Length
143
156
/// <remarks>The stream is moved to disk when either the length of the contents or expected content length exceeds the threshold specified in the constructor.</remarks>
0 commit comments