Skip to content

Commit 39cd9f7

Browse files
authored
[Xamarin.Android.Build.Tasks] Fix bug in the Design Time Build (#9711)
We got a bug report that a .NET 10 design-time build in VS results in the following error: System.ArgumentOutOfRangeException: Positive number required. Parameter name: bufferSize at System.IO.StreamReader..ctor(Stream stream, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize, Boolean leaveOpen) at Xamarin.Android.Tasks.GenerateResourceCaseMap.RunTask() in /Users/runner/work/1/s/xamarin-android/src/Xamarin.Android.Build.Tasks/Tasks/GenerateResourceCaseMap.cs:line 94 at Microsoft.Android.Build.Tasks.AndroidTask.Execute() in /Users/runner/work/1/s/xamarin-android/external/xamarin-android-tools/src/Microsoft.Android.Build.BaseTasks/AndroidTask.cs:line 25 We were passing `-1` as the `bufferSize`. While this is fine under .NET 9/10. It seems the full .NET framework does not like it. So, lets fix it by passing `4096`.
1 parent d3cde47 commit 39cd9f7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Xamarin.Android.Build.Tasks/Tasks/GenerateResourceCaseMap.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public override bool RunTask ()
9191
entryStream.CopyTo (ms);
9292
}
9393
ms.Position = 0;
94-
using (var reader = new StreamReader (ms, Encoding.UTF8, detectEncodingFromByteOrderMarks: true, bufferSize: -1, leaveOpen: true)) {
94+
using (var reader = new StreamReader (ms, Encoding.UTF8, detectEncodingFromByteOrderMarks: true, bufferSize: 4096, leaveOpen: true)) {
9595
string line;
9696
// Read each line until the end of the file
9797
while ((line = reader.ReadLine()) != null) {

0 commit comments

Comments
 (0)