未验证 提交 2d0fe490 编写于 作者: D dotnet-maestro[bot] 提交者: GitHub

[main] Update dependencies from mono/linker (#49577)

Co-authored-by: Ndotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: NEric Erhardt <eric.erhardt@microsoft.com>
Co-authored-by: NMarek Safar <marek.safar@gmail.com>
Co-authored-by: NAlexander Köplinger <alex.koeplinger@outlook.com>
上级 3f28d483
......@@ -194,9 +194,9 @@
<Uri>https://github.com/dotnet/runtime</Uri>
<Sha>acbbb505492244b4c07a4a368257ba86a1fc02e1</Sha>
</Dependency>
<Dependency Name="Microsoft.NET.ILLink.Tasks" Version="6.0.100-preview.2.21126.1">
<Dependency Name="Microsoft.NET.ILLink.Tasks" Version="6.0.100-preview.2.21167.1">
<Uri>https://github.com/mono/linker</Uri>
<Sha>0c4902a114192fce1e7570d998e70d24669e9cc3</Sha>
<Sha>c0ed4ef448496b0dc7db3aeb27bbb194fcdccb58</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.XHarness.TestRunners.Xunit" Version="1.0.0-prerelease.21165.2">
<Uri>https://github.com/dotnet/xharness</Uri>
......
......@@ -155,7 +155,7 @@
<!-- Docs -->
<MicrosoftPrivateIntellisenseVersion>5.0.0-preview-20201009.2</MicrosoftPrivateIntellisenseVersion>
<!-- ILLink -->
<MicrosoftNETILLinkTasksVersion>6.0.100-preview.2.21126.1</MicrosoftNETILLinkTasksVersion>
<MicrosoftNETILLinkTasksVersion>6.0.100-preview.2.21167.1</MicrosoftNETILLinkTasksVersion>
<!-- ICU -->
<MicrosoftNETCoreRuntimeICUTransportVersion>6.0.0-preview.3.21151.1</MicrosoftNETCoreRuntimeICUTransportVersion>
<!-- Mono LLVM -->
......
......@@ -227,6 +227,7 @@
<Compile Include="$(CoreLibSharedDir)System\Diagnostics\CodeAnalysis\DynamicDependencyAttribute.cs" />
<Compile Include="$(CoreLibSharedDir)System\Diagnostics\CodeAnalysis\DynamicallyAccessedMembersAttribute.cs" />
<Compile Include="$(CoreLibSharedDir)System\Diagnostics\CodeAnalysis\DynamicallyAccessedMemberTypes.cs" />
<Compile Include="$(CoreLibSharedDir)System\Diagnostics\CodeAnalysis\UnconditionalSuppressMessageAttribute.cs" />
<Compile Include="$(CommonPath)System\Collections\Generic\ReferenceEqualityComparer.cs" Link="Common\System\Collections\Generic\ReferenceEqualityComparer.cs" />
</ItemGroup>
<ItemGroup Condition="$(TargetFramework.StartsWith('netstandard')) or $(TargetFramework.StartsWith('net4'))">
......@@ -254,6 +255,9 @@
<Reference Include="System.Threading.Tasks" />
<Reference Include="System.Threading.Tasks.Extensions" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.0'">
<Reference Include="System.Diagnostics.Tools" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0' or $(TargetFramework.StartsWith('net4'))">
<PackageReference Include="System.Buffers" Version="$(SystemBuffersVersion)" />
<PackageReference Include="System.Memory" Version="$(SystemMemoryVersion)" />
......
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Reflection;
using System.Diagnostics.CodeAnalysis;
namespace System.Text.Json.Serialization.Converters
{
......@@ -16,16 +16,27 @@ public override bool CanConvert(Type type)
return type.IsEnum;
}
public override JsonConverter CreateConverter(Type type, JsonSerializerOptions options)
public override JsonConverter CreateConverter(Type type, JsonSerializerOptions options) =>
Create(type, EnumConverterOptions.AllowNumbers, options);
internal static JsonConverter Create(Type enumType, EnumConverterOptions converterOptions, JsonSerializerOptions serializerOptions)
{
JsonConverter converter = (JsonConverter)Activator.CreateInstance(
typeof(EnumConverter<>).MakeGenericType(type),
BindingFlags.Instance | BindingFlags.Public,
binder: null,
new object[] { EnumConverterOptions.AllowNumbers, options },
culture: null)!;
return (JsonConverter)Activator.CreateInstance(
GetEnumConverterType(enumType),
new object[] { converterOptions, serializerOptions })!;
}
return converter;
internal static JsonConverter Create(Type enumType, EnumConverterOptions converterOptions, JsonNamingPolicy? namingPolicy, JsonSerializerOptions serializerOptions)
{
return (JsonConverter)Activator.CreateInstance(
GetEnumConverterType(enumType),
new object?[] { converterOptions, namingPolicy, serializerOptions })!;
}
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2055:MakeGenericType",
Justification = "'EnumConverter<T> where T : struct' implies 'T : new()', so the trimmer is warning calling MakeGenericType here because enumType's constructors are not annotated. " +
"But EnumConverter doesn't call new T(), so this is safe.")]
[return: DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)]
private static Type GetEnumConverterType(Type enumType) => typeof(EnumConverter<>).MakeGenericType(enumType);
}
}
......@@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Reflection;
namespace System.Text.Json.Serialization.Converters
......@@ -34,11 +35,17 @@ public override JsonConverter CreateConverter(Type typeToConvert, JsonSerializer
public static JsonConverter CreateValueConverter(Type valueTypeToConvert, JsonConverter valueConverter)
{
return (JsonConverter)Activator.CreateInstance(
typeof(NullableConverter<>).MakeGenericType(valueTypeToConvert),
GetNullableConverterType(valueTypeToConvert),
BindingFlags.Instance | BindingFlags.Public,
binder: null,
args: new object[] { valueConverter },
culture: null)!;
}
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2055:MakeGenericType",
Justification = "'NullableConverter<T> where T : struct' implies 'T : new()', so the trimmer is warning calling MakeGenericType here because valueTypeToConvert's constructors are not annotated. " +
"But NullableConverter doesn't call new T(), so this is safe.")]
[return: DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)]
private static Type GetNullableConverterType(Type valueTypeToConvert) => typeof(NullableConverter<>).MakeGenericType(valueTypeToConvert);
}
}
......@@ -96,12 +96,7 @@ internal JsonConverter GetDictionaryKeyConverter(Type keyType)
// Use factory pattern to generate an EnumConverter with AllowStrings and AllowNumbers options for dictionary keys.
// There will be one converter created for each enum type.
JsonConverter GetEnumConverter()
=> (JsonConverter)Activator.CreateInstance(
typeof(EnumConverter<>).MakeGenericType(keyType),
BindingFlags.Instance | BindingFlags.Public,
binder: null,
new object[] { EnumConverterOptions.AllowStrings | EnumConverterOptions.AllowNumbers, this },
culture: null)!;
=> EnumConverterFactory.Create(keyType, EnumConverterOptions.AllowStrings | EnumConverterOptions.AllowNumbers, this);
}
private ConcurrentDictionary<Type, JsonConverter>? _dictionaryKeyConverters;
......
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Reflection;
using System.Text.Json.Serialization.Converters;
namespace System.Text.Json.Serialization
......@@ -52,16 +51,7 @@ public override bool CanConvert(Type typeToConvert)
}
/// <inheritdoc />
public override JsonConverter CreateConverter(Type typeToConvert, JsonSerializerOptions options)
{
JsonConverter converter = (JsonConverter)Activator.CreateInstance(
typeof(EnumConverter<>).MakeGenericType(typeToConvert),
BindingFlags.Instance | BindingFlags.Public,
binder: null,
new object?[] { _converterOptions, _namingPolicy, options },
culture: null)!;
return converter;
}
public override JsonConverter CreateConverter(Type typeToConvert, JsonSerializerOptions options) =>
EnumConverterFactory.Create(typeToConvert, _converterOptions, _namingPolicy, options);
}
}
......@@ -292,7 +292,9 @@
<ItemGroup Condition="'$(ArchiveTests)' == 'true' and '$(TargetOS)' == 'Android'">
<ProjectReference Include="$(MonoProjectRoot)sample\Android\AndroidSampleApp.csproj"
BuildInParallel="false" />
<!-- Disable Android.Device_Emulator.Aot.Test.csproj temporarily due to https://github.com/dotnet/runtime/issues/49757 -->
<ProjectReference Include="$(RepoRoot)\src\tests\FunctionalTests\Android\**\*.Test.csproj"
Exclude="$(RepoRoot)\src\tests\FunctionalTests\Android\Device_Emulator\AOT\Android.Device_Emulator.Aot.Test.csproj"
BuildInParallel="false" />
</ItemGroup>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册