Skip to content

Commit 2d0fe49

Browse files
dotnet-maestro[bot]eerhardtmarek-safarakoeplinger
authored
[main] Update dependencies from mono/linker (#49577)
Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com> Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com> Co-authored-by: Marek Safar <marek.safar@gmail.com> Co-authored-by: Alexander Köplinger <alex.koeplinger@outlook.com>
1 parent 3f28d48 commit 2d0fe49

File tree

8 files changed

+40
-31
lines changed

8 files changed

+40
-31
lines changed

eng/Version.Details.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,9 @@
194194
<Uri>https://github.com/dotnet/runtime</Uri>
195195
<Sha>acbbb505492244b4c07a4a368257ba86a1fc02e1</Sha>
196196
</Dependency>
197-
<Dependency Name="Microsoft.NET.ILLink.Tasks" Version="6.0.100-preview.2.21126.1">
197+
<Dependency Name="Microsoft.NET.ILLink.Tasks" Version="6.0.100-preview.2.21167.1">
198198
<Uri>https://github.com/mono/linker</Uri>
199-
<Sha>0c4902a114192fce1e7570d998e70d24669e9cc3</Sha>
199+
<Sha>c0ed4ef448496b0dc7db3aeb27bbb194fcdccb58</Sha>
200200
</Dependency>
201201
<Dependency Name="Microsoft.DotNet.XHarness.TestRunners.Xunit" Version="1.0.0-prerelease.21165.2">
202202
<Uri>https://github.com/dotnet/xharness</Uri>

eng/Versions.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@
155155
<!-- Docs -->
156156
<MicrosoftPrivateIntellisenseVersion>5.0.0-preview-20201009.2</MicrosoftPrivateIntellisenseVersion>
157157
<!-- ILLink -->
158-
<MicrosoftNETILLinkTasksVersion>6.0.100-preview.2.21126.1</MicrosoftNETILLinkTasksVersion>
158+
<MicrosoftNETILLinkTasksVersion>6.0.100-preview.2.21167.1</MicrosoftNETILLinkTasksVersion>
159159
<!-- ICU -->
160160
<MicrosoftNETCoreRuntimeICUTransportVersion>6.0.0-preview.3.21151.1</MicrosoftNETCoreRuntimeICUTransportVersion>
161161
<!-- Mono LLVM -->

src/libraries/System.Text.Json/src/System.Text.Json.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@
227227
<Compile Include="$(CoreLibSharedDir)System\Diagnostics\CodeAnalysis\DynamicDependencyAttribute.cs" />
228228
<Compile Include="$(CoreLibSharedDir)System\Diagnostics\CodeAnalysis\DynamicallyAccessedMembersAttribute.cs" />
229229
<Compile Include="$(CoreLibSharedDir)System\Diagnostics\CodeAnalysis\DynamicallyAccessedMemberTypes.cs" />
230+
<Compile Include="$(CoreLibSharedDir)System\Diagnostics\CodeAnalysis\UnconditionalSuppressMessageAttribute.cs" />
230231
<Compile Include="$(CommonPath)System\Collections\Generic\ReferenceEqualityComparer.cs" Link="Common\System\Collections\Generic\ReferenceEqualityComparer.cs" />
231232
</ItemGroup>
232233
<ItemGroup Condition="$(TargetFramework.StartsWith('netstandard')) or $(TargetFramework.StartsWith('net4'))">
@@ -254,6 +255,9 @@
254255
<Reference Include="System.Threading.Tasks" />
255256
<Reference Include="System.Threading.Tasks.Extensions" />
256257
</ItemGroup>
258+
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.0'">
259+
<Reference Include="System.Diagnostics.Tools" />
260+
</ItemGroup>
257261
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0' or $(TargetFramework.StartsWith('net4'))">
258262
<PackageReference Include="System.Buffers" Version="$(SystemBuffersVersion)" />
259263
<PackageReference Include="System.Memory" Version="$(SystemMemoryVersion)" />
Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4-
using System.Reflection;
4+
using System.Diagnostics.CodeAnalysis;
55

66
namespace System.Text.Json.Serialization.Converters
77
{
@@ -16,16 +16,27 @@ public override bool CanConvert(Type type)
1616
return type.IsEnum;
1717
}
1818

19-
public override JsonConverter CreateConverter(Type type, JsonSerializerOptions options)
19+
public override JsonConverter CreateConverter(Type type, JsonSerializerOptions options) =>
20+
Create(type, EnumConverterOptions.AllowNumbers, options);
21+
22+
internal static JsonConverter Create(Type enumType, EnumConverterOptions converterOptions, JsonSerializerOptions serializerOptions)
2023
{
21-
JsonConverter converter = (JsonConverter)Activator.CreateInstance(
22-
typeof(EnumConverter<>).MakeGenericType(type),
23-
BindingFlags.Instance | BindingFlags.Public,
24-
binder: null,
25-
new object[] { EnumConverterOptions.AllowNumbers, options },
26-
culture: null)!;
24+
return (JsonConverter)Activator.CreateInstance(
25+
GetEnumConverterType(enumType),
26+
new object[] { converterOptions, serializerOptions })!;
27+
}
2728

28-
return converter;
29+
internal static JsonConverter Create(Type enumType, EnumConverterOptions converterOptions, JsonNamingPolicy? namingPolicy, JsonSerializerOptions serializerOptions)
30+
{
31+
return (JsonConverter)Activator.CreateInstance(
32+
GetEnumConverterType(enumType),
33+
new object?[] { converterOptions, namingPolicy, serializerOptions })!;
2934
}
35+
36+
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2055:MakeGenericType",
37+
Justification = "'EnumConverter<T> where T : struct' implies 'T : new()', so the trimmer is warning calling MakeGenericType here because enumType's constructors are not annotated. " +
38+
"But EnumConverter doesn't call new T(), so this is safe.")]
39+
[return: DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)]
40+
private static Type GetEnumConverterType(Type enumType) => typeof(EnumConverter<>).MakeGenericType(enumType);
3041
}
3142
}

