{
foreach (var node in MarkedNodes)
{
- if (node is IMethodBodyNode)
- yield return ((IMethodBodyNode)node).Method;
+ if (node is IMethodBodyNode methodBodyNode)
+ yield return methodBodyNode.Method;
}
}
}
foreach (var node in MarkedNodes)
{
if (node is ConstructedEETypeNode || node is CanonicalEETypeNode)
- {
yield return ((IEETypeNode)node).Type;
- }
}
}
}
{
foreach (var node in MarkedNodes)
{
- if (node is IEETypeNode)
- {
- yield return ((IEETypeNode)node).Type;
- }
+ if (node is IEETypeNode typeNode)
+ yield return typeNode.Type;
+ }
+ }
+ }
+
+ public IEnumerable<MethodDesc> ReflectedMethods
+ {
+ get
+ {
+ foreach (var node in MarkedNodes)
+ {
+ if (node is ReflectedMethodNode reflectedMethod)
+ yield return reflectedMethod.Method;
}
}
}
// All values except for Nullable<T>, including Nullable<> (with no type arguments)
return new SystemTypeValue(genericArgumentType);
}
+ else if (genericArgument is ArrayType arrayType)
+ {
+ return new SystemTypeValue(arrayType);
+ }
else
{
return UnknownValue.Instance;
<RuntimeHostConfigurationOption Include="Mono.Linker.Tests.ArtifactsDir">
<Value>$(ArtifactsDir)</Value>
</RuntimeHostConfigurationOption>
+ <RuntimeHostConfigurationOption Include="Mono.Linker.Tests.ILToolsDir">
+ <Value>$(CoreCLRArtifactsPath)</Value>
+ </RuntimeHostConfigurationOption>
<RuntimeHostConfigurationOption Include="Mono.Linker.Tests.ArtifactsBinDir">
<Value>$(ArtifactsBinDir)</Value>
</RuntimeHostConfigurationOption>
using System.Text;
using FluentAssertions;
using ILCompiler;
-using ILCompiler.DependencyAnalysis;
-using Internal.IL.Stubs;
using Internal.TypeSystem;
using Internal.TypeSystem.Ecma;
using Mono.Cecil;
// Ignore NativeAOT injected members
"<Module>.StartupCodeMain(Int32,IntPtr)",
- "<Module>.MainMethodWrapper()"
+ "<Module>.MainMethodWrapper()",
+
+ // Ignore compiler generated code which can't be reasonably matched to the source method
+ "<PrivateImplementationDetails>",
};
public AssemblyChecker (
AddMethod (method);
}
+ foreach (MethodDesc method in testResult.TrimmingResults.ReflectedMethods) {
+ AddMethod (method);
+ }
+
void AddMethod (MethodDesc method)
{
MethodDesc methodDef = method.GetTypicalMethodDefinition ();
compilationRoots.Add (new MainMethodRootProvider (entrypointModule, CreateInitializerList (typeSystemContext, options), generateLibraryAndModuleInitializers: true));
+ foreach (var rootedAssembly in options.AdditionalRootAssemblies) {
+ EcmaModule module = typeSystemContext.GetModuleForSimpleName (rootedAssembly);
+
+ // We only root the module type. The rest will fall out because we treat rootedAssemblies
+ // same as conditionally rooted ones and here we're fulfilling the condition ("something is used").
+ compilationRoots.Add (
+ new GenericRootProvider<ModuleDesc> (module,
+ (ModuleDesc module, IRootingServiceProvider rooter) => rooter.AddReflectionRoot (module.GetGlobalModuleType (), "Command line root")));
+ }
+
ILProvider ilProvider = new NativeAotILProvider ();
Logger logger = new Logger (
#if NETCOREAPP
var extension = RuntimeInformation.IsOSPlatform (OSPlatform.Windows) ? ".exe" : "";
- // working directory is artifacts/bin/Mono.Linker.Tests/<config>/<tfm>
- var toolsDir = Path.Combine (Directory.GetCurrentDirectory (), "..", "..", "..", "..", "tools");
+ var toolsDir = (string) AppContext.GetData ("Mono.Linker.Tests.ILToolsDir")!;
- var ilasmPath = Path.GetFullPath (Path.Combine (toolsDir, "ilasm", $"ilasm{extension}")).ToNPath ();
+ var ilasmPath = Path.GetFullPath (Path.Combine (toolsDir, $"ilasm{extension}")).ToNPath ();
if (ilasmPath.FileExists ())
return ilasmPath;
foreach (var inputReference in sandbox.InputDirectory.Files ()) {
var ext = inputReference.ExtensionWithDot;
if (ext == ".dll" || ext == ".exe") {
- if (caseDefinedOptions.AssembliesAction.Contains (("link", inputReference.FileNameWithoutExtension))) {
- builder.AddLinkAssembly (inputReference);
- } else {
- builder.AddReference (inputReference);
- }
+ // It's important to add all assemblies as "link" assemblies since the default configuration
+ // is to run the compiler in multi-file mode which will not process anything which is just in the reference set.
+ builder.AddLinkAssembly (inputReference);
}
}
var coreAction = caseDefinedOptions.TrimMode ?? "skip";
if (staticType is null) {
// We don't know anything about the type GetType was called on. Track this as a usual result of a method call without any annotations
AddReturnValue (context.Annotations.FlowAnnotations.GetMethodReturnValue (calledMethodDefinition));
- } else if (staticType.IsSealed || staticType.IsTypeOf ("System", "Delegate")) {
+ } else if (staticType.IsSealed || staticType.IsTypeOf ("System", "Delegate") || staticType.IsTypeOf ("System", "Array")) {
// We can treat this one the same as if it was a typeof() expression
// We can allow Object.GetType to be modeled as System.Delegate because we keep all methods
// on delegates anyway so reflection on something this approximation would miss is actually safe.
+ // We can also treat all arrays as "sealed" since it's not legal to derive from Array type (even though it is not sealed itself)
+
// We ignore the fact that the type can be annotated (see below for handling of annotated types)
// This means the annotations (if any) won't be applied - instead we rely on the exact knowledge
// of the type. So for example even if the type is annotated with PublicMethods
}
[Kept]
- // https://github.com/dotnet/linker/issues/2874
+ // https://github.com/dotnet/runtime/issues/85464
[ExpectedWarning ("IL2069", ProducedBy = Tool.Trimmer | Tool.NativeAot)]
[ExpectedWarning ("IL2069", ProducedBy = Tool.Trimmer | Tool.NativeAot)]
public static void Test ()
namespace Mono.Linker.Tests.Cases.DataFlow
{
- [IgnoreTestCase ("Ignore in NativeAOT, see https://github.com/dotnet/runtime/issues/82447", IgnoredBy = Tool.NativeAot)]
- // This test tries to hit a case where the entire assemly is preserved (via descriptor, NOT action)
+ // This test tries to hit a case where the entire assembly is preserved (via descriptor, NOT action)
// meaning we will go and mark all types and members in it.
// At the same time there's a compiler generated method (local function) which is called from
// a branch which will be removed due to constant propagation.
}
// Analyzer doesn't implement constant propagation and branch removal, so it reaches this code
- [ExpectedWarning ("IL2026", ProducedBy = Tool.Analyzer)]
+ // NativeAOT behavioral difference:
+ // https://github.com/dotnet/runtime/issues/85161
+ [ExpectedWarning ("IL2026", ProducedBy = Tool.Analyzer | Tool.NativeAot)]
void LocalWithWarning ()
{
// No warning
}
// Analyzer doesn't implement constant propagation and branch removal, so it reaches this code
- [ExpectedWarning ("IL2026", ProducedBy = Tool.Analyzer)]
+ // NativeAOT behavioral difference:
+ // https://github.com/dotnet/runtime/issues/85161
+ [ExpectedWarning ("IL2026", ProducedBy = Tool.Analyzer | Tool.NativeAot)]
void LocalWithWarning ()
{
Requires ();
namespace Mono.Linker.Tests.Cases.DataFlow
{
- [IgnoreTestCase ("Ignore in NativeAOT, see https://github.com/dotnet/runtime/issues/82447", IgnoredBy = Tool.NativeAot)]
- [KeptAttributeAttribute (typeof (IgnoreTestCaseAttribute), By = Tool.Trimmer)]
+ [ExpectedNoWarnings]
+ [UnconditionalSuppressMessage("AOT", "IL3050", Justification = "Applying DAM PublicMethods on an array will mark Array.CreateInstance which has RDC on it")]
+ [KeptAttributeAttribute(typeof(UnconditionalSuppressMessageAttribute))]
public class ComplexTypeHandling
{
public static void Main ()
_ = new RequirePublicMethodsGeneric<T[]> ();
}
- [Kept]
+ [Kept (By = Tool.Trimmer)] // NativeAOT doesn't preserve array element types just due to the usage of the array type
sealed class ArrayGetTypeFromMethodParamElement
{
// This method should not be marked, instead Array.* should be marked
TestArrayGetTypeFromMethodParamHelper (null);
}
- [Kept]
+ [Kept (By = Tool.Trimmer)] // NativeAOT doesn't preserve array element types just due to the usage of the array type
sealed class ArrayGetTypeFromFieldElement
{
// This method should not be marked, instead Array.* should be marked
RequirePublicMethods (Type.GetType ("Mono.Linker.Tests.Cases.DataFlow.ComplexTypeHandling+ArrayTypeGetTypeElement[]"));
}
- // Technically there's no reason to mark this type since it's only used as an array element type and CreateInstance
- // doesn't work on arrays, but the currently implementation will preserve it anyway due to how it processes
+ // Trimmer: Technically there's no reason to mark this type since it's only used as an array element type and CreateInstance
+ // doesn't work on arrays, but the current implementation will preserve it anyway due to how it processes
// string -> Type resolution. This will only impact code which would have failed at runtime, so very unlikely to
// actually occur in real apps (and even if it does happen, it just increases size, doesn't break behavior).
- [Kept]
+ [Kept (By = Tool.Trimmer)] // NativeAOT doesn't preserve array element types just due to the usage of the array type
class ArrayCreateInstanceByNameElement
{
public ArrayCreateInstanceByNameElement ()
}
[Kept]
+ [ExpectedWarning ("IL2032", ProducedBy = Tool.NativeAot)] // https://github.com/dotnet/runtime/issues/82447
static void TestArrayCreateInstanceByName ()
{
Activator.CreateInstance ("test", "Mono.Linker.Tests.Cases.DataFlow.ComplexTypeHandling+ArrayCreateInstanceByNameElement[]");
}
- [Kept]
+ [Kept (By = Tool.Trimmer)] // NativeAOT doesn't preserve array element types just due to the usage of the array type
class ArrayInAttributeParamElement
{
// This method should not be marked, instead Array.* should be marked
[Kept]
[KeptAttributeAttribute (typeof (RequiresPublicMethodAttribute))]
[RequiresPublicMethod (typeof (ArrayInAttributeParamElement[]))]
- static void TestArrayInAttributeParameter ()
+ static void TestArrayInAttributeParameterImpl ()
{
}
+ [Kept]
+ static void TestArrayInAttributeParameter()
+ {
+ // Have to access the method through reflection, otherwise NativeAOT will remove all attributes on it
+ // since they're not accessible.
+ typeof (ComplexTypeHandling).GetMethod (nameof (TestArrayInAttributeParameterImpl), System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic).Invoke (null, new object[] { });
+ }
[Kept]
private static void RequirePublicMethods (
namespace Mono.Linker.Tests.Cases.DataFlow
{
- [IgnoreTestCase ("Ignore in NativeAOT, see https://github.com/dotnet/runtime/issues/82447", IgnoredBy = Tool.NativeAot)]
[ExpectedNoWarnings]
[SkipKeptItemsValidation]
class ConstructedTypesDataFlow
namespace Mono.Linker.Tests.Cases.DataFlow
{
- [IgnoreTestCase ("Ignore in NativeAOT, see https://github.com/dotnet/runtime/issues/82447", IgnoredBy = Tool.NativeAot)]
[SkipKeptItemsValidation]
[ExpectedNoWarnings]
[UnconditionalSuppressMessage ("AOT", "IL3050", Justification = "These tests are not targetted at AOT scenarios")]
}
// https://github.com/dotnet/linker/issues/2755
- [ExpectedWarning ("IL2055", nameof (Type.MakeGenericType), ProducedBy = Tool.Trimmer)]
+ [ExpectedWarning ("IL2055", nameof (Type.MakeGenericType), ProducedBy = Tool.Trimmer | Tool.NativeAot)]
static void TestWithUnknownTypeArray (Type[] types)
{
typeof (GenericWithPublicFieldsArgument<>).MakeGenericType (types);
}
// https://github.com/dotnet/linker/issues/2755
- [ExpectedWarning ("IL2055", nameof (Type.MakeGenericType), ProducedBy = Tool.Trimmer)]
+ [ExpectedWarning ("IL2055", nameof (Type.MakeGenericType), ProducedBy = Tool.Trimmer | Tool.NativeAot)]
static void TestWithArrayUnknownLengthSet (int arrayLen)
{
Type[] types = new Type[arrayLen];
}
// https://github.com/dotnet/linker/issues/2755
- [ExpectedWarning ("IL2060", nameof (MethodInfo.MakeGenericMethod), ProducedBy = Tool.Trimmer)]
+ [ExpectedWarning ("IL2060", nameof (MethodInfo.MakeGenericMethod), ProducedBy = Tool.Trimmer | Tool.NativeAot)]
static void TestUnknownMethod (MethodInfo mi)
{
mi.MakeGenericMethod (typeof (TestType));
}
// https://github.com/dotnet/linker/issues/2755
- [ExpectedWarning ("IL2060", nameof (MethodInfo.MakeGenericMethod), ProducedBy = Tool.Trimmer)]
+ [ExpectedWarning ("IL2060", nameof (MethodInfo.MakeGenericMethod), ProducedBy = Tool.Trimmer | Tool.NativeAot)]
static void TestUnknownMethodButNoTypeArguments (MethodInfo mi)
{
// Technically trimming could figure this out, but it's not worth the complexity - such call will always fail at runtime.
}
// https://github.com/dotnet/linker/issues/2755
- [ExpectedWarning ("IL2060", nameof (MethodInfo.MakeGenericMethod), ProducedBy = Tool.Trimmer)]
+ [ExpectedWarning ("IL2060", nameof (MethodInfo.MakeGenericMethod), ProducedBy = Tool.Trimmer | Tool.NativeAot)]
static void TestWithUnknownTypeArray (Type[] types)
{
typeof (MakeGenericMethod).GetMethod (nameof (GenericWithRequirements), BindingFlags.Static)
}
// https://github.com/dotnet/linker/issues/2158 - analyzer doesn't work the same as ILLink, it simply doesn't handle refs
- [ExpectedWarning ("IL2060", nameof (MethodInfo.MakeGenericMethod), ProducedBy = Tool.Trimmer)]
+ [ExpectedWarning ("IL2060", nameof (MethodInfo.MakeGenericMethod), ProducedBy = Tool.Trimmer | Tool.NativeAot)]
static void TestWithArrayUnknownIndexSetByRef (int indexToSet)
{
Type[] types = new Type[1];
}
// https://github.com/dotnet/linker/issues/2755
- [ExpectedWarning ("IL2060", nameof (MethodInfo.MakeGenericMethod), ProducedBy = Tool.Trimmer)]
+ [ExpectedWarning ("IL2060", nameof (MethodInfo.MakeGenericMethod), ProducedBy = Tool.Trimmer | Tool.NativeAot)]
static void TestWithArrayUnknownLengthSet (int arrayLen)
{
Type[] types = new Type[arrayLen];
namespace Mono.Linker.Tests.Cases.DataFlow
{
- [IgnoreTestCase ("Ignore in NativeAOT, see https://github.com/dotnet/runtime/issues/82447", IgnoredBy = Tool.NativeAot)]
- [KeptAttributeAttribute (typeof (IgnoreTestCaseAttribute), By = Tool.Trimmer)]
[SetupCompileArgument ("/optimize+")]
[ExpectedNoWarnings]
public class MemberTypes
{
- // Some of the types below declare delegates and will mark all members on them, this includes the Delegate .ctor(object, string) which has RUC and other members
- [ExpectedWarning ("IL2026", nameof (Delegate) + ".Delegate")]
- [ExpectedWarning ("IL2026", nameof (Delegate) + ".Delegate")]
- [ExpectedWarning ("IL2026", nameof (Delegate) + ".Delegate")]
- [ExpectedWarning ("IL2026", nameof (Delegate) + ".Delegate")]
- [ExpectedWarning ("IL2026", nameof (Delegate) + ".Delegate")]
- [ExpectedWarning ("IL2026", nameof (Delegate.CreateDelegate))]
- [ExpectedWarning ("IL2026", nameof (Delegate.CreateDelegate))]
- [ExpectedWarning ("IL2026", nameof (Delegate.CreateDelegate))]
- [ExpectedWarning ("IL2026", nameof (Delegate.CreateDelegate))]
- [ExpectedWarning ("IL2026", nameof (Delegate.CreateDelegate))]
- [ExpectedWarning ("IL2026", nameof (Delegate.CreateDelegate))]
- [ExpectedWarning ("IL2026", nameof (Delegate.CreateDelegate))]
- [ExpectedWarning ("IL2026", nameof (Delegate.CreateDelegate))]
- [ExpectedWarning ("IL2026", nameof (Delegate.CreateDelegate))]
- [ExpectedWarning ("IL2026", nameof (Delegate.CreateDelegate))]
- [ExpectedWarning ("IL2026", nameof (Delegate.CreateDelegate))]
- [ExpectedWarning ("IL2026", nameof (Delegate.CreateDelegate))]
- [ExpectedWarning ("IL2026", nameof (Delegate.CreateDelegate))]
- [ExpectedWarning ("IL2026", nameof (Delegate.CreateDelegate))]
- [ExpectedWarning ("IL2026", nameof (Delegate.CreateDelegate))]
- [ExpectedWarning ("IL2026", nameof (MulticastDelegate) + ".MulticastDelegate")]
- [ExpectedWarning ("IL2026", nameof (MulticastDelegate) + ".MulticastDelegate")]
- [ExpectedWarning ("IL2026", nameof (MulticastDelegate) + ".MulticastDelegate")]
- [ExpectedWarning ("IL2026", nameof (MulticastDelegate) + ".MulticastDelegate")]
- [ExpectedWarning ("IL2026", nameof (MulticastDelegate) + ".MulticastDelegate")]
- // Some of the types below declare delegates and will mark all members on them, this includes the Delegate .ctor(Type, string) which has DAM annotations and other members
- [ExpectedWarning ("IL2111", nameof (Delegate) + ".Delegate")]
- [ExpectedWarning ("IL2111", nameof (Delegate) + ".Delegate")]
- [ExpectedWarning ("IL2111", nameof (Delegate) + ".Delegate")]
- [ExpectedWarning ("IL2111", nameof (Delegate) + ".Delegate")]
- [ExpectedWarning ("IL2111", nameof (Delegate) + ".Delegate")]
- [ExpectedWarning ("IL2111", nameof (Delegate.CreateDelegate))]
- [ExpectedWarning ("IL2111", nameof (Delegate.CreateDelegate))]
- [ExpectedWarning ("IL2111", nameof (Delegate.CreateDelegate))]
- [ExpectedWarning ("IL2111", nameof (Delegate.CreateDelegate))]
- [ExpectedWarning ("IL2111", nameof (Delegate.CreateDelegate))]
- [ExpectedWarning ("IL2111", nameof (Delegate.CreateDelegate))]
- [ExpectedWarning ("IL2111", nameof (Delegate.CreateDelegate))]
- [ExpectedWarning ("IL2111", nameof (Delegate.CreateDelegate))]
- [ExpectedWarning ("IL2111", nameof (Delegate.CreateDelegate))]
- [ExpectedWarning ("IL2111", nameof (Delegate.CreateDelegate))]
- [ExpectedWarning ("IL2111", nameof (Delegate.CreateDelegate))]
- [ExpectedWarning ("IL2111", nameof (Delegate.CreateDelegate))]
- [ExpectedWarning ("IL2111", nameof (Delegate.CreateDelegate))]
- [ExpectedWarning ("IL2111", nameof (Delegate.CreateDelegate))]
- [ExpectedWarning ("IL2111", nameof (Delegate.CreateDelegate))]
- [ExpectedWarning ("IL2111", nameof (MulticastDelegate) + ".MulticastDelegate")]
- [ExpectedWarning ("IL2111", nameof (MulticastDelegate) + ".MulticastDelegate")]
- [ExpectedWarning ("IL2111", nameof (MulticastDelegate) + ".MulticastDelegate")]
- [ExpectedWarning ("IL2111", nameof (MulticastDelegate) + ".MulticastDelegate")]
- [ExpectedWarning ("IL2111", nameof (MulticastDelegate) + ".MulticastDelegate")]
- [ExpectedWarning ("IL2111", nameof (Delegate) + ".BindToMethodName", ProducedBy = Tool.Trimmer)]
- [ExpectedWarning ("IL2111", nameof (Delegate) + ".BindToMethodName", ProducedBy = Tool.Trimmer)]
- [ExpectedWarning ("IL2111", nameof (Delegate) + ".BindToMethodName", ProducedBy = Tool.Trimmer)]
- [ExpectedWarning ("IL2111", nameof (Delegate) + ".BindToMethodName", ProducedBy = Tool.Trimmer)]
- [ExpectedWarning ("IL2111", nameof (Delegate) + ".BindToMethodName", ProducedBy = Tool.Trimmer)]
+ // This is an easy way to suppress all trim related warnings in the Main method
+ // This test is about marking, not diagnostics and this Main will produce several warnings due to it accssing
+ // some problematic APIs (Delegate.Create for example) via reflection.
+ [RequiresUnreferencedCode("test")]
+ [KeptAttributeAttribute(typeof(RequiresUnreferencedCodeAttribute))]
public static void Main ()
{
RequirePublicParameterlessConstructor (typeof (PublicParameterlessConstructorType));
namespace Mono.Linker.Tests.Cases.DataFlow
{
- [IgnoreTestCase ("Ignore in NativeAOT, see https://github.com/dotnet/runtime/issues/82447", IgnoredBy = Tool.NativeAot)]
- [KeptAttributeAttribute (typeof (IgnoreTestCaseAttribute), By = Tool.Trimmer)]
[ExpectedNoWarnings]
[SetupCompileBefore ("base.dll", new[] { "Dependencies/MemberTypesAllBaseTypeAssembly.cs" })]
[KeptTypeInAssembly ("base.dll", "Mono.Linker.Tests.Cases.DataFlow.Dependencies.MemberTypesAllBaseType/PrivateNestedType")]
[KeptMemberInAssembly ("base.dll", "Mono.Linker.Tests.Cases.DataFlow.Dependencies.MemberTypesAllBaseType/PrivateNestedType", new string[] { "PrivateMethod()" })]
- [KeptMember (".ctor()")]
+ // https://github.com/dotnet/runtime/issues/78752
+ [KeptMember (".ctor()", By = Tool.Trimmer)]
public class MemberTypesAllOnCopyAssembly
{
public static void Main ()
namespace Mono.Linker.Tests.Cases.DataFlow
{
- [IgnoreTestCase ("Ignore in NativeAOT, see https://github.com/dotnet/runtime/issues/82447", IgnoredBy = Tool.NativeAot)]
[SkipKeptItemsValidation]
[ExpectedNoWarnings]
class MethodByRefParameterDataFlow
[return: DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.PublicFields)]
static ref Type GetTypeRefWithMethodsAndFields () { throw null; }
- [ExpectedWarning ("IL2067", "t", "InnerMethodWithDam")]
- [ExpectedWarning ("IL2067", "tWithMethodsAndFields", "InnerMethodWithDam")]
+ [ExpectedWarning ("IL2067", "'t'", "InnerMethodWithDam")]
+ [ExpectedWarning ("IL2067", "'tWithMethodsAndFields'", "InnerMethodWithDam")]
[ExpectedWarning ("IL2072", nameof (GetTypeRefWithoutAnnotations), "InnerMethodWithDam")]
[ExpectedWarning ("IL2068", nameof (GetTypeRefWithMethodsAndFields), "InnerMethodWithDam")]
- static void MethodWithLocaMethodWithDam (Type t, [DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicMethods)] Type tWithMethods, [DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.PublicFields)] Type tWithMethodsAndFields)
+ static void MethodWithLocalMethodWithDam (Type t, [DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicMethods)] Type tWithMethods, [DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.PublicFields)] Type tWithMethodsAndFields)
{
// 2067
InnerMethodWithDam (ref t);
public static void Test ()
{
- MethodWithLocaMethodWithDam (null, null, null);
+ MethodWithLocalMethodWithDam (null, null, null);
}
}
namespace Mono.Linker.Tests.Cases.DataFlow
{
- [IgnoreTestCase ("Ignore in NativeAOT, see https://github.com/dotnet/runtime/issues/82447", IgnoredBy = Tool.NativeAot)]
- [KeptAttributeAttribute (typeof (IgnoreTestCaseAttribute), By = Tool.Trimmer)]
[ExpectedNoWarnings]
[KeptPrivateImplementationDetails ("ThrowSwitchExpressionException")]
[KeptAttributeAttribute (typeof (UnconditionalSuppressMessageAttribute))]
[Kept]
// https://github.com/dotnet/linker/issues/2755
- [ExpectedWarning ("IL2075", "GetFields", ProducedBy = Tool.Trimmer)]
+ [ExpectedWarning ("IL2075", "GetFields", ProducedBy = Tool.Trimmer | Tool.NativeAot)]
static void MakeGenericTypeWithKnowAndUnknownArray (Type[] unknownTypes = null, int p = 0)
{
Type[] types = p switch {
namespace Mono.Linker.Tests.Cases.DataFlow
{
- [IgnoreTestCase ("Ignore in NativeAOT, see https://github.com/dotnet/runtime/issues/82447", IgnoredBy = Tool.NativeAot)]
// Note: this test's goal is to validate that the product correctly reports unrecognized patterns
// - so the main validation is done by the ExpectedWarning attributes.
[SkipKeptItemsValidation]
// Analyzer doesn't try to detect backing fields of properties: https://github.com/dotnet/linker/issues/2273
[ExpectedWarning ("IL2042",
"Mono.Linker.Tests.Cases.DataFlow.PropertyDataFlow.TestAutomaticPropagationType.PropertyWithDifferentBackingFields",
- ProducedBy = Tool.Trimmer)]
+ ProducedBy = Tool.Trimmer | Tool.NativeAot)]
[ExpectedWarning ("IL2078",
nameof (TestAutomaticPropagationType) + "." + nameof (PropertyWithDifferentBackingFields) + ".get",
"Type",
Type PropertyWithDifferentBackingFields {
[ExpectedWarning ("IL2078",
nameof (TestAutomaticPropagationType) + "." + nameof (PropertyWithDifferentBackingFields) + ".get",
- ProducedBy = Tool.Trimmer)]
+ ProducedBy = Tool.Trimmer | Tool.NativeAot)]
get {
return PropertyWithDifferentBackingFields_GetterField;
}
// Analyzer doesn't try to detect backing fields of properties: https://github.com/dotnet/linker/issues/2273
[ExpectedWarning ("IL2056", "PropertyWithExistingAttributes", "PropertyWithExistingAttributes_Field",
- ProducedBy = Tool.Trimmer)]
+ ProducedBy = Tool.Trimmer | Tool.NativeAot)]
[DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicConstructors)]
[CompilerGenerated]
Type PropertyWithExistingAttributes_Field;
Type PropertyWithExistingAttributes {
// On property/accessor mismatch, ILLink warns on accessor and analyzer warns on property https://github.com/dotnet/linker/issues/2654
[ExpectedWarning ("IL2043", "PropertyWithExistingAttributes", "PropertyWithExistingAttributes.get",
- ProducedBy = Tool.Trimmer)]
+ ProducedBy = Tool.Trimmer | Tool.NativeAot)]
[return: DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicConstructors)]
get { return PropertyWithExistingAttributes_Field; }
// On property/accessor mismatch, ILLink warns on accessor and analyzer warns on property https://github.com/dotnet/linker/issues/2654
[ExpectedWarning ("IL2043", "PropertyWithExistingAttributes", "PropertyWithExistingAttributes.set",
- ProducedBy = Tool.Trimmer)]
+ ProducedBy = Tool.Trimmer | Tool.NativeAot)]
[param: DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicConstructors)]
set { PropertyWithExistingAttributes_Field = value; }
}
// Analyzer doesn't try to detect backing fields of properties: https://github.com/dotnet/linker/issues/2273
[ExpectedWarning ("IL2056", "PropertyWithConflictingAttributes", "PropertyWithConflictingAttributes_Field",
- ProducedBy = Tool.Trimmer)]
+ ProducedBy = Tool.Trimmer | Tool.NativeAot)]
[DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.NonPublicConstructors)]
[CompilerGenerated]
Type PropertyWithConflictingAttributes_Field;
Type PropertyWithConflictingAttributes {
// On property/accessor mismatch, ILLink warns on accessor and analyzer warns on property https://github.com/dotnet/linker/issues/2654
[ExpectedWarning ("IL2043", "PropertyWithConflictingAttributes", "PropertyWithConflictingAttributes.get",
- ProducedBy = Tool.Trimmer)]
+ ProducedBy = Tool.Trimmer | Tool.NativeAot)]
[return: DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.NonPublicConstructors)]
get { return PropertyWithConflictingAttributes_Field; }
// On property/accessor mismatch, ILLink warns on accessor and analyzer warns on property https://github.com/dotnet/linker/issues/2654
[ExpectedWarning ("IL2043", "PropertyWithConflictingAttributes", "PropertyWithConflictingAttributes.set",
- ProducedBy = Tool.Trimmer)]
+ ProducedBy = Tool.Trimmer | Tool.NativeAot)]
[param: DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.NonPublicConstructors)]
set { PropertyWithConflictingAttributes_Field = value; }
}
}
// Trimmer and analyzer handle formatting of indexers differently.
- [ExpectedWarning ("IL2067", nameof (PropertyWithIndexer) + ".Item.set", ProducedBy = Tool.Trimmer)]
+ [ExpectedWarning ("IL2067", nameof (PropertyWithIndexer) + ".Item.set", ProducedBy = Tool.Trimmer | Tool.NativeAot)]
[ExpectedWarning ("IL2067", nameof (PropertyWithIndexer) + ".this[Int32].set", ProducedBy = Tool.Analyzer)]
[ExpectedWarning ("IL2072", nameof (DataFlowTypeExtensions) + "." + nameof (DataFlowTypeExtensions.RequiresNonPublicConstructors) + "(Type)")]
[LogDoesNotContain ("'Value passed to parameter 'index' of method 'Mono.Linker.Tests.Cases.DataFlow.PropertyDataFlow.TestAutomaticPropagationType.PropertyWithIndexer.Item.set'")]
[DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicConstructors)]
public Type this[int index] {
// Trimmer and analyzer handle formatting of indexers differently.
- [ExpectedWarning ("IL2063", nameof (PropertyWithIndexer) + ".Item.get", ProducedBy = Tool.Trimmer)]
+ [ExpectedWarning ("IL2063", nameof (PropertyWithIndexer) + ".Item.get", ProducedBy = Tool.Trimmer | Tool.NativeAot)]
[ExpectedWarning ("IL2063", nameof (PropertyWithIndexer) + ".this[Int32].get", ProducedBy = Tool.Analyzer)]
get => Property_Field[index];
set => Property_Field[index] = value;
// Analyzer doesn't warn about compiler-generated backing field of property: https://github.com/dotnet/linker/issues/2731
[ExpectedWarning ("IL2074", nameof (WriteToGetOnlyProperty), nameof (GetUnknownType),
- ProducedBy = Tool.Trimmer)]
+ ProducedBy = Tool.Trimmer | Tool.NativeAot)]
public WriteToGetOnlyProperty ()
{
GetOnlyProperty = GetUnknownType ();
// Analyzer doesn't warn about compiler-generated backing field of property: https://github.com/dotnet/linker/issues/2731
[ExpectedWarning ("IL2074", nameof (WriteCapturedGetOnlyProperty), nameof (GetUnknownType),
- ProducedBy = Tool.Trimmer)]
+ ProducedBy = Tool.Trimmer | Tool.NativeAot)]
[ExpectedWarning ("IL2074", nameof (WriteCapturedGetOnlyProperty), nameof (GetTypeWithPublicConstructors),
- ProducedBy = Tool.Trimmer)]
+ ProducedBy = Tool.Trimmer | Tool.NativeAot)]
public WriteCapturedGetOnlyProperty ()
{
GetOnlyProperty = GetUnknownType () ?? GetTypeWithPublicConstructors ();
}
[ExpectedWarning ("IL2072", "this[Index].get", nameof (DataFlowTypeExtensions.RequiresAll), ProducedBy = Tool.Analyzer)]
- [ExpectedWarning ("IL2072", "Item.get", nameof (DataFlowTypeExtensions.RequiresAll), ProducedBy = Tool.Trimmer)]
+ [ExpectedWarning ("IL2072", "Item.get", nameof (DataFlowTypeExtensions.RequiresAll), ProducedBy = Tool.Trimmer | Tool.NativeAot)]
static void TestRead (ExplicitIndexerAccess instance = null)
{
instance[new Index (1)].RequiresAll ();
}
[ExpectedWarning ("IL2072", nameof (GetTypeWithPublicConstructors), "this[Index].set", ProducedBy = Tool.Analyzer)]
- [ExpectedWarning ("IL2072", nameof (GetTypeWithPublicConstructors), "Item.set", ProducedBy = Tool.Trimmer)]
+ [ExpectedWarning ("IL2072", nameof (GetTypeWithPublicConstructors), "Item.set", ProducedBy = Tool.Trimmer | Tool.NativeAot)]
static void TestWrite (ExplicitIndexerAccess instance = null)
{
instance[^1] = GetTypeWithPublicConstructors ();
int Length => throw new NotImplementedException ();
[ExpectedWarning ("IL2072", "this[Int32].get", nameof (DataFlowTypeExtensions.RequiresAll), ProducedBy = Tool.Analyzer)]
- [ExpectedWarning ("IL2072", "Item.get", nameof (DataFlowTypeExtensions.RequiresAll), ProducedBy = Tool.Trimmer)]
+ [ExpectedWarning ("IL2072", "Item.get", nameof (DataFlowTypeExtensions.RequiresAll), ProducedBy = Tool.Trimmer | Tool.NativeAot)]
static void TestRead (ImplicitIndexerAccess instance = null)
{
instance[new Index (1)].RequiresAll ();
}
[ExpectedWarning ("IL2072", nameof (GetTypeWithPublicConstructors), "this[Int32].set", ProducedBy = Tool.Analyzer)]
- [ExpectedWarning ("IL2072", nameof (GetTypeWithPublicConstructors), "Item.set", ProducedBy = Tool.Trimmer)]
+ [ExpectedWarning ("IL2072", nameof (GetTypeWithPublicConstructors), "Item.set", ProducedBy = Tool.Trimmer | Tool.NativeAot)]
static void TestWrite (ImplicitIndexerAccess instance = null)
{
instance[^1] = GetTypeWithPublicConstructors ();
}
[ExpectedWarning ("IL2072", nameof (GetUnknownType), "this[Int32].set", ProducedBy = Tool.Analyzer)]
- [ExpectedWarning ("IL2072", nameof (GetUnknownType), "Item.set", ProducedBy = Tool.Trimmer)]
+ [ExpectedWarning ("IL2072", nameof (GetUnknownType), "Item.set", ProducedBy = Tool.Trimmer | Tool.NativeAot)]
static void TestNullCoalescingAssignment (ImplicitIndexerAccess instance = null)
{
instance[new Index (1)] ??= GetUnknownType ();
}
[ExpectedWarning ("IL2067", "this[Type].get", nameof (ParamDoesNotMeetRequirements), ProducedBy = Tool.Analyzer)]
- [ExpectedWarning ("IL2067", "Item.get", nameof (ParamDoesNotMeetRequirements), ProducedBy = Tool.Trimmer)]
+ [ExpectedWarning ("IL2067", "Item.get", nameof (ParamDoesNotMeetRequirements), ProducedBy = Tool.Trimmer | Tool.NativeAot)]
static void ParamDoesNotMeetRequirements (Type t)
{
var x = new IndexWithTypeWithDam ();
}
[ExpectedWarning ("IL2087", "this[Type].get", nameof (TypeParamDoesNotMeetRequirements), ProducedBy = Tool.Analyzer)]
- [ExpectedWarning ("IL2087", "Item.get", nameof (TypeParamDoesNotMeetRequirements), ProducedBy = Tool.Trimmer)]
+ [ExpectedWarning ("IL2087", "Item.get", nameof (TypeParamDoesNotMeetRequirements), ProducedBy = Tool.Trimmer | Tool.NativeAot)]
static void TypeParamDoesNotMeetRequirements<T> ()
{
var x = new IndexWithTypeWithDam ();
static Type fieldWithMethods;
[ExpectedWarning ("IL2067", "this[Type].get", nameof (ParamDoesNotMeetRequirements), ProducedBy = Tool.Analyzer)]
- [ExpectedWarning ("IL2067", "Item.get", nameof (ParamDoesNotMeetRequirements), ProducedBy = Tool.Trimmer)]
+ [ExpectedWarning ("IL2067", "Item.get", nameof (ParamDoesNotMeetRequirements), ProducedBy = Tool.Trimmer | Tool.NativeAot)]
static void ParamDoesNotMeetRequirements (Type t)
{
var x = new IndexWithTypeWithDam ();
}
[ExpectedWarning ("IL2087", "this[Type].get", nameof (TypeParamDoesNotMeetRequirements), ProducedBy = Tool.Analyzer)]
- [ExpectedWarning ("IL2087", "Item.get", nameof (TypeParamDoesNotMeetRequirements), ProducedBy = Tool.Trimmer)]
+ [ExpectedWarning ("IL2087", "Item.get", nameof (TypeParamDoesNotMeetRequirements), ProducedBy = Tool.Trimmer | Tool.NativeAot)]
static void TypeParamDoesNotMeetRequirements<T> ()
{
var x = new IndexWithTypeWithDam ();
}
[ExpectedWarning ("IL2067", "this[Type].set", nameof (t), "idx", ProducedBy = Tool.Analyzer)]
- [ExpectedWarning ("IL2067", "Item.set", nameof (t), "idx", ProducedBy = Tool.Trimmer)]
+ [ExpectedWarning ("IL2067", "Item.set", nameof (t), "idx", ProducedBy = Tool.Trimmer | Tool.NativeAot)]
static void ValueMeetsRequirementsIndexDoesNot (Type t)
{
var x = new IndexWithTypeWithDam ();
}
[ExpectedWarning ("IL2067", "this[Type].set", nameof (tUnannotated), "value", ProducedBy = Tool.Analyzer)]
- [ExpectedWarning ("IL2067", "Item.set", nameof (tUnannotated), "value", ProducedBy = Tool.Trimmer)]
+ [ExpectedWarning ("IL2067", "Item.set", nameof (tUnannotated), "value", ProducedBy = Tool.Trimmer | Tool.NativeAot)]
static void ValueDoesNotMeetRequirementsIndexDoes ([DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicFields)] Type t, Type tUnannotated)
{
var x = new IndexWithTypeWithDam ();
namespace Mono.Linker.Tests.Cases.DataFlow
{
- [IgnoreTestCase ("Ignore in NativeAOT, see https://github.com/dotnet/runtime/issues/82447", IgnoredBy = Tool.NativeAot)]
[SkipKeptItemsValidation]
[ExpectedNoWarnings]
class RefFieldDataFlow
{
[Kept]
- // Bug for the IL2069's here: https://github.com/dotnet/linker/issues/2874
- [ExpectedWarning ("IL2069", ProducedBy = Tool.Trimmer)]
- [ExpectedWarning ("IL2069", ProducedBy = Tool.Trimmer)]
- [ExpectedWarning ("IL2069", ProducedBy = Tool.Trimmer)]
- [ExpectedWarning ("IL2069", ProducedBy = Tool.Trimmer)]
+ // Bug for the IL2069's here: https://github.com/dotnet/runtime/issues/85464
+ [ExpectedWarning ("IL2069", ProducedBy = Tool.Trimmer | Tool.NativeAot)]
+ [ExpectedWarning ("IL2069", ProducedBy = Tool.Trimmer | Tool.NativeAot)]
+ [ExpectedWarning ("IL2069", ProducedBy = Tool.Trimmer | Tool.NativeAot)]
+ [ExpectedWarning ("IL2069", ProducedBy = Tool.Trimmer | Tool.NativeAot)]
public static void Main ()
{
RefFieldWithMethods withMethods = new (ref fieldWithMethods);
tmf = typeof (TF); // This is a hole that doesn't warn but assigns a misannotated value to target.T
}
- [ExpectedWarning ("IL2089", "RefFieldWithMethods", "T", ProducedBy = Tool.Trimmer)]
- [ExpectedWarning ("IL2089", "RefFieldWithFields", "T", ProducedBy = Tool.Trimmer)]
- [ExpectedWarning ("IL2089", "RefFieldWithMethodsAndFields", "T", ProducedBy = Tool.Trimmer)]
- [ExpectedWarning ("IL2089", "RefFieldWithMethodsAndFields", "T", ProducedBy = Tool.Trimmer)]
- [ExpectedWarning ("IL2089", "RefFieldWithFields", "T", ProducedBy = Tool.Trimmer)]
+ [ExpectedWarning ("IL2089", "RefFieldWithMethods", "T", ProducedBy = Tool.Trimmer | Tool.NativeAot)]
+ [ExpectedWarning ("IL2089", "RefFieldWithFields", "T", ProducedBy = Tool.Trimmer | Tool.NativeAot)]
+ [ExpectedWarning ("IL2089", "RefFieldWithMethodsAndFields", "T", ProducedBy = Tool.Trimmer | Tool.NativeAot)]
+ [ExpectedWarning ("IL2089", "RefFieldWithMethodsAndFields", "T", ProducedBy = Tool.Trimmer | Tool.NativeAot)]
+ [ExpectedWarning ("IL2089", "RefFieldWithFields", "T", ProducedBy = Tool.Trimmer | Tool.NativeAot)]
static void AssignRefLocals<
T,
[DAM (DAMT.PublicMethods)] TM,
[ExpectedWarning ("IL2069", "RefFieldWithMethods.T", "paramWithFields")]
[ExpectedWarning ("IL2077", "paramWithMethodsAndFields", "RefFieldWithMethods.T")]
// ILLink doesn't recognize ldind.ref
- // https://github.com/dotnet/linker/issues/2943
+ // https://github.com/dotnet/runtime/issues/85465
// IL2064's are bugs - shouldn't be unknown values
- [ExpectedWarning ("IL2064", ProducedBy = Tool.Trimmer)]
- [ExpectedWarning ("IL2064", ProducedBy = Tool.Trimmer)]
- [ExpectedWarning ("IL2064", ProducedBy = Tool.Trimmer)]
- [ExpectedWarning ("IL2064", ProducedBy = Tool.Trimmer)]
- [ExpectedWarning ("IL2064", ProducedBy = Tool.Trimmer)]
+ [ExpectedWarning ("IL2064", ProducedBy = Tool.Trimmer | Tool.NativeAot)]
+ [ExpectedWarning ("IL2064", ProducedBy = Tool.Trimmer | Tool.NativeAot)]
+ [ExpectedWarning ("IL2064", ProducedBy = Tool.Trimmer | Tool.NativeAot)]
+ [ExpectedWarning ("IL2064", ProducedBy = Tool.Trimmer | Tool.NativeAot)]
+ [ExpectedWarning ("IL2064", ProducedBy = Tool.Trimmer | Tool.NativeAot)]
[ExpectedWarning ("IL2069", "RefFieldWithMethods.T", "param", ProducedBy = Tool.Analyzer)]
[ExpectedWarning ("IL2069", "RefFieldWithMethods.T", "paramWithFields", ProducedBy = Tool.Analyzer)]
static void AssignRefParameters<
[ExpectedWarning ("IL2079", "RefFieldWithMethods.T", "RefFieldUnannotated.T", ProducedBy = Tool.Analyzer)]
[ExpectedWarning ("IL2079", "RefFieldWithMethods.T", "RefFieldWithFields.T", ProducedBy = Tool.Analyzer)]
// IL2064's are bugs - shouldn't be unknown values
- // https://github.com/dotnet/linker/issues/2943
- [ExpectedWarning ("IL2064", "RefFieldWithMethods.T", ProducedBy = Tool.Trimmer)] // target.T = unannotated.T;
- [ExpectedWarning ("IL2064", "RefFieldWithMethods.T", ProducedBy = Tool.Trimmer)] // target.T = withMethods.T;
- [ExpectedWarning ("IL2064", "RefFieldWithMethods.T", ProducedBy = Tool.Trimmer)] // target.T = withFields.T;
- [ExpectedWarning ("IL2064", "RefFieldWithMethods.T", ProducedBy = Tool.Trimmer)] // target.T = withMethodsAndFields.T;
- [ExpectedWarning ("IL2064", "RefFieldWithMethods.T", ProducedBy = Tool.Trimmer)] // target.T = withMethodsAndFields.T;
+ // https://github.com/dotnet/runtime/issues/85465
+ [ExpectedWarning ("IL2064", "RefFieldWithMethods.T", ProducedBy = Tool.Trimmer | Tool.NativeAot)] // target.T = unannotated.T;
+ [ExpectedWarning ("IL2064", "RefFieldWithMethods.T", ProducedBy = Tool.Trimmer | Tool.NativeAot)] // target.T = withMethods.T;
+ [ExpectedWarning ("IL2064", "RefFieldWithMethods.T", ProducedBy = Tool.Trimmer | Tool.NativeAot)] // target.T = withFields.T;
+ [ExpectedWarning ("IL2064", "RefFieldWithMethods.T", ProducedBy = Tool.Trimmer | Tool.NativeAot)] // target.T = withMethodsAndFields.T;
+ [ExpectedWarning ("IL2064", "RefFieldWithMethods.T", ProducedBy = Tool.Trimmer | Tool.NativeAot)] // target.T = withMethodsAndFields.T;
static void AssignRefFields (
RefFieldWithMethods target,
RefFieldUnannotated unannotated,
[ExpectedWarning ("IL2074", "RefFieldWithMethods.T", "GetRefUnannotated", ProducedBy = Tool.Analyzer)]
[ExpectedWarning ("IL2074", "RefFieldWithMethods.T", "GetRefWithFields", ProducedBy = Tool.Analyzer)]
// IL2064's are bugs - shouldn't be unknown values
- // https://github.com/dotnet/linker/issues/2943
- [ExpectedWarning ("IL2064", "RefFieldWithMethods.T", ProducedBy = Tool.Trimmer)] // target.T = t;
- [ExpectedWarning ("IL2064", "RefFieldWithMethods.T", ProducedBy = Tool.Trimmer)] // target.T = t;
- [ExpectedWarning ("IL2064", "RefFieldWithMethods.T", ProducedBy = Tool.Trimmer)] // target.T = t;
- [ExpectedWarning ("IL2064", "RefFieldWithMethods.T", ProducedBy = Tool.Trimmer)] // target.T = t;
+ // https://github.com/dotnet/runtime/issues/85465
+ [ExpectedWarning ("IL2064", "RefFieldWithMethods.T", ProducedBy = Tool.Trimmer | Tool.NativeAot)] // target.T = t;
+ [ExpectedWarning ("IL2064", "RefFieldWithMethods.T", ProducedBy = Tool.Trimmer | Tool.NativeAot)] // target.T = t;
+ [ExpectedWarning ("IL2064", "RefFieldWithMethods.T", ProducedBy = Tool.Trimmer | Tool.NativeAot)] // target.T = t;
+ [ExpectedWarning ("IL2064", "RefFieldWithMethods.T", ProducedBy = Tool.Trimmer | Tool.NativeAot)] // target.T = t;
static void AssignRefReturns<
T,
[DAM (DAMT.PublicMethods)] TM,
[ExpectedWarning ("IL2074", "RefFieldWithMethods.T", "RefPropWithFields.T")]
// ref Type t = ref x.T; target.T = t;
// IL2064's are bugs - shouldn't be unknown values
- // https://github.com/dotnet/linker/issues/2943
- [ExpectedWarning ("IL2064", "RefFieldWithMethods.T", ProducedBy = Tool.Trimmer)] // target.T = unannotated.T;
- [ExpectedWarning ("IL2064", "RefFieldWithMethods.T", ProducedBy = Tool.Trimmer)] // target.T = withMethods.T;
- [ExpectedWarning ("IL2064", "RefFieldWithMethods.T", ProducedBy = Tool.Trimmer)] // target.T = withFields.T;
- [ExpectedWarning ("IL2064", "RefFieldWithMethods.T", ProducedBy = Tool.Trimmer)] // target.T = withMethodsAndFieldswithMtho.T;
- [ExpectedWarning ("IL2064", "RefFieldWithMethods.T", ProducedBy = Tool.Trimmer)] // target.T = withMethods.T;
- [ExpectedWarning ("IL2064", "RefFieldWithMethods.T", ProducedBy = Tool.Trimmer)] // target.T = t;
- [ExpectedWarning ("IL2064", "RefFieldWithMethods.T", ProducedBy = Tool.Trimmer)] // target.T = t;
- [ExpectedWarning ("IL2064", "RefFieldWithMethods.T", ProducedBy = Tool.Trimmer)] // target.T = t;
- [ExpectedWarning ("IL2064", "RefFieldWithMethods.T", ProducedBy = Tool.Trimmer)] // target.T = t;
+ // https://github.com/dotnet/runtime/issues/85465
+ [ExpectedWarning ("IL2064", "RefFieldWithMethods.T", ProducedBy = Tool.Trimmer | Tool.NativeAot)] // target.T = unannotated.T;
+ [ExpectedWarning ("IL2064", "RefFieldWithMethods.T", ProducedBy = Tool.Trimmer | Tool.NativeAot)] // target.T = withMethods.T;
+ [ExpectedWarning ("IL2064", "RefFieldWithMethods.T", ProducedBy = Tool.Trimmer | Tool.NativeAot)] // target.T = withFields.T;
+ [ExpectedWarning ("IL2064", "RefFieldWithMethods.T", ProducedBy = Tool.Trimmer | Tool.NativeAot)] // target.T = withMethodsAndFieldswithMtho.T;
+ [ExpectedWarning ("IL2064", "RefFieldWithMethods.T", ProducedBy = Tool.Trimmer | Tool.NativeAot)] // target.T = withMethods.T;
+ [ExpectedWarning ("IL2064", "RefFieldWithMethods.T", ProducedBy = Tool.Trimmer | Tool.NativeAot)] // target.T = t;
+ [ExpectedWarning ("IL2064", "RefFieldWithMethods.T", ProducedBy = Tool.Trimmer | Tool.NativeAot)] // target.T = t;
+ [ExpectedWarning ("IL2064", "RefFieldWithMethods.T", ProducedBy = Tool.Trimmer | Tool.NativeAot)] // target.T = t;
+ [ExpectedWarning ("IL2064", "RefFieldWithMethods.T", ProducedBy = Tool.Trimmer | Tool.NativeAot)] // target.T = t;
static void AssignRefProperties (RefFieldWithMethods target,
RefPropUnannotated unannotated = null,
RefPropWithMethods withMethods = null,
namespace Mono.Linker.Tests.Cases.DataFlow
{
- [IgnoreTestCase ("Ignore in NativeAOT, see https://github.com/dotnet/runtime/issues/82447", IgnoredBy = Tool.NativeAot)]
- [KeptAttributeAttribute (typeof (IgnoreTestCaseAttribute), By = Tool.Trimmer)]
+ [ExpectedNoWarnings]
public class StaticInterfaceMethodDataflow
{
[Kept]
namespace Mono.Linker.Tests.Cases.DataFlow
{
- [IgnoreTestCase ("Ignore in NativeAOT, see https://github.com/dotnet/runtime/issues/82447", IgnoredBy = Tool.NativeAot)]
// Note: this test's goal is to validate that the product correctly reports unrecognized patterns
// - so the main validation is done by the ExpectedWarning attributes.
[SkipKeptItemsValidation]
[KeptMember (".ctor()")]
private abstract class AbstractMethods
{
- [Kept (By = Tool.Trimmer)] // NativeAOT test infra doesn't check reflection-only methods (without entry point) yet
+ [Kept]
[DynamicDependency (nameof (TargetMethod))]
public abstract void SourceAbstractViaReflection ();
namespace Mono.Linker.Tests.Cases.Warnings.WarningSuppression
{
+ // https://github.com/dotnet/runtime/issues/82447
+ [IgnoreTestCase ("NativeAOT doesn't support suppressing warnings via XML", IgnoredBy = Tool.NativeAot)]
+ [KeptAttributeAttribute(typeof(IgnoreTestCaseAttribute))]
[TestCaseRequirements (TestRunCharacteristics.TargetingNetCore, "This test is specific to .NET Core")]
// For netcoreapp we don't have to specify the assembly for the attribute, since the attribute comes from corelib
// and will be found always.