-
Notifications
You must be signed in to change notification settings - Fork 126
Closed
Labels
Milestone
Description
Updating dotnet/runtime to the latest linker is failing to build because of the following errors:
C:\git\runtime2\src\libraries\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Types\NullableType.cs(47,54): Trim analysis error IL2055: Microsoft.CSharp.RuntimeBinder.Semantics.NullableType.AssociatedSystemType.get: Call to 'System.Type.MakeGenericType(Type[])' can not be statically analyzed. It's not possible to guarantee the availability of requirements of the generic type. [C:\git\runtime2\src\libraries\src.proj]
C:\git\runtime2\src\libraries\System.Linq.Expressions\src\System\Linq\Expressions\BinaryExpression.cs(2237,17): Trim analysis error IL2055: System.Linq.Expressions.Expression.GetResultTypeOfShift(Type,Type): Call to 'System.Type.MakeGenericType(Type[])' can not be statically analyzed. It's not possible to guarantee the availability of requirements of the generic type. [C:\git\runtime2\src\libraries\src.proj]
C:\git\runtime2\src\libraries\System.Linq.Expressions\src\System\Dynamic\Utils\TypeUtils.cs(26,17): Trim analysis error IL2055: System.Dynamic.Utils.TypeUtils.GetNullableType(Type): Call to 'System.Type.MakeGenericType(Type[])' can not be statically analyzed. It's not possible to guarantee the availability of requirements of the generic type. [C:\git\runtime2\src\libraries\src.proj]
C:\git\runtime2\src\libraries\System.Private.DataContractSerialization\src\System\Runtime\Serialization\Json\JsonFormatWriterGenerator.cs(685,21): Trim analysis error IL2055: System.Runtime.Serialization.Json.JsonFormatWriterGenerator.CriticalHelper.UnwrapNullableObject(LocalBuilder): Call to 'System.Type.MakeGenericType(Type[])' can not be statically analyzed. It's not possible to guarantee the availability of requirements of the generic type. [C:\git\runtime2\src\libraries\src.proj]
C:\git\runtime2\src\libraries\System.Private.DataContractSerialization\src\System\Runtime\Serialization\Json\JsonFormatWriterGenerator.cs(683,21): Trim analysis error IL2055: System.Runtime.Serialization.Json.JsonFormatWriterGenerator.CriticalHelper.UnwrapNullableObject(LocalBuilder): Call to 'System.Type.MakeGenericType(Type[])' can not be statically analyzed. It's not possible to guarantee the availability of requirements of the generic type. [C:\git\runtime2\src\libraries\src.proj]
C:\git\runtime2\src\libraries\System.Text.Json\src\System\Text\Json\Serialization\Converters\Value\EnumConverterFactory.cs(21,13): Trim analysis error IL2055: System.Text.Json.Serialization.Converters.EnumConverterFactory.CreateConverter(Type,JsonSerializerOptions): Call to 'System.Type.MakeGenericType(Type[])' can not be statically analyzed. It's not possible to guarantee the availability of requirements of the generic type. [C:\git\runtime2\src\libraries\src.proj]
C:\git\runtime2\src\libraries\System.Text.Json\src\System\Text\Json\Serialization\JsonSerializerOptions.Converters.cs(99,20): Trim analysis error IL2055: System.Text.Json.JsonSerializerOptions.<GetDictionaryKeyConverter>g__GetEnumConverter|4_0(<>c__DisplayClass4_0&): Call to 'System.Type.MakeGenericType(Type[])' can not be statically analyzed. It's not possible to guarantee the availability of requirements of the generic type. [C:\git\runtime2\src\libraries\src.proj]
C:\git\runtime2\src\libraries\System.Text.Json\src\System\Text\Json\Serialization\JsonStringEnumConverter.cs(57,13): Trim analysis error IL2055: System.Text.Json.Serialization.JsonStringEnumConverter.CreateConverter(Type,JsonSerializerOptions): Call to 'System.Type.MakeGenericType(Type[])' can not be statically analyzed. It's not possible to guarantee the availability of requirements of the generic type. [C:\git\runtime2\src\libraries\src.proj]
C:\git\runtime2\src\libraries\System.Text.Json\src\System\Text\Json\Serialization\Converters\Value\NullableConverterFactory.cs(36,13): Trim analysis error IL2055: System.Text.Json.Serialization.Converters.NullableConverterFactory.CreateValueConverter(Type,JsonConverter): Call to 'System.Type.MakeGenericType(Type[])' can not be statically analyzed. It's not possible to guarantee the availability of requirements of the generic type. [C:\git\runtime2\src\libraries\src.proj]
Looking at one of them - C:\git\runtime2\src\libraries\System.Linq.Expressions\src\System\Linq\Expressions\BinaryExpression.cs(2237,17):
private static Type GetResultTypeOfShift(Type left, Type right)
{
if (!left.IsNullableType() && right.IsNullableType())
{
// lift the result type to Nullable<T>
return typeof(Nullable<>).MakeGenericType(left);
}
return left;
}This is calling typeof(Nullable<>).MakeGenericType, which should be safe because Nullable<> doesn't have any trimming annotations on its generic type.
Looking at other warnings, it seems to be warning whenever where T : struct. There is also a warning on using this in MakeGenericType:
internal class NullableConverter<T> : JsonConverter<T?> where T : structThe linker shouldn't be warning in these cases.
cc @vitek-karas
Reactions are currently unavailable