src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Converters/Value/NullableConverterFactory.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33

44
using System.Diagnostics;
5+
using System.Diagnostics.CodeAnalysis;
56
using System.Reflection;
67

78
namespace System.Text.Json.Serialization.Converters
@@ -34,11 +35,17 @@ public override JsonConverter CreateConverter(Type typeToConvert, JsonSerializer
3435
public static JsonConverter CreateValueConverter(Type valueTypeToConvert, JsonConverter valueConverter)
3536
{
3637
return (JsonConverter)Activator.CreateInstance(
37-
typeof(NullableConverter<>).MakeGenericType(valueTypeToConvert),
38+
GetNullableConverterType(valueTypeToConvert),
3839
BindingFlags.Instance | BindingFlags.Public,
3940
binder: null,
4041
args: new object[] { valueConverter },
4142
culture: null)!;
4243
}
44+
45+
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2055:MakeGenericType",
46+
Justification = "'NullableConverter<T> where T : struct' implies 'T : new()', so the trimmer is warning calling MakeGenericType here because valueTypeToConvert's constructors are not annotated. " +
47+
"But NullableConverter doesn't call new T(), so this is safe.")]
48+
[return: DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)]
49+
private static Type GetNullableConverterType(Type valueTypeToConvert) => typeof(NullableConverter<>).MakeGenericType(valueTypeToConvert);
4350
}
4451
}

src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializerOptions.Converters.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,7 @@ internal JsonConverter GetDictionaryKeyConverter(Type keyType)
9696
// Use factory pattern to generate an EnumConverter with AllowStrings and AllowNumbers options for dictionary keys.
9797
// There will be one converter created for each enum type.
9898
JsonConverter GetEnumConverter()
99-
=> (JsonConverter)Activator.CreateInstance(
100-
typeof(EnumConverter<>).MakeGenericType(keyType),
101-
BindingFlags.Instance | BindingFlags.Public,
102-
binder: null,
103-
new object[] { EnumConverterOptions.AllowStrings | EnumConverterOptions.AllowNumbers, this },
104-
culture: null)!;
99+
=> EnumConverterFactory.Create(keyType, EnumConverterOptions.AllowStrings | EnumConverterOptions.AllowNumbers, this);
105100
}
106101

107102
private ConcurrentDictionary<Type, JsonConverter>? _dictionaryKeyConverters;

src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonStringEnumConverter.cs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4-
using System.Reflection;
54
using System.Text.Json.Serialization.Converters;
65

76
namespace System.Text.Json.Serialization
@@ -52,16 +51,7 @@ public override bool CanConvert(Type typeToConvert)
5251
}
5352

5453
/// <inheritdoc />
55-
public override JsonConverter CreateConverter(Type typeToConvert, JsonSerializerOptions options)
56-
{
57-
JsonConverter converter = (JsonConverter)Activator.CreateInstance(
58-
typeof(EnumConverter<>).MakeGenericType(typeToConvert),
59-
BindingFlags.Instance | BindingFlags.Public,
60-
binder: null,
61-
new object?[] { _converterOptions, _namingPolicy, options },
62-
culture: null)!;
63-
64-
return converter;
65-
}
54+
public override JsonConverter CreateConverter(Type typeToConvert, JsonSerializerOptions options) =>
55+
EnumConverterFactory.Create(typeToConvert, _converterOptions, _namingPolicy, options);
6656
}
6757
}

src/libraries/tests.proj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,9 @@
292292
<ItemGroup Condition="'$(ArchiveTests)' == 'true' and '$(TargetOS)' == 'Android'">
293293
<ProjectReference Include="$(MonoProjectRoot)sample\Android\AndroidSampleApp.csproj"
294294
BuildInParallel="false" />
295+
<!-- Disable Android.Device_Emulator.Aot.Test.csproj temporarily due to https://github.com/dotnet/runtime/issues/49757 -->
295296
<ProjectReference Include="$(RepoRoot)\src\tests\FunctionalTests\Android\**\*.Test.csproj"
297+
Exclude="$(RepoRoot)\src\tests\FunctionalTests\Android\Device_Emulator\AOT\Android.Device_Emulator.Aot.Test.csproj"
296298
BuildInParallel="false" />
297299
</ItemGroup>
298300

0 commit comments

Comments
 (0)