dotnet / dotnet/macios

ILC warnings for NUnit

Open
#19,911 0 comments 0 reactions 0 assignees View on GitHub
nativeaot tests
Dominant language
C#
Stars
2.9k
Forks
576
Avg merge
2d 13h
Merged PRs (30d)
96

Description

There are numerous ILC trimmer warnings with NUnit.

Potential solutions:

* Upgrade to a newer version of NUnit (and potentially fix any issues).
* Switch to a different test framework. MSTest might be an option:
* https://devblogs.microsoft.com/dotnet/introducing-ms-test-runner/
* https://github.com/microsoft/testfx/issues/1837

Example list for compiling monotouch-test for Mac Catalyst with NativeAOT:

```
ILC : AOT analysis error IL3050: NUnit.Framework.Constraints.EqualConstraint.AdjustArgumentIfNeeded(!!0&): Using member 'System.Array.CreateInstance(Type,Int32)' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling. The code for an array of the specified type might not be available.
ILC : AOT analysis error IL3050: NUnit.Framework.Internal.MethodWrapper.MakeGenericMethod(Type[]): Using member 'System.Reflection.MethodInfo.MakeGenericMethod(Type[])' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling. The native code for this instantiation might not be available at runtime.
ILC : AOT analysis error IL3050: NUnit.Framework.Internal.TaskAwaitAdapter.Create(Task): Using member 'System.Type.MakeGenericType(Type[])' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling. The native code for this instantiation might not be available at runtime.
ILC : AOT analysis error IL3050: NUnit.Framework.Internal.TaskAwaitAdapter.Create(Task): Using member 'System.Type.MakeGenericType(Type[])' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling. The native code for this instantiation might not be available at runtime.
ILC : AOT analysis error IL3050: NUnit.Framework.Internal.TypeWrapper.MakeGenericType(Type[]): Using member 'System.Type.MakeGenericType(Type[])' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling. The native code for this instantiation might not be available at runtime.
ILC : AOT analysis error IL3050: NUnit.Framework.TestCaseAttribute.GetParametersForTestCase(IMethodInfo): Using member 'System.Array.CreateInstance(Type,Int32)' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling. The code for an array of the specified type might not be available.
ILC : AOT analysis error IL3050: NUnit.Framework.TestCaseAttribute.GetParametersForTestCase(IMethodInfo): Using member 'System.Array.CreateInstance(Type,Int32)' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling. The code for an array of the specified type might not be available.
ILC : Trim analysis error IL2026: NUnit.Framework.Api.DefaultTestAssemblyBuilder.GetCandidateFixtureTypes(Assembly): Using member 'System.Reflection.Assembly.GetTypes()' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. Types might be removed.
ILC : Trim analysis error IL2026: NUnit.Framework.Internal.AssemblyHelper.ReflectionAssemblyLoader.TryInitialize(): Using member 'System.Runtime.Loader.AssemblyLoadContext.LoadFromAssemblyPath(String)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. Types and members the loaded assembly depends on might be removed.
ILC : Trim analysis error IL2026: NUnit.Framework.Internal.ParamAttributeTypeConversions.TryConvert(Object,Type,Object&): Using member 'System.ComponentModel.TypeDescriptor.GetConverter(Type)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. Generic TypeConverters may require the generic types to be annotated. For example, NullableConverter requires the underlying type to be DynamicallyAccessedMembers All.
ILC : Trim analysis error IL2055: NUnit.Framework.Internal.TypeWrapper.MakeGenericType(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.
ILC : Trim analysis error IL2060: NUnit.Framework.Internal.MethodWrapper.MakeGenericMethod(Type[]): Call to 'System.Reflection.MethodInfo.MakeGenericMethod(Type[])' can not be statically analyzed. It's not possible to guarantee the availability of requirements of the generic method.
ILC : Trim analysis error IL2065: NUnit.Framework.Constraints.Comparers.EquatablesComparer.GetEquatableGenericArguments(Type): Value passed to implicit 'this' parameter of method 'System.Type.GetMethod(String)' can not be statically determined and may not meet 'DynamicallyAccessedMembersAttribute' requirements.
ILC : Trim analysis error IL2067: NUnit.Framework.Internal.ParamAttributeTypeConversions.TryConvert(Object,Type,Object&): '' argument does not satisfy 'DynamicallyAccessedMemberTypes.All' in call to 'System.ComponentModel.TypeDescriptor.GetConverter(Type)'. The parameter '#1' of method 'NUnit.Framework.Internal.ParamAttributeTypeConversions.TryConvert(Object,Type,Object&)' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to.
ILC : Trim analysis error IL2070: NUnit.Framework.Constraints.Comparers.EquatablesComparer.GetEquatableGenericArguments(Type): 'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.Interfaces' in call to 'System.Type.GetInterfaces()'. The parameter '#0' of method 'NUnit.Framework.Constraints.Comparers.EquatablesComparer.GetEquatableGenericArguments(Type)' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to.
ILC : Trim analysis error IL2070: NUnit.Framework.Constraints.Comparers.TupleComparer.GetValue(Type,String,Object): 'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicProperties' in call to 'System.Type.GetProperty(String)'. The parameter '#0' of method 'NUnit.Framework.Constraints.Comparers.TupleComparer.GetValue(Type,String,Object)' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to.
ILC : Trim analysis error IL2070: NUnit.Framework.Constraints.Comparers.ValueTupleComparer.GetValue(Type,String,Object): 'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicFields' in call to 'System.Type.GetField(String)'. The parameter '#0' of method 'NUnit.Framework.Constraints.Comparers.ValueTupleComparer.GetValue(Type,String,Object)' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to.
ILC : Trim analysis error IL2070: NUnit.Framework.Constraints.MsgUtils.GetValueFromTuple(Type,String,Object): 'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicProperties' in call to 'System.Type.GetProperty(String)'. The parameter 'type' of method 'NUnit.Framework.Constraints.MsgUtils.GetValueFromTuple(Type,String,Object)' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to.
ILC : Trim analysis error IL2070: NUnit.Framework.Constraints.MsgUtils.GetValueFromValueTuple(Type,String,Object): 'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicFields' in call to 'System.Type.GetField(String)'. The parameter 'type' of method 'NUnit.Framework.Constraints.MsgUtils.GetValueFromValueTuple(Type,String,Object)' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to.
ILC : Trim analysis error IL2070: NUnit.Framework.Internal.GenericMethodHelper.IsAssignableToGenericType(Type,Type): 'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.Interfaces' in call to 'System.Type.GetInterfaces()'. The parameter '#0' of method 'NUnit.Framework.Internal.GenericMethodHelper.IsAssignableToGenericType(Type,Type)' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to.
ILC : Trim analysis error IL2070: NUnit.Framework.Internal.Reflect.CanImplicitlyConvertTo(Type,Type): 'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicMethods' in call to 'System.Type.GetMethods(BindingFlags)'. The parameter '#0' of method 'NUnit.Framework.Internal.Reflect.CanImplicitlyConvertTo(Type,Type)' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to.
ILC : Trim analysis error IL2070: NUnit.Framework.Internal.Reflect.Construct(Type): 'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicConstructors' in call to 'System.Type.GetConstructor(Type[])'. The parameter '#0' of method 'NUnit.Framework.Internal.Reflect.Construct(Type)' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to.
ILC : Trim analysis error IL2070: NUnit.Framework.Internal.Reflect.GetConstructors(Type,Type[]): 'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicConstructors' in call to 'System.Type.GetConstructors()'. The parameter '#0' of method 'NUnit.Framework.Internal.Reflect.GetConstructors(Type,Type[])' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to.
ILC : Trim analysis error IL2070: NUnit.Framework.Internal.Reflect.GetMethodsWithAttribute(Type,Type,Boolean): 'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicMethods', 'DynamicallyAccessedMemberTypes.NonPublicMethods' in call to 'System.Type.GetMethods(BindingFlags)'. The parameter '#0' of method 'NUnit.Framework.Internal.Reflect.GetMethodsWithAttribute(Type,Type,Boolean)' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to.
ILC : Trim analysis error IL2070: NUnit.Framework.Internal.Reflect.GetPublicInstanceProperty(Type,String,Type[]): 'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicProperties' in call to 'System.Type.GetProperties(BindingFlags)'. The parameter '#0' of method 'NUnit.Framework.Internal.Reflect.GetPublicInstanceProperty(Type,String,Type[])' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to.
ILC : Trim analysis error IL2070: NUnit.Framework.Internal.Reflect.HasMethodWithAttribute(Type,Type): 'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicMethods', 'DynamicallyAccessedMemberTypes.NonPublicMethods' in call to 'System.Type.GetMethods(BindingFlags)'. The parameter '#0' of method 'NUnit.Framework.Internal.Reflect.HasMethodWithAttribute(Type,Type)' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to.
ILC : Trim analysis error IL2070: NUnit.Framework.Internal.TypeHelper.CanDeduceTypeArgsFromArgs(Type,Object[],Type[]&): 'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicConstructors' in call to 'System.Type.GetConstructors()'. The parameter '#0' of method 'NUnit.Framework.Internal.TypeHelper.CanDeduceTypeArgsFromArgs(Type,Object[],Type[]&)' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to.
ILC : Trim analysis error IL2070: NUnit.Framework.Internal.TypeHelper.GetDeclaredInterfaces(Type): 'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.Interfaces' in call to 'System.Type.GetInterfaces()'. The parameter '#0' of method 'NUnit.Framework.Internal.TypeHelper.GetDeclaredInterfaces(Type)' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to.
ILC : Trim analysis error IL2075: NUnit.Framework.Constraints.Comparers.KeyValuePairsComparer.Equal(Object,Object,Tolerance&,Boolean): 'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicProperties' in call to 'System.Type.GetProperty(String)'. The return value of method 'System.Object.GetType()' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to.
ILC : Trim analysis error IL2075: NUnit.Framework.Constraints.Comparers.KeyValuePairsComparer.Equal(Object,Object,Tolerance&,Boolean): 'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicProperties' in call to 'System.Type.GetProperty(String)'. The return value of method 'System.Object.GetType()' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to.
ILC : Trim analysis error IL2075: NUnit.Framework.Constraints.Comparers.KeyValuePairsComparer.Equal(Object,Object,Tolerance&,Boolean): 'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicProperties' in call to 'System.Type.GetProperty(String)'. The return value of method 'System.Object.GetType()' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to.
ILC : Trim analysis error IL2075: NUnit.Framework.Constraints.Comparers.KeyValuePairsComparer.Equal(Object,Object,Tolerance&,Boolean): 'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicProperties' in call to 'System.Type.GetProperty(String)'. The return value of method 'System.Object.GetType()' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to.
ILC : Trim analysis error IL2075: NUnit.Framework.Constraints.EqualConstraint.AdjustArgumentIfNeeded(!!0&): 'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicConstructors' in call to 'System.Type.GetConstructor(Type[])'. The return value of method 'System.Object.GetType()' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to.
ILC : Trim analysis error IL2075: NUnit.Framework.Constraints.EqualConstraint.AdjustArgumentIfNeeded(!!0&): 'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicProperties' in call to 'System.Type.GetProperty(String)'. The return value of method 'System.Object.GetType()' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to.
ILC : Trim analysis error IL2075: NUnit.Framework.Constraints.MsgUtils.TryFormatKeyValuePair(Object): 'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicProperties' in call to 'System.Type.GetProperty(String)'. The return value of method 'System.Object.GetType()' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to.
ILC : Trim analysis error IL2075: NUnit.Framework.Constraints.MsgUtils.TryFormatKeyValuePair(Object): 'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicProperties' in call to 'System.Type.GetProperty(String)'. The return value of method 'System.Object.GetType()' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to.
ILC : Trim analysis error IL2075: NUnit.Framework.Constraints.NUnitComparer.Compare(Object,Object): 'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicMethods' in call to 'System.Type.GetMethod(String,Type[])'. The return value of method 'System.Object.GetType()' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to.
ILC : Trim analysis error IL2075: NUnit.Framework.Constraints.NUnitComparer.Compare(Object,Object): 'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicMethods' in call to 'System.Type.GetMethod(String,Type[])'. The return value of method 'System.Object.GetType()' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to.
ILC : Trim analysis error IL2075: NUnit.Framework.Internal.CSharpPatternBasedAwaitAdapter.AwaitShapeInfo.TryCreate(Type): 'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.Interfaces' in call to 'System.Type.GetInterface(String)'. The return value of method 'System.Reflection.MethodInfo.ReturnType.get' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to.
ILC : Trim analysis error IL2075: NUnit.Framework.Internal.CSharpPatternBasedAwaitAdapter.AwaitShapeInfo.TryCreate(Type): 'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.Interfaces' in call to 'System.Type.GetInterface(String)'. The return value of method 'System.Reflection.MethodInfo.ReturnType.get' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to.
ILC : Trim analysis error IL2075: NUnit.Framework.Internal.Reflect.GetNonGenericPublicInstanceMethod(Type,String,Type[]): 'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicMethods' in call to 'System.Type.GetMethods(BindingFlags)'. The return value of method 'System.Collections.Generic.IEnumerator`1.Current.get' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to.
ILC : Trim analysis error IL2075: NUnit.Framework.Internal.TestExecutionContext.AdhocContext.AdhocContext(): 'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.NonPublicMethods' in call to 'System.Type.GetMethod(String,BindingFlags)'. The return value of method 'System.Object.GetType()' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to.
ILC : Trim analysis error IL2075: NUnit.Framework.Internal.TypeHelper.GetDeclaredInterfaces(Type): 'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.Interfaces' in call to 'System.Type.GetInterfaces()'. The return value of method 'System.Type.BaseType.get' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to.
ILC : Trim analysis error IL2075: NUnit.Framework.Internal.TypeWrapper.GetMethods(BindingFlags): 'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicMethods', 'DynamicallyAccessedMemberTypes.NonPublicMethods' in call to 'System.Type.GetMethods(BindingFlags)'. The return value of method 'NUnit.Framework.Internal.TypeWrapper.Type.get' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to.
ILC : Trim analysis error IL2075: NUnit.Framework.TestCaseSourceAttribute.GetTestCaseSource(IMethodInfo): 'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicConstructors', 'DynamicallyAccessedMemberTypes.NonPublicConstructors', 'DynamicallyAccessedMemberTypes.PublicMethods', 'DynamicallyAccessedMemberTypes.NonPublicMethods', 'DynamicallyAccessedMemberTypes.PublicFields', 'DynamicallyAccessedMemberTypes.NonPublicFields', 'DynamicallyAccessedMemberTypes.PublicNestedTypes', 'DynamicallyAccessedMemberTypes.NonPublicNestedTypes', 'DynamicallyAccessedMemberTypes.PublicProperties', 'DynamicallyAccessedMemberTypes.NonPublicProperties', 'DynamicallyAccessedMemberTypes.PublicEvents', 'DynamicallyAccessedMemberTypes.NonPublicEvents' in call to 'System.Type.GetMember(String,BindingFlags)'. The return value of method 'NUnit.Framework.Interfaces.ITypeInfo.Type.get' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to.
ILC : Trim analysis error IL2075: NUnit.Framework.TestCaseSourceAttribute.GetTestCaseSource(IMethodInfo): 'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicConstructors', 'DynamicallyAccessedMemberTypes.NonPublicConstructors', 'DynamicallyAccessedMemberTypes.PublicMethods', 'DynamicallyAccessedMemberTypes.NonPublicMethods', 'DynamicallyAccessedMemberTypes.PublicFields', 'DynamicallyAccessedMemberTypes.NonPublicFields', 'DynamicallyAccessedMemberTypes.PublicNestedTypes', 'DynamicallyAccessedMemberTypes.NonPublicNestedTypes', 'DynamicallyAccessedMemberTypes.PublicProperties', 'DynamicallyAccessedMemberTypes.NonPublicProperties', 'DynamicallyAccessedMemberTypes.PublicEvents', 'DynamicallyAccessedMemberTypes.NonPublicEvents' in call to 'System.Type.GetMember(String,BindingFlags)'. The return value of method 'NUnit.Framework.TestCaseSourceAttribute.SourceType.get' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to.
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.