mirror of
https://github.com/VSadov/Satori.git
synced 2025-06-10 01:50:53 +09:00
Add more trimming annotations to Mono CoreLib (#38148)
I've also annotated CoreCLR's `Type.GetType` in the same spot as Mono. Mono's implementation was triggering warnings, which is what promted me to add it there, but we should annotate this nonetheless because absent intrinsic treatment in Linker, this would be unsafe.
This commit is contained in:
parent
1f4d0db233
commit
4aacf930ec
6 changed files with 31 additions and 1 deletions
|
@ -2,6 +2,7 @@
|
|||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using StackCrawlMark = System.Threading.StackCrawlMark;
|
||||
|
@ -20,6 +21,7 @@ namespace System
|
|||
}
|
||||
}
|
||||
|
||||
[RequiresUnreferencedCode("The type might be removed")]
|
||||
[System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod
|
||||
public static Type? GetType(string typeName, bool throwOnError, bool ignoreCase)
|
||||
{
|
||||
|
@ -27,6 +29,7 @@ namespace System
|
|||
return RuntimeType.GetType(typeName, throwOnError, ignoreCase, ref stackMark);
|
||||
}
|
||||
|
||||
[RequiresUnreferencedCode("The type might be removed")]
|
||||
[System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod
|
||||
public static Type? GetType(string typeName, bool throwOnError)
|
||||
{
|
||||
|
@ -34,6 +37,7 @@ namespace System
|
|||
return RuntimeType.GetType(typeName, throwOnError, false, ref stackMark);
|
||||
}
|
||||
|
||||
[RequiresUnreferencedCode("The type might be removed")]
|
||||
[System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod
|
||||
public static Type? GetType(string typeName)
|
||||
{
|
||||
|
@ -41,6 +45,7 @@ namespace System
|
|||
return RuntimeType.GetType(typeName, false, false, ref stackMark);
|
||||
}
|
||||
|
||||
[RequiresUnreferencedCode("The type might be removed")]
|
||||
[System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod
|
||||
public static Type? GetType(
|
||||
string typeName,
|
||||
|
@ -51,6 +56,7 @@ namespace System
|
|||
return TypeNameParser.GetType(typeName, assemblyResolver, typeResolver, false, false, ref stackMark);
|
||||
}
|
||||
|
||||
[RequiresUnreferencedCode("The type might be removed")]
|
||||
[System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod
|
||||
public static Type? GetType(
|
||||
string typeName,
|
||||
|
@ -62,6 +68,7 @@ namespace System
|
|||
return TypeNameParser.GetType(typeName, assemblyResolver, typeResolver, throwOnError, false, ref stackMark);
|
||||
}
|
||||
|
||||
[RequiresUnreferencedCode("The type might be removed")]
|
||||
[System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod
|
||||
public static Type? GetType(
|
||||
string typeName,
|
||||
|
|
|
@ -4222,11 +4222,17 @@ namespace System
|
|||
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicProperties | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)]
|
||||
protected abstract System.Reflection.PropertyInfo? GetPropertyImpl(string name, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, System.Type? returnType, System.Type[]? types, System.Reflection.ParameterModifier[]? modifiers);
|
||||
public new System.Type GetType() { throw null; }
|
||||
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The type might be removed")]
|
||||
public static System.Type? GetType(string typeName) { throw null; }
|
||||
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The type might be removed")]
|
||||
public static System.Type? GetType(string typeName, bool throwOnError) { throw null; }
|
||||
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The type might be removed")]
|
||||
public static System.Type? GetType(string typeName, bool throwOnError, bool ignoreCase) { throw null; }
|
||||
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The type might be removed")]
|
||||
public static System.Type? GetType(string typeName, System.Func<System.Reflection.AssemblyName, System.Reflection.Assembly?>? assemblyResolver, System.Func<System.Reflection.Assembly?, string, bool, System.Type?>? typeResolver) { throw null; }
|
||||
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The type might be removed")]
|
||||
public static System.Type? GetType(string typeName, System.Func<System.Reflection.AssemblyName, System.Reflection.Assembly?>? assemblyResolver, System.Func<System.Reflection.Assembly?, string, bool, System.Type?>? typeResolver, bool throwOnError) { throw null; }
|
||||
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The type might be removed")]
|
||||
public static System.Type? GetType(string typeName, System.Func<System.Reflection.AssemblyName, System.Reflection.Assembly?>? assemblyResolver, System.Func<System.Reflection.Assembly?, string, bool, System.Type?>? typeResolver, bool throwOnError, bool ignoreCase) { throw null; }
|
||||
public static System.Type[] GetTypeArray(object[] args) { throw null; }
|
||||
public static System.TypeCode GetTypeCode(System.Type? type) { throw null; }
|
||||
|
|
|
@ -248,6 +248,8 @@ namespace System
|
|||
return null;
|
||||
}
|
||||
|
||||
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2006:UnrecognizedReflectionPattern",
|
||||
Justification = "Invoke method is never removed from delegates")]
|
||||
private static bool IsMatchingCandidate(Type type, object? target, MethodInfo method, bool allowClosed, out DelegateData? delegateData)
|
||||
{
|
||||
MethodInfo? invoke = type.GetMethod("Invoke");
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Threading;
|
||||
|
@ -316,7 +317,9 @@ namespace System.Runtime.InteropServices
|
|||
PtrToStructureInternal(ptr, structure, allowValueClasses);
|
||||
}
|
||||
|
||||
private static object PtrToStructureHelper(IntPtr ptr, Type structureType)
|
||||
private static object PtrToStructureHelper(IntPtr ptr,
|
||||
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)]
|
||||
Type structureType)
|
||||
{
|
||||
object obj = Activator.CreateInstance(structureType)!;
|
||||
PtrToStructureHelper(ptr, obj, true);
|
||||
|
@ -371,6 +374,8 @@ namespace System.Runtime.InteropServices
|
|||
|
||||
private static Dictionary<(Type, string), ICustomMarshaler>? MarshalerInstanceCache;
|
||||
|
||||
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2006:UnrecognizedReflectionPattern",
|
||||
Justification = "Implementation detail of MarshalAs.CustomMarshaler")]
|
||||
internal static ICustomMarshaler? GetCustomMarshalerInstance(Type type, string cookie)
|
||||
{
|
||||
var key = (type, cookie);
|
||||
|
|
|
@ -1685,6 +1685,8 @@ namespace System
|
|||
throw new NotSupportedException(Environment.GetResourceString("Acc_CreateVoid"));
|
||||
}
|
||||
|
||||
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2006:UnrecognizedReflectionPattern",
|
||||
Justification = "Implementation detail of Activator that linker intrinsically recognizes")]
|
||||
internal object? CreateInstanceImpl(
|
||||
BindingFlags bindingAttr, Binder? binder, object?[]? args, CultureInfo? culture)
|
||||
{
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Reflection;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Threading;
|
||||
|
||||
|
@ -34,6 +35,7 @@ namespace System
|
|||
}
|
||||
}
|
||||
|
||||
[RequiresUnreferencedCode("The type might be removed")]
|
||||
[System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod
|
||||
public static Type? GetType(string typeName, bool throwOnError, bool ignoreCase)
|
||||
{
|
||||
|
@ -41,6 +43,7 @@ namespace System
|
|||
return RuntimeType.GetType(typeName, throwOnError, ignoreCase, false, ref stackMark);
|
||||
}
|
||||
|
||||
[RequiresUnreferencedCode("The type might be removed")]
|
||||
[System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod
|
||||
public static Type? GetType(string typeName, bool throwOnError)
|
||||
{
|
||||
|
@ -48,6 +51,7 @@ namespace System
|
|||
return RuntimeType.GetType(typeName, throwOnError, false, false, ref stackMark);
|
||||
}
|
||||
|
||||
[RequiresUnreferencedCode("The type might be removed")]
|
||||
[System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod
|
||||
public static Type? GetType(string typeName)
|
||||
{
|
||||
|
@ -55,6 +59,7 @@ namespace System
|
|||
return RuntimeType.GetType(typeName, false, false, false, ref stackMark);
|
||||
}
|
||||
|
||||
[RequiresUnreferencedCode("The type might be removed")]
|
||||
[System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod
|
||||
public static Type? GetType(string typeName, Func<AssemblyName, Assembly?>? assemblyResolver, Func<Assembly?, string, bool, Type?>? typeResolver)
|
||||
{
|
||||
|
@ -62,6 +67,7 @@ namespace System
|
|||
return GetType(typeName, assemblyResolver, typeResolver, false, false, ref stackMark);
|
||||
}
|
||||
|
||||
[RequiresUnreferencedCode("The type might be removed")]
|
||||
[System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod
|
||||
public static Type? GetType(string typeName, Func<AssemblyName, Assembly?>? assemblyResolver, Func<Assembly?, string, bool, Type?>? typeResolver, bool throwOnError)
|
||||
{
|
||||
|
@ -69,6 +75,7 @@ namespace System
|
|||
return GetType(typeName, assemblyResolver, typeResolver, throwOnError, false, ref stackMark);
|
||||
}
|
||||
|
||||
[RequiresUnreferencedCode("The type might be removed")]
|
||||
[System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod
|
||||
public static Type? GetType(string typeName, Func<AssemblyName, Assembly?>? assemblyResolver, Func<Assembly?, string, bool, Type?>? typeResolver, bool throwOnError, bool ignoreCase)
|
||||
{
|
||||
|
@ -76,6 +83,7 @@ namespace System
|
|||
return GetType(typeName, assemblyResolver, typeResolver, throwOnError, ignoreCase, ref stackMark);
|
||||
}
|
||||
|
||||
[RequiresUnreferencedCode("The type might be removed")]
|
||||
private static Type? GetType(string typeName, Func<AssemblyName, Assembly?>? assemblyResolver, Func<Assembly?, string, bool, Type?>? typeResolver, bool throwOnError, bool ignoreCase, ref StackCrawlMark stackMark)
|
||||
{
|
||||
return TypeNameParser.GetType(typeName, assemblyResolver, typeResolver, throwOnError, ignoreCase, ref stackMark);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue