Skip to content

Commit 46f08c8

Browse files
committed
Merge branch 'main' into dev/grendel/blobs-in-lib
* main: [tests] fix duplicate sources in `NuGet.config` (#8772) Bump to xamarin/monodroid@e13723e701 (#8771) Bump to xamarin/xamarin-android-tools/main@37d79c9 (#8752) Bump to dotnet/installer@d070660282 9.0.100-preview.3.24126.2 (#8763) Bump to xamarin/java.interop/main@14a9470 (#8766) $(AndroidPackVersionSuffix)=preview.3; net9 is 34.99.0.preview.3 (#8765) [Mono.Android] Do not dispose request content stream in AndroidMessageHandler (#8764) Bump com.android.tools:r8 from 8.2.42 to 8.2.47 (#8761) [Mono.Android] fix a set of the "easiest" trimmer warnings (#8731) Bump to dotnet/installer@0a73f814e1 9.0.100-preview.2.24122.3 (#8716)
2 parents b3559e6 + e873731 commit 46f08c8

File tree

18 files changed

+112
-81
lines changed

18 files changed

+112
-81
lines changed

.external

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
xamarin/monodroid:main@905441a990d7daf720bdd4fc2f333fed5be28274
1+
xamarin/monodroid:main@e13723e701307f9f6966d4b309c3eba10a741694

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
* Bump first digit of the patch version for feature releases (and reset the first two digits to 0)
3737
-->
3838
<AndroidPackVersion>34.99.0</AndroidPackVersion>
39-
<AndroidPackVersionSuffix>preview.2</AndroidPackVersionSuffix>
39+
<AndroidPackVersionSuffix>preview.3</AndroidPackVersionSuffix>
4040
</PropertyGroup>
4141

4242
<!-- Common <PackageReference/> versions -->

eng/Version.Details.xml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
<Dependencies>
22
<ProductDependencies>
3-
<Dependency Name="Microsoft.Dotnet.Sdk.Internal" Version="9.0.100-preview.2.24106.6">
3+
<Dependency Name="Microsoft.Dotnet.Sdk.Internal" Version="9.0.100-preview.3.24126.2">
44
<Uri>https://github.com/dotnet/installer</Uri>
5-
<Sha>fb7b9a4b9e578fa8c9f5fb67e22daf4b0d22668e</Sha>
5+
<Sha>d070660282eb5f78497310f77093638744112e03</Sha>
66
</Dependency>
7-
<Dependency Name="Microsoft.NET.ILLink.Tasks" Version="9.0.0-preview.2.24080.1" CoherentParentDependency="Microsoft.Dotnet.Sdk.Internal">
7+
<Dependency Name="Microsoft.NET.ILLink.Tasks" Version="9.0.0-preview.2.24123.1" CoherentParentDependency="Microsoft.Dotnet.Sdk.Internal">
88
<Uri>https://github.com/dotnet/runtime</Uri>
9-
<Sha>d40c654c274fe4f4afe66328f0599130f3eb2ea6</Sha>
9+
<Sha>99b76018b6e4edc4ce185dd5f3c5697c6941d88e</Sha>
1010
</Dependency>
11-
<Dependency Name="Microsoft.NETCore.App.Ref" Version="9.0.0-preview.2.24080.1" CoherentParentDependency="Microsoft.Dotnet.Sdk.Internal">
11+
<Dependency Name="Microsoft.NETCore.App.Ref" Version="9.0.0-preview.2.24123.1" CoherentParentDependency="Microsoft.Dotnet.Sdk.Internal">
1212
<Uri>https://github.com/dotnet/runtime</Uri>
13-
<Sha>d40c654c274fe4f4afe66328f0599130f3eb2ea6</Sha>
13+
<Sha>99b76018b6e4edc4ce185dd5f3c5697c6941d88e</Sha>
1414
</Dependency>
15-
<Dependency Name="Microsoft.NET.Workload.Emscripten.Current.Manifest-9.0.100.Transport" Version="9.0.0-preview.2.24076.1" CoherentParentDependency="Microsoft.NETCore.App.Ref">
15+
<Dependency Name="Microsoft.NET.Workload.Emscripten.Current.Manifest-9.0.100.Transport" Version="9.0.0-preview.2.24121.1" CoherentParentDependency="Microsoft.NETCore.App.Ref">
1616
<Uri>https://github.com/dotnet/emsdk</Uri>
17-
<Sha>687be2a32a302aaade82380c0eaafa5af85fb4da</Sha>
17+
<Sha>2d3f1fe4807a21879cedba9d3fde8cd329fb17f2</Sha>
1818
</Dependency>
19-
<Dependency Name="Microsoft.DotNet.Cecil" Version="0.11.4-alpha.24065.1" CoherentParentDependency="Microsoft.NET.ILLink.Tasks">
19+
<Dependency Name="Microsoft.DotNet.Cecil" Version="0.11.4-alpha.24119.1" CoherentParentDependency="Microsoft.NET.ILLink.Tasks">
2020
<Uri>https://github.com/dotnet/cecil</Uri>
21-
<Sha>b8c2293cd1cbd9d0fe6f32d7b5befbd526b5a175</Sha>
21+
<Sha>61250b0ed403b3f9b69a33f7d8f66f311338d6a1</Sha>
2222
</Dependency>
2323
</ProductDependencies>
2424
<ToolsetDependencies>

eng/Versions.props

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
<Project>
22
<!--Package versions-->
33
<PropertyGroup>
4-
<MicrosoftDotnetSdkInternalPackageVersion>9.0.100-preview.2.24106.6</MicrosoftDotnetSdkInternalPackageVersion>
5-
<MicrosoftNETILLinkTasksPackageVersion>9.0.0-preview.2.24080.1</MicrosoftNETILLinkTasksPackageVersion>
6-
<MicrosoftNETCoreAppRefPackageVersion>9.0.0-preview.2.24080.1</MicrosoftNETCoreAppRefPackageVersion>
4+
<MicrosoftDotnetSdkInternalPackageVersion>9.0.100-preview.3.24126.2</MicrosoftDotnetSdkInternalPackageVersion>
5+
<MicrosoftNETILLinkTasksPackageVersion>9.0.0-preview.2.24123.1</MicrosoftNETILLinkTasksPackageVersion>
6+
<MicrosoftNETCoreAppRefPackageVersion>9.0.0-preview.2.24123.1</MicrosoftNETCoreAppRefPackageVersion>
77
<MicrosoftDotNetApiCompatPackageVersion>7.0.0-beta.22103.1</MicrosoftDotNetApiCompatPackageVersion>
88
<MicrosoftDotNetBuildTasksFeedPackageVersion>7.0.0-beta.22103.1</MicrosoftDotNetBuildTasksFeedPackageVersion>
9-
<MicrosoftNETWorkloadEmscriptenCurrentManifest90100TransportVersion>9.0.0-preview.2.24076.1</MicrosoftNETWorkloadEmscriptenCurrentManifest90100TransportVersion>
9+
<MicrosoftNETWorkloadEmscriptenCurrentManifest90100TransportVersion>9.0.0-preview.2.24121.1</MicrosoftNETWorkloadEmscriptenCurrentManifest90100TransportVersion>
1010
<MicrosoftNETWorkloadEmscriptenPackageVersion>$(MicrosoftNETWorkloadEmscriptenCurrentManifest90100TransportVersion)</MicrosoftNETWorkloadEmscriptenPackageVersion>
1111
<MicrosoftTemplateEngineTasksPackageVersion>7.0.100-rc.1.22410.7</MicrosoftTemplateEngineTasksPackageVersion>
12-
<MicrosoftDotNetCecilPackageVersion>0.11.4-alpha.24065.1</MicrosoftDotNetCecilPackageVersion>
12+
<MicrosoftDotNetCecilPackageVersion>0.11.4-alpha.24119.1</MicrosoftDotNetCecilPackageVersion>
1313
<SystemIOHashingPackageVersion>$(MicrosoftNETCoreAppRefPackageVersion)</SystemIOHashingPackageVersion>
1414
</PropertyGroup>
1515
<PropertyGroup>

external/Java.Interop

src/Mono.Android/Android.Graphics/Color.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,11 +395,18 @@ public static void RGBToHSV (int red, int green, int blue, float[] hsv)
395395

396396
public class ColorValueMarshaler : JniValueMarshaler<Color>
397397
{
398+
const DynamicallyAccessedMemberTypes ConstructorsAndInterfaces = DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors | DynamicallyAccessedMemberTypes.Interfaces;
399+
const string ExpressionRequiresUnreferencedCode = "System.Linq.Expression usage may trim away required code.";
400+
398401
public override Type MarshalType {
399402
get { return typeof (int); }
400403
}
401404

402-
public override Color CreateGenericValue (ref JniObjectReference reference, JniObjectReferenceOptions options, Type targetType)
405+
public override Color CreateGenericValue (
406+
ref JniObjectReference reference,
407+
JniObjectReferenceOptions options,
408+
[DynamicallyAccessedMembers (ConstructorsAndInterfaces)]
409+
Type targetType)
403410
{
404411
throw new NotImplementedException ();
405412
}
@@ -414,6 +421,7 @@ public override void DestroyGenericArgumentState (Color value, ref JniValueMarsh
414421
throw new NotImplementedException ();
415422
}
416423

424+
[RequiresUnreferencedCode (ExpressionRequiresUnreferencedCode)]
417425
public override Expression CreateParameterToManagedExpression (JniValueMarshalerContext context, ParameterExpression sourceValue, ParameterAttributes synchronize, Type targetType)
418426
{
419427
var c = typeof (Color).GetConstructor (new[]{typeof (int)})!;
@@ -424,6 +432,7 @@ public override Expression CreateParameterToManagedExpression (JniValueMarshaler
424432
return v;
425433
}
426434

435+
[RequiresUnreferencedCode (ExpressionRequiresUnreferencedCode)]
427436
public override Expression CreateParameterFromManagedExpression (JniValueMarshalerContext context, ParameterExpression sourceValue, ParameterAttributes synchronize)
428437
{
429438
var r = Expression.Variable (MarshalType, sourceValue.Name + "_p");
@@ -433,6 +442,7 @@ public override Expression CreateParameterFromManagedExpression (JniValueMarshal
433442
return r;
434443
}
435444

445+
[RequiresUnreferencedCode (ExpressionRequiresUnreferencedCode)]
436446
public override Expression CreateReturnValueFromManagedExpression (JniValueMarshalerContext context, ParameterExpression sourceValue)
437447
{
438448
return CreateParameterFromManagedExpression (context, sourceValue, 0);

src/Mono.Android/Android.Runtime/IJavaObjectValueMarshaler.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,16 @@ namespace Android.Runtime
1010
{
1111
sealed class IJavaObjectValueMarshaler : JniValueMarshaler<IJavaObject> {
1212

13+
const DynamicallyAccessedMemberTypes ConstructorsAndInterfaces = DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors | DynamicallyAccessedMemberTypes.Interfaces;
14+
const string ExpressionRequiresUnreferencedCode = "System.Linq.Expression usage may trim away required code.";
15+
1316
internal static IJavaObjectValueMarshaler Instance = new IJavaObjectValueMarshaler ();
1417

15-
public override IJavaObject CreateGenericValue (ref JniObjectReference reference, JniObjectReferenceOptions options, Type? targetType)
18+
public override IJavaObject CreateGenericValue (
19+
ref JniObjectReference reference,
20+
JniObjectReferenceOptions options,
21+
[DynamicallyAccessedMembers (ConstructorsAndInterfaces)]
22+
Type? targetType)
1623
{
1724
throw new NotImplementedException ();
1825
}
@@ -27,6 +34,7 @@ public override void DestroyGenericArgumentState ([AllowNull]IJavaObject value,
2734
throw new NotImplementedException ();
2835
}
2936

37+
[RequiresUnreferencedCode (ExpressionRequiresUnreferencedCode)]
3038
public override Expression CreateReturnValueFromManagedExpression (JniValueMarshalerContext context, ParameterExpression sourceValue)
3139
{
3240
return Expression.Call (
@@ -36,6 +44,7 @@ public override Expression CreateReturnValueFromManagedExpression (JniValueMarsh
3644
sourceValue);
3745
}
3846

47+
[RequiresUnreferencedCode (ExpressionRequiresUnreferencedCode)]
3948
public override Expression CreateParameterToManagedExpression (JniValueMarshalerContext context, ParameterExpression sourceValue, ParameterAttributes synchronize, Type? targetType)
4049
{
4150
var r = Expression.Variable (targetType, sourceValue.Name + "_val");

src/Mono.Android/System.Drawing/PointConverter.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030

3131
using System.Collections;
3232
using System.ComponentModel;
33+
using System.Diagnostics.CodeAnalysis;
3334
using System.Globalization;
3435
using System.ComponentModel.Design.Serialization;
3536
using System.Runtime.CompilerServices;
@@ -133,6 +134,7 @@ public override bool GetCreateInstanceSupported (ITypeDescriptorContext context)
133134
return true;
134135
}
135136

137+
[RequiresUnreferencedCode ("The Type of value cannot be statically discovered.")]
136138
public override PropertyDescriptorCollection? GetProperties (
137139
ITypeDescriptorContext context,
138140
object value, Attribute[] attributes)

src/Mono.Android/System.Drawing/RectangleConverter.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131

3232
using System.ComponentModel;
3333
using System.Collections;
34+
using System.Diagnostics.CodeAnalysis;
3435
using System.Globalization;
3536
using System.Text;
3637
using System.ComponentModel.Design.Serialization;
@@ -147,6 +148,7 @@ public override bool GetCreateInstanceSupported (ITypeDescriptorContext context)
147148
return true;
148149
}
149150

151+
[RequiresUnreferencedCode ("The Type of value cannot be statically discovered.")]
150152
public override PropertyDescriptorCollection? GetProperties (
151153
ITypeDescriptorContext context,
152154
object value, Attribute[] attributes)

src/Mono.Android/System.Drawing/SizeConverter.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131

3232
using System.Collections;
3333
using System.ComponentModel;
34+
using System.Diagnostics.CodeAnalysis;
3435
using System.Globalization;
3536
using System.ComponentModel.Design.Serialization;
3637
using System.Reflection;
@@ -135,6 +136,7 @@ public override bool GetCreateInstanceSupported (ITypeDescriptorContext context)
135136
return true;
136137
}
137138

139+
[RequiresUnreferencedCode ("The Type of value cannot be statically discovered.")]
138140
public override PropertyDescriptorCollection? GetProperties (
139141
ITypeDescriptorContext context,
140142
object value, Attribute[] attributes)

src/Mono.Android/System.Drawing/SizeFConverter.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
using System;
3333
using System.Collections;
3434
using System.ComponentModel;
35+
using System.Diagnostics.CodeAnalysis;
3536
using System.Globalization;
3637
using System.ComponentModel.Design.Serialization;
3738
using System.Reflection;
@@ -118,6 +119,7 @@ public override bool GetCreateInstanceSupported (ITypeDescriptorContext context)
118119
return true;
119120
}
120121

122+
[RequiresUnreferencedCode ("The Type of value cannot be statically discovered.")]
121123
public override PropertyDescriptorCollection? GetProperties (ITypeDescriptorContext context, object value, Attribute[] attributes)
122124
{
123125
if (value is SizeF)

src/Mono.Android/Xamarin.Android.Net/AndroidClientHandler.cs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -313,14 +313,9 @@ protected virtual Task SetupRequest (HttpRequestMessage request, HttpURLConnecti
313313
object? GetUnderlyingHandler ()
314314
{
315315
var fieldName = "_nativeHandler";
316-
FieldInfo? field = null;
317-
318-
for (var type = GetType (); type != null; type = type.BaseType) {
319-
field = type.GetField (fieldName, BindingFlags.Instance | BindingFlags.NonPublic);
320-
if (field != null)
321-
break;
322-
}
323-
316+
const BindingFlags flags = BindingFlags.Instance | BindingFlags.NonPublic;
317+
FieldInfo? field = typeof (HttpClientHandler).GetField (fieldName, flags) ??
318+
typeof (HttpMessageHandler).GetField (fieldName, flags);
324319
if (field == null) {
325320
throw new InvalidOperationException ($"Field '{fieldName}' is missing from type '{GetType ()}'.");
326321
}

src/Mono.Android/Xamarin.Android.Net/AndroidMessageHandler.cs

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -536,30 +536,29 @@ protected virtual async Task WriteRequestContentToOutput (HttpRequestMessage req
536536
if (request.Content is null)
537537
return;
538538

539-
using (var stream = await request.Content.ReadAsStreamAsync ().ConfigureAwait (false)) {
540-
await stream.CopyToAsync(httpConnection.OutputStream!, 4096, cancellationToken).ConfigureAwait(false);
541-
542-
//
543-
// Rewind the stream to beginning in case the HttpContent implementation
544-
// will be accessed again (e.g. after redirect) and it keeps its stream
545-
// open behind the scenes instead of recreating it on the next call to
546-
// ReadAsStreamAsync. If we don't rewind it, the ReadAsStreamAsync
547-
// call above will throw an exception as we'd be attempting to read an
548-
// already "closed" stream (that is one whose Position is set to its
549-
// end).
550-
//
551-
// This is not a perfect solution since the HttpContent may do weird
552-
// things in its implementation, but it's better than copying the
553-
// content into a buffer since we have no way of knowing how the data is
554-
// read or generated and also we don't want to keep potentially large
555-
// amounts of data in memory (which would happen if we read the content
556-
// into a byte[] buffer and kept it cached for re-use on redirect).
557-
//
558-
// See https://bugzilla.xamarin.com/show_bug.cgi?id=55477
559-
//
560-
if (stream.CanSeek)
561-
stream.Seek (0, SeekOrigin.Begin);
562-
}
539+
var stream = await request.Content.ReadAsStreamAsync ().ConfigureAwait (false);
540+
await stream.CopyToAsync(httpConnection.OutputStream!, 4096, cancellationToken).ConfigureAwait(false);
541+
542+
//
543+
// Rewind the stream to beginning in case the HttpContent implementation
544+
// will be accessed again (e.g. after redirect) and it keeps its stream
545+
// open behind the scenes instead of recreating it on the next call to
546+
// ReadAsStreamAsync. If we don't rewind it, the ReadAsStreamAsync
547+
// call above will throw an exception as we'd be attempting to read an
548+
// already "closed" stream (that is one whose Position is set to its
549+
// end).
550+
//
551+
// This is not a perfect solution since the HttpContent may do weird
552+
// things in its implementation, but it's better than copying the
553+
// content into a buffer since we have no way of knowing how the data is
554+
// read or generated and also we don't want to keep potentially large
555+
// amounts of data in memory (which would happen if we read the content
556+
// into a byte[] buffer and kept it cached for re-use on redirect).
557+
//
558+
// See https://bugzilla.xamarin.com/show_bug.cgi?id=55477
559+
//
560+
if (stream.CanSeek)
561+
stream.Seek (0, SeekOrigin.Begin);
563562
}
564563

565564
internal Task WriteRequestContentToOutputInternal (HttpRequestMessage request, HttpURLConnection httpConnection, CancellationToken cancellationToken)

src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/AotTests.cs

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -111,19 +111,17 @@ public void BuildBasicApplicationReleaseProfiledAotWithoutDefaultProfile ()
111111
}
112112

113113
[Test]
114-
[TestCase ("テスト", false, false, true)]
115-
[TestCase ("テスト", true, true, false)]
116-
[TestCase ("テスト", true, false, true)]
117-
[TestCase ("随机生成器", false, false, true)]
118-
[TestCase ("随机生成器", true, true, false)]
119-
[TestCase ("随机生成器", true, false, true)]
120-
[TestCase ("中国", false, false, true)]
121-
[TestCase ("中国", true, true, false)]
122-
[TestCase ("中国", true, false, true)]
123-
public void BuildAotApplicationWithSpecialCharactersInProject (string testName, bool isRelease, bool aot, bool expectedResult)
114+
[TestCase ("テスト", false, false)]
115+
[TestCase ("テスト", true, true)]
116+
[TestCase ("テスト", true, false)]
117+
[TestCase ("随机生成器", false, false)]
118+
[TestCase ("随机生成器", true, true)]
119+
[TestCase ("随机生成器", true, false)]
120+
[TestCase ("中国", false, false)]
121+
[TestCase ("中国", true, true)]
122+
[TestCase ("中国", true, false)]
123+
public void BuildAotApplicationWithSpecialCharactersInProject (string testName, bool isRelease, bool aot)
124124
{
125-
if (!IsWindows)
126-
expectedResult = true;
127125
var rootPath = Path.Combine (Root, "temp", TestName);
128126
var proj = new XamarinAndroidApplicationProject () {
129127
ProjectName = testName,
@@ -132,13 +130,7 @@ public void BuildAotApplicationWithSpecialCharactersInProject (string testName,
132130
};
133131
proj.SetAndroidSupportedAbis ("armeabi-v7a", "arm64-v8a", "x86", "x86_64");
134132
using (var builder = CreateApkBuilder (Path.Combine (rootPath, proj.ProjectName))){
135-
builder.ThrowOnBuildFailure = false;
136-
Assert.AreEqual (expectedResult, builder.Build (proj), "Build should have succeeded.");
137-
if (!expectedResult) {
138-
var aotFailed = builder.LastBuildOutput.ContainsText ("Precompiling failed");
139-
var aapt2Failed = builder.LastBuildOutput.ContainsText ("APT2265");
140-
Assert.IsTrue (aotFailed || aapt2Failed, "Error APT2265 or an AOT error should have been raised.");
141-
}
133+
Assert.IsTrue (builder.Build (proj), "Build should have succeeded.");
142134
}
143135
}
144136

src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Common/XamarinProject.cs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,6 @@ public void CopyNuGetConfig (string relativeDirectory)
395395

396396
/// <summary>
397397
/// Updates a NuGet.config based on sources in ExtraNuGetConfigSources
398-
/// If target framework is not the latest or default, sources are added for previous releases
399398
/// </summary>
400399
protected void AddNuGetConfigSources (string nugetConfigPath)
401400
{
@@ -415,14 +414,8 @@ protected void AddNuGetConfigSources (string nugetConfigPath)
415414
ExtraNuGetConfigSources = new List<string> ();
416415
}
417416

418-
if (TargetFramework?.IndexOf ("net8.0", StringComparison.OrdinalIgnoreCase) != -1
419-
|| TargetFrameworks?.IndexOf ("net8.0", StringComparison.OrdinalIgnoreCase) != -1) {
420-
ExtraNuGetConfigSources.Add ("https://api.nuget.org/v3/index.json");
421-
ExtraNuGetConfigSources.Add ("https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet8/nuget/v3/index.json");
422-
}
423-
424417
int sourceIndex = 0;
425-
foreach (var source in ExtraNuGetConfigSources) {
418+
foreach (var source in ExtraNuGetConfigSources.Distinct ()) {
426419
var sourceElement = new XElement ("add");
427420
sourceElement.SetAttributeValue ("key", $"testsource{++sourceIndex}");
428421
sourceElement.SetAttributeValue ("value", source);

src/r8/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ repositories {
1515
}
1616

1717
dependencies {
18-
implementation 'com.android.tools:r8:8.2.42'
18+
implementation 'com.android.tools:r8:8.2.47'
1919
}
2020

2121
jar {

tests/Mono.Android-Tests/Xamarin.Android.Net/AndroidMessageHandlerTests.cs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,31 @@ async Task<bool> DoDecompression (string urlPath, string encoding, string jsonFi
9898
return true;
9999
}
100100

101+
[Test]
102+
public async Task DoesNotDisposeContentStream()
103+
{
104+
using var listener = new HttpListener ();
105+
listener.Prefixes.Add ("http://+:47663/");
106+
listener.Start ();
107+
listener.BeginGetContext (ar => {
108+
var ctx = listener.EndGetContext (ar);
109+
ctx.Response.StatusCode = 204;
110+
ctx.Response.ContentLength64 = 0;
111+
ctx.Response.Close ();
112+
}, null);
113+
114+
var jsonContent = new StringContent ("hello");
115+
var request = new HttpRequestMessage (HttpMethod.Post, "http://localhost:47663/") { Content = jsonContent };
116+
117+
var response = await new HttpClient (new AndroidMessageHandler ()).SendAsync (request);
118+
Assert.True (response.IsSuccessStatusCode);
119+
120+
var contentValue = await jsonContent.ReadAsStringAsync ();
121+
Assert.AreEqual ("hello", contentValue);
122+
123+
listener.Close ();
124+
}
125+
101126
[Test]
102127
public async Task ServerCertificateCustomValidationCallback_ApproveRequest ()
103128
{

0 commit comments

Comments
 (0)