committed by
GitHub
110 changed files with 489 additions and 280 deletions
@ -0,0 +1,16 @@ |
|||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
|||
<PropertyGroup> |
|||
<SuppressTrimAnalysisWarnings>false</SuppressTrimAnalysisWarnings> |
|||
<EnableTrimAnalyzer>true</EnableTrimAnalyzer> |
|||
<TrimmerSingleWarn>false</TrimmerSingleWarn> |
|||
<IsTrimmable>true</IsTrimmable> |
|||
</PropertyGroup> |
|||
<!-- Remove check for the AOT when we get rid of dependencies with reflection --> |
|||
<PropertyGroup Condition="'$(TargetFramework)' != 'netstandard2.0' and '$(PublishAot)' != 'true'"> |
|||
<ILLinkTreatWarningsAsErrors>true</ILLinkTreatWarningsAsErrors> |
|||
<!-- Trim warnings --> |
|||
<WarningsAsErrors>$(WarningsAsErrors);IL2000;IL2001;IL2002;IL2003;IL2004;IL2005;IL2006;IL2007;IL2008;IL2009;IL2010;IL2011;IL2012;IL2013;IL2014;IL2015;IL2016;IL2017;IL2018;IL2019;IL2020;IL2021;IL2022;IL2023;IL2024;IL2025;IL2026;IL2027;IL2028;IL2029;IL2030;IL2031;IL2032;IL2033;IL2034;IL2035;IL2036;IL2037;IL2038;IL2039;IL2040;IL2041;IL2042;IL2043;IL2044;IL2045;IL2046;IL2047;IL2048;IL2049;IL2050;IL2051;IL2052;IL2053;IL2054;IL2055;IL2056;IL2057;IL2058;IL2059;IL2060;IL2061;IL2062;IL2063;IL2064;IL2065;IL2066;IL2067;IL2068;IL2069;IL2070;IL2071;IL2072;IL2073;IL2074;IL2075;IL2076;IL2077;IL2078;IL2079;IL2080;IL2081;IL2082;IL2083;IL2084;IL2085;IL2086;IL2087;IL2088;IL2089;IL2090;IL2091;IL2092;IL2093;IL2094;IL2095;IL2096;IL2097;IL2098;IL2099;IL2100;IL2101;IL2102;IL2103;IL2104;IL2105;IL2106;IL2107;IL2108;IL2109;IL2110;IL2111;IL2112;IL2113;IL2114;IL2115;IL2116;IL2117;IL2118;IL2119;IL2120;IL2121;IL2122;IL2123;IL2124;IL2125;IL2126;IL2127;IL2128;IL2129;IL2130;IL2131;IL2132;IL2133;IL2134;IL2135;IL2136;IL2137;IL2138;IL2139;IL2140;IL2141;IL2142;IL2143;IL2144;IL2145;IL2146;IL2147;IL2148;IL2149;IL2150;IL2151;IL2152;IL2153;IL2154;IL2155;IL2156;IL2157</WarningsAsErrors> |
|||
<!-- NativeAOT warnings --> |
|||
<WarningsAsErrors>$(WarningsAsErrors);IL3050;IL3051;IL3052;IL3053;IL3054;IL3055;IL3056</WarningsAsErrors> |
|||
</PropertyGroup> |
|||
</Project> |
|||
@ -0,0 +1,121 @@ |
|||
#pragma warning disable MA0048 // File name must match type name
|
|||
// https://github.com/dotnet/runtime/tree/main/src/libraries/System.Private.CoreLib/src/System/Diagnostics/CodeAnalysis
|
|||
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
|||
// The .NET Foundation licenses this file to you under the MIT license.
|
|||
// See the LICENSE file in the project root for more information.
|
|||
|
|||
namespace System.Diagnostics.CodeAnalysis |
|||
{ |
|||
#nullable enable |
|||
#if !NET6_0_OR_GREATER
|
|||
[AttributeUsage( |
|||
AttributeTargets.Field | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter | |
|||
AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.Method | |
|||
AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.Struct, |
|||
Inherited = false)] |
|||
internal sealed class DynamicallyAccessedMembersAttribute : Attribute |
|||
{ |
|||
public DynamicallyAccessedMembersAttribute(DynamicallyAccessedMemberTypes memberTypes) |
|||
{ |
|||
MemberTypes = memberTypes; |
|||
} |
|||
|
|||
public DynamicallyAccessedMemberTypes MemberTypes { get; } |
|||
} |
|||
|
|||
[Flags] |
|||
internal enum DynamicallyAccessedMemberTypes |
|||
{ |
|||
None = 0, |
|||
PublicParameterlessConstructor = 0x0001, |
|||
PublicConstructors = 0x0002 | PublicParameterlessConstructor, |
|||
NonPublicConstructors = 0x0004, |
|||
PublicMethods = 0x0008, |
|||
NonPublicMethods = 0x0010, |
|||
PublicFields = 0x0020, |
|||
NonPublicFields = 0x0040, |
|||
PublicNestedTypes = 0x0080, |
|||
NonPublicNestedTypes = 0x0100, |
|||
PublicProperties = 0x0200, |
|||
NonPublicProperties = 0x0400, |
|||
PublicEvents = 0x0800, |
|||
NonPublicEvents = 0x1000, |
|||
Interfaces = 0x2000, |
|||
All = ~None |
|||
} |
|||
|
|||
[AttributeUsage( |
|||
AttributeTargets.Constructor | AttributeTargets.Field | AttributeTargets.Method, |
|||
AllowMultiple = true, Inherited = false)] |
|||
internal sealed class DynamicDependencyAttribute : Attribute |
|||
{ |
|||
public DynamicDependencyAttribute(string memberSignature) |
|||
{ |
|||
MemberSignature = memberSignature; |
|||
} |
|||
|
|||
public DynamicDependencyAttribute(string memberSignature, Type type) |
|||
{ |
|||
MemberSignature = memberSignature; |
|||
Type = type; |
|||
} |
|||
|
|||
public DynamicDependencyAttribute(string memberSignature, string typeName, string assemblyName) |
|||
{ |
|||
MemberSignature = memberSignature; |
|||
TypeName = typeName; |
|||
AssemblyName = assemblyName; |
|||
} |
|||
|
|||
public DynamicDependencyAttribute(DynamicallyAccessedMemberTypes memberTypes, Type type) |
|||
{ |
|||
MemberTypes = memberTypes; |
|||
Type = type; |
|||
} |
|||
|
|||
public DynamicDependencyAttribute(DynamicallyAccessedMemberTypes memberTypes, string typeName, string assemblyName) |
|||
{ |
|||
MemberTypes = memberTypes; |
|||
TypeName = typeName; |
|||
AssemblyName = assemblyName; |
|||
} |
|||
|
|||
public string? MemberSignature { get; } |
|||
public DynamicallyAccessedMemberTypes MemberTypes { get; } |
|||
public Type? Type { get; } |
|||
public string? TypeName { get; } |
|||
public string? AssemblyName { get; } |
|||
public string? Condition { get; set; } |
|||
} |
|||
|
|||
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Constructor | AttributeTargets.Class, Inherited = false)] |
|||
internal sealed class RequiresUnreferencedCodeAttribute : Attribute |
|||
{ |
|||
public RequiresUnreferencedCodeAttribute(string message) |
|||
{ |
|||
Message = message; |
|||
} |
|||
|
|||
public string Message { get; } |
|||
public string? Url { get; set; } |
|||
} |
|||
|
|||
[AttributeUsage(AttributeTargets.All, Inherited = false, AllowMultiple = true)] |
|||
internal sealed class UnconditionalSuppressMessageAttribute : Attribute |
|||
{ |
|||
public UnconditionalSuppressMessageAttribute(string category, string checkId) |
|||
{ |
|||
Category = category; |
|||
CheckId = checkId; |
|||
} |
|||
public string Category { get; } |
|||
public string CheckId { get; } |
|||
public string? Scope { get; set; } |
|||
public string? Target { get; set; } |
|||
public string? MessageId { get; set; } |
|||
public string? Justification { get; set; } |
|||
} |
|||
#endif
|
|||
} |
|||
|
|||
@ -0,0 +1,30 @@ |
|||
namespace Avalonia; |
|||
|
|||
internal static class TrimmingMessages |
|||
{ |
|||
public const string ImplicitTypeConvertionSupressWarningMessage = "Implicit convertion methods might be removed by the linker. We don't have a reliable way to prevent it, except converting everything in compile time when possible."; |
|||
public const string ImplicitTypeConvertionRequiresUnreferencedCodeMessage = "Implicit convertion methods are required for type conversion."; |
|||
|
|||
public const string TypeConvertionSupressWarningMessage = "Convertion methods might be removed by the linker. We don't have a reliable way to prevent it, except converting everything in compile time when possible."; |
|||
public const string TypeConvertionRequiresUnreferencedCodeMessage = "Convertion methods are required for type conversion, including op_Implicit, op_Explicit, Parse and TypeConverter."; |
|||
|
|||
public const string ReflectionBindingRequiresUnreferencedCodeMessage = "BindingExpression and ReflectionBinding heavily use reflection. Consider using CompiledBindings instead."; |
|||
public const string ReflectionBindingSupressWarningMessage = "BindingExpression and ReflectionBinding internal heavily use reflection."; |
|||
|
|||
public const string CompiledBindingSafeSupressWarningMessage = "CompiledBinding preserves members used in the expression tree."; |
|||
|
|||
public const string ExpressionNodeRequiresUnreferencedCodeMessage = "ExpressionNode might require unreferenced code."; |
|||
public const string ExpressionSafeSupressWarningMessage = "Typed Expressions preserves members used in the expression tree."; |
|||
|
|||
public const string SelectorsParseRequiresUnreferencedCodeMessage = "Selectors runtime parser might require unreferenced code. Consider using stronly typed selectors factory with 'new Style(s => s.OfType<Button>())' syntax."; |
|||
|
|||
public const string PropertyAccessorsRequiresUnreferencedCodeMessage = "PropertyAccessors might require unreferenced code."; |
|||
public const string DataValidationPluginRequiresUnreferencedCodeMessage = "DataValidationPlugin might require unreferenced code."; |
|||
public const string StreamPluginRequiresUnreferencedCodeMessage = "StreamPlugin might require unreferenced code."; |
|||
|
|||
public const string StyleResourceIncludeRequiresUnreferenceCodeMessage = "StyleInclude and ResourceInclude use AvaloniaXamlLoader.Load which dynamically loads referenced assembly with Avalonia resources. Note, StyleInclude and ResourceInclude defined in XAML are resolved compile time and are safe with trimming and AOT."; |
|||
public const string AvaloniaXamlLoaderRequiresUnreferenceCodeMessage = "AvaloniaXamlLoader.Load(uri, baseUri) dynamically loads referenced assembly with Avalonia resources."; |
|||
public const string XamlTypeResolvedRequiresUnreferenceCodeMessage = "XamlTypeResolver might require unreferenced code."; |
|||
|
|||
public const string IgnoreNativeAotSupressWarningMessage = "This method is not supported by NativeAOT."; |
|||
} |
|||
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue