dotnet / dotNext

Next generation API for .NET
https://dotnet.github.io/dotNext/
MIT License
1.64k stars 123 forks source link

Add IL trimming support for DotNext.Metaprogramming #218

Closed sakno closed 9 months ago

sakno commented 9 months ago

Addresses #217

Scope of work:

alexrp commented 9 months ago

What do you think about adding an empty console app project to the solution that just serves the purpose of testing for trimming errors in all the DotNext.* assemblies? Something like what I do here, based on the official recommendations. It just makes it a bit easier to do in-repo testing of trimming behavior, since the Roslyn analyzer doesn't necessarily catch everything.

sakno commented 9 months ago

Sounds reasonable.

alexrp commented 9 months ago

Ok, I pushed the addition of that project to my fork: https://github.com/alexrp/dotNext/commit/af824cea8b7561ffe22950834f7ac012f993ca61

As expected, dotnet publish -p:TrimmerSingleWarn=false in that project uncovered some problems that the Roslyn analyzer didn't catch:

``` ILLink : Trim analysis error IL2026: DotNext: Using member 'DotNext.Dynamic.TaskResultBinder.ResultPropertyName' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. Runtime binding may be incompatible with IL trimming. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] ILLink : Trim analysis error IL2026: DotNext: Using member 'DotNext.Dynamic.TaskResultBinder.ResultPropertyFlags' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. Runtime binding may be incompatible with IL trimming. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /_/src/DotNext/Reflection/EnumType.cs(14,9): Trim analysis error IL2090: DotNext.Reflection.EnumType.GetField(TEnum): 'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicFields' in call to 'System.Type.GetField(String, BindingFlags)'. The generic parameter 'TEnum' of 'DotNext.Reflection.EnumType.GetField(TEnum)' 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. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] ILLink : Trim analysis error IL2026: DotNext.Metaprogramming: Using member 'DotNext.Runtime.CompilerServices.AsyncStateMachineBuilder.ParameterPositionSlot' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. Dynamic access to DotNext.Metaprogramming internal types, Task and ValueTask. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] ILLink : Trim analysis error IL2026: DotNext.Metaprogramming: Using member 'DotNext.Runtime.CompilerServices.ClosureAnalyzer.ClosureVariableSlot' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. Dynamic access to StrongBox type. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] ILLink : Trim analysis error IL2026: DotNext.Metaprogramming: Using member 'DotNext.Linq.Expressions.ForEachExpression.EnumeratorVarName' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. Dynamic access to GetEnumerator method and IEnumerable interfaces. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] ILLink : Trim analysis error IL2026: DotNext.Metaprogramming: Using member 'DotNext.Linq.Expressions.ForEachExpression.BreakLabelName' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. Dynamic access to GetEnumerator method and IEnumerable interfaces. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] ILLink : Trim analysis error IL2026: DotNext.Metaprogramming: Using member 'DotNext.Linq.Expressions.ForEachExpression.ContinueLabelName' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. Dynamic access to GetEnumerator method and IEnumerable interfaces. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /_/src/DotNext.Metaprogramming/Metaprogramming/MatchBuilder.cs(166,17): Trim analysis error IL2026: DotNext.Metaprogramming.MatchBuilder.<>c__DisplayClass16_0.b__0(ParameterExpression): Using member 'System.Linq.Expressions.Expression.PropertyOrField(Expression, String)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. Creating Expressions requires unreferenced code because the members being referenced by the Expression may be trimmed. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /_/src/DotNext.Metaprogramming/Metaprogramming/MatchBuilder.cs(184,88): Trim analysis error IL2026: DotNext.Metaprogramming.MatchBuilder.<>c__DisplayClass18_0.b__0(ParameterExpression): Using member 'System.Linq.Expressions.Expression.PropertyOrField(Expression, String)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. Creating Expressions requires unreferenced code because the members being referenced by the Expression may be trimmed. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /_/src/DotNext.Metaprogramming/Metaprogramming/MatchBuilder.cs(196,105): Trim analysis error IL2026: DotNext.Metaprogramming.MatchBuilder.<>c__DisplayClass19_0.b__0(ParameterExpression): Using member 'System.Linq.Expressions.Expression.PropertyOrField(Expression, String)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. Creating Expressions requires unreferenced code because the members being referenced by the Expression may be trimmed. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /_/src/DotNext.Metaprogramming/Metaprogramming/MatchBuilder.cs(196,105): Trim analysis error IL2026: DotNext.Metaprogramming.MatchBuilder.<>c__DisplayClass19_0.b__0(ParameterExpression): Using member 'System.Linq.Expressions.Expression.PropertyOrField(Expression, String)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. Creating Expressions requires unreferenced code because the members being referenced by the Expression may be trimmed. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /_/src/DotNext.Metaprogramming/Metaprogramming/MatchBuilder.cs(210,134): Trim analysis error IL2026: DotNext.Metaprogramming.MatchBuilder.<>c__DisplayClass20_0.b__0(ParameterExpression): Using member 'System.Linq.Expressions.Expression.PropertyOrField(Expression, String)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. Creating Expressions requires unreferenced code because the members being referenced by the Expression may be trimmed. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /_/src/DotNext.Metaprogramming/Metaprogramming/MatchBuilder.cs(210,134): Trim analysis error IL2026: DotNext.Metaprogramming.MatchBuilder.<>c__DisplayClass20_0.b__0(ParameterExpression): Using member 'System.Linq.Expressions.Expression.PropertyOrField(Expression, String)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. Creating Expressions requires unreferenced code because the members being referenced by the Expression may be trimmed. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /_/src/DotNext.Metaprogramming/Metaprogramming/MatchBuilder.cs(210,134): Trim analysis error IL2026: DotNext.Metaprogramming.MatchBuilder.<>c__DisplayClass20_0.b__0(ParameterExpression): Using member 'System.Linq.Expressions.Expression.PropertyOrField(Expression, String)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. Creating Expressions requires unreferenced code because the members being referenced by the Expression may be trimmed. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /_/src/DotNext.Metaprogramming/Metaprogramming/CodeGenerator.cs(382,51): Trim analysis error IL2026: DotNext.Metaprogramming.CodeGenerator.<>c__DisplayClass42_0.b__0(ParameterExpression): Using member 'DotNext.Linq.Expressions.ExpressionBuilder.Call(Expression, String, Expression[])' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. Dynamic access to the method identified by parameter. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /_/src/DotNext.Metaprogramming/Linq/Expressions/CollectionAccessExpression.cs(87,32): Trim analysis error IL2067: DotNext.Linq.Expressions.CollectionAccessExpression.d__5.MoveNext(): 'type' argument does not satisfy 'DynamicallyAccessedMemberTypes.Interfaces' in call to 'DotNext.Reflection.TypeExtensions.GetBaseTypes(Type, Boolean, Boolean)'. The parameter 'collection' of method 'DotNext.Linq.Expressions.CollectionAccessExpression.GetIndexers(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. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /_/src/DotNext.Metaprogramming/Linq/Expressions/CollectionAccessExpression.cs(92,13): Trim analysis error IL2075: DotNext.Linq.Expressions.CollectionAccessExpression.d__5.MoveNext(): 'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicProperties' in call to 'System.Type.GetProperty(String, BindingFlags)'. The return value of method 'System.Collections.Generic.IEnumerator.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. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /_/src/DotNext.Metaprogramming/Metaprogramming/MatchBuilder.cs(226,34): Trim analysis error IL2075: DotNext.Metaprogramming.MatchBuilder.d__22.MoveNext(): 'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicProperties' in call to 'System.Type.GetProperties(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. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /_/src/DotNext.Metaprogramming/Metaprogramming/MatchBuilder.cs(232,31): Trim analysis error IL2075: DotNext.Metaprogramming.MatchBuilder.d__22.MoveNext(): 'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicFields' in call to 'System.Type.GetFields(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. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /_/src/DotNext.Metaprogramming/Linq/Expressions/SliceExpression.cs(74,32): Trim analysis error IL2067: DotNext.Linq.Expressions.SliceExpression.d__3.MoveNext(): 'type' argument does not satisfy 'DynamicallyAccessedMemberTypes.Interfaces' in call to 'DotNext.Reflection.TypeExtensions.GetBaseTypes(Type, Boolean, Boolean)'. The parameter 'collection' of method 'DotNext.Linq.Expressions.SliceExpression.GetSliceMethods(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. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /_/src/DotNext.Metaprogramming/Linq/Expressions/SliceExpression.cs(76,36): Trim analysis error IL2075: DotNext.Linq.Expressions.SliceExpression.d__3.MoveNext(): 'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.All' in call to 'System.Type.FindMembers(MemberTypes, BindingFlags, MemberFilter, Object)'. The return value of method 'System.Collections.Generic.IEnumerator.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. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /_/src/DotNext.Metaprogramming/Metaprogramming/AsyncLambdaExpression.cs(23,9): Trim analysis error IL2091: DotNext.Metaprogramming.AsyncLambdaExpression.AsyncLambdaExpression`1(Boolean): 'TDelegate' generic argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicMethods' in 'DotNext.Reflection.DelegateType.GetInvokeMethod()'. The generic parameter 'TDelegate' of 'DotNext.Metaprogramming.AsyncLambdaExpression' 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. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /_/src/DotNext.Metaprogramming/Metaprogramming/AsyncLambdaExpression.cs(65,16): Trim analysis error IL2026: DotNext.Metaprogramming.AsyncLambdaExpression.Build(): Using member 'DotNext.Runtime.CompilerServices.AsyncStateMachineBuilder.AsyncStateMachineBuilder`1(IReadOnlyList)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. Dynamic access to Transition and IAsyncStateMachine internal types. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /_/src/DotNext.Metaprogramming/Metaprogramming/AsyncLambdaExpression.cs(65,16): Trim analysis error IL2091: DotNext.Metaprogramming.AsyncLambdaExpression.Build(): 'TDelegate' generic argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicMethods' in 'DotNext.Runtime.CompilerServices.AsyncStateMachineBuilder'. The generic parameter 'TDelegate' of 'DotNext.Metaprogramming.AsyncLambdaExpression' 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. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /_/src/DotNext.Metaprogramming/Metaprogramming/AsyncLambdaExpression.cs(67,13): Trim analysis error IL2091: DotNext.Metaprogramming.AsyncLambdaExpression.Build(): 'TDelegate' generic argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicMethods' in 'DotNext.Runtime.CompilerServices.AsyncStateMachineBuilder'. The generic parameter 'TDelegate' of 'DotNext.Metaprogramming.AsyncLambdaExpression' 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. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /_/src/DotNext.Metaprogramming/Metaprogramming/AsyncLambdaExpression.cs(59,9): Trim analysis error IL2091: DotNext.Metaprogramming.AsyncLambdaExpression.Build(): 'TDelegate' generic argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicMethods' in 'DotNext.Runtime.CompilerServices.AsyncStateMachineBuilder'. The generic parameter 'TDelegate' of 'DotNext.Metaprogramming.AsyncLambdaExpression' 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. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /_/src/DotNext.Metaprogramming/Linq/Expressions/AsyncResultExpression.cs(91,9): Trim analysis error IL2075: DotNext.Linq.Expressions.AsyncResultExpression.Reduce(ParameterExpression, LabelTarget): 'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicProperties' in call to 'System.Type.GetProperty(String)'. The return value of method 'System.Linq.Expressions.Expression.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. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /_/src/DotNext.Metaprogramming/Linq/Expressions/AsyncResultExpression.cs(91,9): Trim analysis error IL2026: DotNext.Linq.Expressions.AsyncResultExpression.Reduce(ParameterExpression, LabelTarget): Using member 'DotNext.Linq.Expressions.ExpressionBuilder.Call(Expression, String, Expression[])' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. Dynamic access to the method identified by parameter. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /_/src/DotNext.Metaprogramming/Linq/Expressions/AsyncResultExpression.cs(80,13): Trim analysis error IL2072: DotNext.Linq.Expressions.AsyncResultExpression.Reduce(): 'type' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicConstructors' in call to 'DotNext.Linq.Expressions.ExpressionBuilder.New(Type, Expression[])'. The return value of method 'System.Linq.Expressions.Expression.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. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /_/src/DotNext.Metaprogramming/Runtime/CompilerServices/AsyncStateMachine.cs(166,9): Trim analysis error IL2091: DotNext.Runtime.CompilerServices.AsyncStateMachine.MoveNext(TAwaiter&, UInt32): 'TAwaiter' generic argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicProperties' in 'DotNext.Runtime.CompilerServices.Awaiter'. The generic parameter 'TAwaiter' of 'DotNext.Runtime.CompilerServices.AsyncStateMachine.MoveNext(TAwaiter&, UInt32)' 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. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /_/src/DotNext.Metaprogramming/Runtime/CompilerServices/AsyncStateMachine.cs(166,9): Trim analysis error IL2091: DotNext.Runtime.CompilerServices.AsyncStateMachine.MoveNext(TAwaiter&, UInt32): 'TAwaiter' generic argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicProperties' in 'DotNext.Runtime.CompilerServices.Awaiter.IsCompletedGetter'. The generic parameter 'TAwaiter' of 'DotNext.Runtime.CompilerServices.AsyncStateMachine.MoveNext(TAwaiter&, UInt32)' 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. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /_/src/DotNext.Metaprogramming/Runtime/CompilerServices/AsyncStateMachine.cs(351,9): Trim analysis error IL2091: DotNext.Runtime.CompilerServices.AsyncStateMachine.MoveNext(TAwaiter&, UInt32): 'TAwaiter' generic argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicProperties' in 'DotNext.Runtime.CompilerServices.Awaiter'. The generic parameter 'TAwaiter' of 'DotNext.Runtime.CompilerServices.AsyncStateMachine.MoveNext(TAwaiter&, UInt32)' 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. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /_/src/DotNext.Metaprogramming/Runtime/CompilerServices/AsyncStateMachine.cs(351,9): Trim analysis error IL2091: DotNext.Runtime.CompilerServices.AsyncStateMachine.MoveNext(TAwaiter&, UInt32): 'TAwaiter' generic argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicProperties' in 'DotNext.Runtime.CompilerServices.Awaiter.IsCompletedGetter'. The generic parameter 'TAwaiter' of 'DotNext.Runtime.CompilerServices.AsyncStateMachine.MoveNext(TAwaiter&, UInt32)' 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. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /_/src/DotNext.Metaprogramming/Linq/Expressions/AwaitExpression.cs(38,13): Trim analysis error IL2075: DotNext.Linq.Expressions.AwaitExpression.AwaitExpression(Expression, Boolean): 'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicMethods' in call to 'System.Type.GetMethod(String, BindingFlags, Binder, Type[], ParameterModifier[])'. The return value of method 'System.Linq.Expressions.Expression.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. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /_/src/DotNext.Metaprogramming/Linq/Expressions/AwaitExpression.cs(44,9): Trim analysis error IL2075: DotNext.Linq.Expressions.AwaitExpression.AwaitExpression(Expression, Boolean): 'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicMethods' in call to 'System.Type.GetMethod(String, BindingFlags, Binder, Type[], ParameterModifier[])'. The return value of method 'System.Linq.Expressions.Expression.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. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /_/src/DotNext.Metaprogramming/Linq/Expressions/AwaitExpression.cs(46,9): Trim analysis error IL2075: DotNext.Linq.Expressions.AwaitExpression.AwaitExpression(Expression, Boolean): 'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicMethods' in call to 'System.Type.GetMethod(String, BindingFlags, Binder, Type[], ParameterModifier[])'. The return value of method 'System.Linq.Expressions.Expression.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. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /_/src/DotNext.Metaprogramming/Metaprogramming/AwaitForEachStatement.cs(30,9): Trim analysis error IL2026: DotNext.Metaprogramming.AwaitForEachStatement.DotNext.Metaprogramming.ILexicalScope>.Build(Action): Using member 'DotNext.Linq.Expressions.ForEachExpression.ForEachExpression(Expression, Expression, Boolean, LabelTarget, LabelTarget)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. Dynamic access to GetEnumerator method and IEnumerable interfaces. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /_/src/DotNext.Metaprogramming/Metaprogramming/AwaitForEachStatement.cs(22,9): Trim analysis error IL2026: DotNext.Metaprogramming.AwaitForEachStatement.DotNext.Metaprogramming.ILexicalScope>.Build(Action): Using member 'DotNext.Linq.Expressions.ForEachExpression.ForEachExpression(Expression, Expression, Boolean, LabelTarget, LabelTarget)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. Dynamic access to GetEnumerator method and IEnumerable interfaces. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /_/src/DotNext.Metaprogramming/Metaprogramming/MatchBuilder.cs(488,17): Trim analysis error IL2026: DotNext.Metaprogramming.MatchBuilder.MatchByMemberStatement.CaseStatementBuilder.DotNext.ISupplier.Invoke(ParameterExpression): Using member 'System.Linq.Expressions.Expression.PropertyOrField(Expression, String)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. Creating Expressions requires unreferenced code because the members being referenced by the Expression may be trimmed. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /_/src/DotNext.Metaprogramming/Metaprogramming/MatchBuilder.cs(529,17): Trim analysis error IL2026: DotNext.Metaprogramming.MatchBuilder.MatchByTwoMembersStatement.CaseStatementBuilder.DotNext.ISupplier.Invoke(ParameterExpression): Using member 'System.Linq.Expressions.Expression.PropertyOrField(Expression, String)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. Creating Expressions requires unreferenced code because the members being referenced by the Expression may be trimmed. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /_/src/DotNext.Metaprogramming/Metaprogramming/MatchBuilder.cs(573,17): Trim analysis error IL2026: DotNext.Metaprogramming.MatchBuilder.MatchByThreeMembersStatement.CaseStatementBuilder.DotNext.ISupplier.Invoke(ParameterExpression): Using member 'System.Linq.Expressions.Expression.PropertyOrField(Expression, String)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. Creating Expressions requires unreferenced code because the members being referenced by the Expression may be trimmed. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /_/src/DotNext.Metaprogramming/Metaprogramming/MatchBuilder.cs(573,17): Trim analysis error IL2026: DotNext.Metaprogramming.MatchBuilder.MatchByThreeMembersStatement.CaseStatementBuilder.DotNext.ISupplier.Invoke(ParameterExpression): Using member 'System.Linq.Expressions.Expression.PropertyOrField(Expression, String)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. Creating Expressions requires unreferenced code because the members being referenced by the Expression may be trimmed. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /_/src/DotNext.Metaprogramming/Metaprogramming/MatchBuilder.cs(529,17): Trim analysis error IL2026: DotNext.Metaprogramming.MatchBuilder.MatchByTwoMembersStatement.CaseStatementBuilder.DotNext.ISupplier.Invoke(ParameterExpression): Using member 'System.Linq.Expressions.Expression.PropertyOrField(Expression, String)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. Creating Expressions requires unreferenced code because the members being referenced by the Expression may be trimmed. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /_/src/DotNext.Metaprogramming/Metaprogramming/MatchBuilder.cs(573,17): Trim analysis error IL2026: DotNext.Metaprogramming.MatchBuilder.MatchByThreeMembersStatement.CaseStatementBuilder.DotNext.ISupplier.Invoke(ParameterExpression): Using member 'System.Linq.Expressions.Expression.PropertyOrField(Expression, String)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. Creating Expressions requires unreferenced code because the members being referenced by the Expression may be trimmed. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /_/src/DotNext.Metaprogramming/Metaprogramming/CodeGenerator.cs(372,12): Trim analysis error IL2026: DotNext.Metaprogramming.CodeGenerator.Call(Expression, String, Expression[]): Using member 'DotNext.Linq.Expressions.ExpressionBuilder.Call(Expression, String, Expression[])' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. Dynamic access to the method identified by parameter. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /_/src/DotNext.Metaprogramming/Metaprogramming/CodeGenerator.cs(410,12): Trim analysis error IL2067: DotNext.Metaprogramming.CodeGenerator.CallStatic(Type, String, Expression[]): 'type' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicMethods' in call to 'DotNext.Linq.Expressions.ExpressionBuilder.CallStatic(Type, String, Expression[])'. The parameter 'type' of method 'DotNext.Metaprogramming.CodeGenerator.CallStatic(Type, String, Expression[])' 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. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /_/src/DotNext.Metaprogramming/Linq/Expressions/CollectionAccessExpression.cs(117,13): Trim analysis error IL2072: DotNext.Linq.Expressions.CollectionAccessExpression.Type.get: 'collectionType' argument does not satisfy 'DynamicallyAccessedMemberTypes.Interfaces' in call to 'DotNext.Reflection.CollectionType.GetItemType(Type)'. The return value of method 'System.Linq.Expressions.Expression.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. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /_/src/DotNext.Metaprogramming/Linq/Expressions/CollectionAccessExpression.cs(72,32): Trim analysis error IL2067: DotNext.Linq.Expressions.CollectionAccessExpression.GetCountProperty(Type): 'type' argument does not satisfy 'DynamicallyAccessedMemberTypes.Interfaces' in call to 'DotNext.Reflection.TypeExtensions.GetBaseTypes(Type, Boolean, Boolean)'. The parameter 'collection' of method 'DotNext.Linq.Expressions.CollectionAccessExpression.GetCountProperty(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. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /_/src/DotNext.Metaprogramming/Linq/Expressions/CollectionAccessExpression.cs(74,13): Trim analysis error IL2075: DotNext.Linq.Expressions.CollectionAccessExpression.GetCountProperty(Type): 'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicProperties' in call to 'System.Type.GetProperty(String, BindingFlags)'. The return value of method 'System.Collections.Generic.IEnumerator.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. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /_/src/DotNext.Metaprogramming/Linq/Expressions/CollectionAccessExpression.cs(77,13): Trim analysis error IL2075: DotNext.Linq.Expressions.CollectionAccessExpression.GetCountProperty(Type): 'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicProperties' in call to 'System.Type.GetProperty(String, BindingFlags)'. The return value of method 'System.Collections.Generic.IEnumerator.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. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /_/src/DotNext.Metaprogramming/Runtime/CompilerServices/EnterGuardedCodeExpression.cs(19,12): Trim analysis error IL2026: DotNext.Runtime.CompilerServices.EnterGuardedCodeExpression.Reduce(ParameterExpression): Using member 'DotNext.Linq.Expressions.ExpressionBuilder.Call(Expression, String, Expression[])' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. Dynamic access to the method identified by parameter. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /_/src/DotNext.Metaprogramming/Runtime/CompilerServices/ExitGuardedCodeExpression.cs(24,12): Trim analysis error IL2026: DotNext.Runtime.CompilerServices.ExitGuardedCodeExpression.Reduce(ParameterExpression): Using member 'DotNext.Linq.Expressions.ExpressionBuilder.Call(Expression, String, Expression[])' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. Dynamic access to the method identified by parameter. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /_/src/DotNext.Metaprogramming/Metaprogramming/ForEachStatement.cs(23,9): Trim analysis error IL2026: DotNext.Metaprogramming.ForEachStatement.DotNext.Metaprogramming.ILexicalScope>.Build(Action): Using member 'DotNext.Linq.Expressions.ForEachExpression.ForEachExpression(Expression, LabelTarget, LabelTarget)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. Dynamic access to GetEnumerator method and IEnumerable interfaces. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /_/src/DotNext.Metaprogramming/Metaprogramming/ForEachStatement.cs(15,9): Trim analysis error IL2026: DotNext.Metaprogramming.ForEachStatement.DotNext.Metaprogramming.ILexicalScope>.Build(Action): Using member 'DotNext.Linq.Expressions.ForEachExpression.ForEachExpression(Expression, LabelTarget, LabelTarget)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. Dynamic access to GetEnumerator method and IEnumerable interfaces. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /_/src/DotNext.Metaprogramming/Runtime/CompilerServices/HasNoExceptionExpression.cs(17,12): Trim analysis error IL2026: DotNext.Runtime.CompilerServices.HasNoExceptionExpression.Reduce(ParameterExpression): Using member 'DotNext.Linq.Expressions.ExpressionBuilder.Property(Expression, String)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. Dynamic access to the property identified by parameter. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /_/src/DotNext.Metaprogramming/Metaprogramming/LambdaExpression.cs(59,9): Trim analysis error IL2091: DotNext.Metaprogramming.LambdaExpression.LambdaExpression`1(Boolean): 'TDelegate' generic argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicMethods' in 'DotNext.Reflection.DelegateType.GetInvokeMethod()'. The generic parameter 'TDelegate' of 'DotNext.Metaprogramming.LambdaExpression' 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. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /_/src/DotNext.Metaprogramming/Linq/Expressions/MetaExpression.cs(18,5): Trim analysis error IL2026: DotNext.Linq.Expressions.MetaExpression..cctor(): Using member 'System.Linq.Expressions.Expression.PropertyOrField(Expression, String)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. Creating Expressions requires unreferenced code because the members being referenced by the Expression may be trimmed. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /_/src/DotNext.Metaprogramming/Linq/Expressions/MetaExpression.cs(20,5): Trim analysis error IL2026: DotNext.Linq.Expressions.MetaExpression..cctor(): Using member 'DotNext.Linq.Expressions.ExpressionBuilder.Call(Expression, String, Expression[])' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. Dynamic access to the method identified by parameter. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /_/src/DotNext.Metaprogramming/Linq/Expressions/MetaExpression.cs(22,5): Trim analysis error IL2111: DotNext.Linq.Expressions.MetaExpression..cctor(): Method 'DotNext.Linq.Expressions.ExpressionBuilder.New(Type, Expression[])' with parameters or return value with `DynamicallyAccessedMembersAttribute` is accessed via reflection. Trimmer can't guarantee availability of the requirements of the method. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /_/src/DotNext.Metaprogramming/Linq/Expressions/MetaExpression.cs(23,5): Trim analysis error IL2026: DotNext.Linq.Expressions.MetaExpression..cctor(): Using member 'DotNext.Linq.Expressions.ExpressionBuilder.MakeIndex(Expression, Expression[])' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. Dynamic access to indexer of . [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /_/src/DotNext.Metaprogramming/Linq/Expressions/MetaExpression.cs(24,5): Trim analysis error IL2026: DotNext.Linq.Expressions.MetaExpression..cctor(): Using member 'DotNext.Linq.Expressions.ExpressionBuilder.New(Expression, Expression[])' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. Dynamic access to public constructors of a type represented by . [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /_/src/DotNext.Metaprogramming/Runtime/CompilerServices/MoveNextExpression.cs(34,9): Trim analysis error IL2075: DotNext.Runtime.CompilerServices.MoveNextExpression.Reduce(ParameterExpression): 'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicMethods' in call to 'System.Type.GetMethod(String, Int32, BindingFlags, Binder, Type[], ParameterModifier[])'. The return value of method 'System.Linq.Expressions.Expression.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. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /_/src/DotNext.Metaprogramming/Runtime/CompilerServices/MoveNextExpression.cs(34,9): Trim analysis error IL2060: DotNext.Runtime.CompilerServices.MoveNextExpression.Reduce(ParameterExpression): 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. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /_/src/DotNext.Metaprogramming/Linq/Expressions/MutationExpression.cs(34,17): Trim analysis error IL2075: DotNext.Linq.Expressions.MutationExpression.MutationExpression(Expression, IReadOnlyList): 'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicMethods' in call to 'System.Type.GetMethod(String, BindingFlags, Type[])'. The return value of method 'System.Linq.Expressions.Expression.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. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /_/src/DotNext.Metaprogramming/Linq/Expressions/MutationExpression.cs(64,12): Trim analysis error IL2072: DotNext.Linq.Expressions.MutationExpression.Create(Expression, MemberBindings): 'target' argument does not satisfy 'DynamicallyAccessedMemberTypes.All' in call to 'DotNext.Linq.Expressions.MemberBindings.Bind(Type)'. The return value of method 'System.Linq.Expressions.Expression.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. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /_/src/DotNext.Metaprogramming/Linq/Expressions/NullSafetyExpression.cs(96,9): Trim analysis error IL2026: DotNext.Linq.Expressions.NullSafetyExpression.Reduce(): Using member 'DotNext.Linq.Expressions.ExpressionBuilder.IsNotNull(Expression)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. Dynamic access to properties of . [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /_/src/DotNext.Metaprogramming/Runtime/CompilerServices/AsyncStateMachine.Pooling.cs(166,9): Trim analysis error IL2091: DotNext.Runtime.CompilerServices.PoolingAsyncStateMachine.MoveNext(TAwaiter&, UInt32): 'TAwaiter' generic argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicProperties' in 'DotNext.Runtime.CompilerServices.Awaiter'. The generic parameter 'TAwaiter' of 'DotNext.Runtime.CompilerServices.PoolingAsyncStateMachine.MoveNext(TAwaiter&, UInt32)' 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. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /_/src/DotNext.Metaprogramming/Runtime/CompilerServices/AsyncStateMachine.Pooling.cs(166,9): Trim analysis error IL2091: DotNext.Runtime.CompilerServices.PoolingAsyncStateMachine.MoveNext(TAwaiter&, UInt32): 'TAwaiter' generic argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicProperties' in 'DotNext.Runtime.CompilerServices.Awaiter.IsCompletedGetter'. The generic parameter 'TAwaiter' of 'DotNext.Runtime.CompilerServices.PoolingAsyncStateMachine.MoveNext(TAwaiter&, UInt32)' 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. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /_/src/DotNext.Metaprogramming/Runtime/CompilerServices/AsyncStateMachine.Pooling.cs(351,9): Trim analysis error IL2091: DotNext.Runtime.CompilerServices.PoolingAsyncStateMachine.MoveNext(TAwaiter&, UInt32): 'TAwaiter' generic argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicProperties' in 'DotNext.Runtime.CompilerServices.Awaiter'. The generic parameter 'TAwaiter' of 'DotNext.Runtime.CompilerServices.PoolingAsyncStateMachine.MoveNext(TAwaiter&, UInt32)' 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. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /_/src/DotNext.Metaprogramming/Runtime/CompilerServices/AsyncStateMachine.Pooling.cs(351,9): Trim analysis error IL2091: DotNext.Runtime.CompilerServices.PoolingAsyncStateMachine.MoveNext(TAwaiter&, UInt32): 'TAwaiter' generic argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicProperties' in 'DotNext.Runtime.CompilerServices.Awaiter.IsCompletedGetter'. The generic parameter 'TAwaiter' of 'DotNext.Runtime.CompilerServices.PoolingAsyncStateMachine.MoveNext(TAwaiter&, UInt32)' 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. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /_/src/DotNext.Metaprogramming/Linq/Expressions/RangeExpression.cs(41,12): Trim analysis error IL2026: DotNext.Linq.Expressions.RangeExpression.GetOffsetAndLength(Expression, Expression): Using member 'System.Linq.Expressions.Expression.Call(Expression, String, Type[], Expression[])' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. Creating Expressions requires unreferenced code because the members being referenced by the Expression may be trimmed. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /_/src/DotNext.Metaprogramming/Linq/Expressions/RangeExpression.cs(47,9): Trim analysis error IL2026: DotNext.Linq.Expressions.RangeExpression.GetOffsetAndLength(Expression, Expression, ParameterExpression&, MemberExpression&, MemberExpression&): Using member 'System.Linq.Expressions.Expression.Field(Expression, String)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. Creating Expressions requires unreferenced code because the members being referenced by the Expression may be trimmed. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /_/src/DotNext.Metaprogramming/Linq/Expressions/RangeExpression.cs(48,9): Trim analysis error IL2026: DotNext.Linq.Expressions.RangeExpression.GetOffsetAndLength(Expression, Expression, ParameterExpression&, MemberExpression&, MemberExpression&): Using member 'System.Linq.Expressions.Expression.Field(Expression, String)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. Creating Expressions requires unreferenced code because the members being referenced by the Expression may be trimmed. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /_/src/DotNext.Metaprogramming/Runtime/CompilerServices/RecoverFromExceptionExpression.cs(24,9): Trim analysis error IL2075: DotNext.Runtime.CompilerServices.RecoverFromExceptionExpression.Reduce(ParameterExpression): 'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicMethods' in call to 'System.Type.GetMethod(String)'. The return value of method 'System.Linq.Expressions.Expression.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. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /_/src/DotNext.Metaprogramming/Runtime/CompilerServices/RecoverFromExceptionExpression.cs(26,9): Trim analysis error IL2060: DotNext.Runtime.CompilerServices.RecoverFromExceptionExpression.Reduce(ParameterExpression): 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. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /_/src/DotNext.Metaprogramming/Runtime/CompilerServices/RethrowExpression.cs(18,12): Trim analysis error IL2026: DotNext.Runtime.CompilerServices.RethrowExpression.Reduce(ParameterExpression): Using member 'DotNext.Linq.Expressions.ExpressionBuilder.Call(Expression, String, Expression[])' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. Dynamic access to the method identified by parameter. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /_/src/DotNext.Metaprogramming/Linq/Expressions/SliceExpression.cs(102,9): Trim analysis error IL2026: DotNext.Linq.Expressions.SliceExpression.SubArray(Expression, Expression): Using member 'System.Runtime.CompilerServices.RuntimeHelpers.RunClassConstructor(RuntimeTypeHandle)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. Trimmer can't guarantee existence of class constructor. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /_/src/DotNext.Metaprogramming/Linq/Expressions/SliceExpression.cs(102,9): Trim analysis error IL2111: DotNext.Linq.Expressions.SliceExpression.SubArray(Expression, Expression): Method 'System.Runtime.CompilerServices.RuntimeHelpers.GetUninitializedObject(Type)' with parameters or return value with `DynamicallyAccessedMembersAttribute` is accessed via reflection. Trimmer can't guarantee availability of the requirements of the method. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /_/src/DotNext.Metaprogramming/Runtime/CompilerServices/StateIdExpression.cs(12,12): Trim analysis error IL2026: DotNext.Runtime.CompilerServices.StateIdExpression.Get(ParameterExpression): Using member 'DotNext.Linq.Expressions.ExpressionBuilder.Property(Expression, String)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. Dynamic access to the property identified by parameter. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /_/src/DotNext.Metaprogramming/Runtime/CompilerServices/TaskType.cs(40,13): Trim analysis error IL2067: DotNext.Runtime.CompilerServices.TaskType.TaskType(Type): 'type' argument does not satisfy 'DynamicallyAccessedMemberTypes.Interfaces' in call to 'DotNext.Reflection.TypeExtensions.IsGenericInstanceOf(Type, Type)'. The parameter 'taskType' of method 'DotNext.Runtime.CompilerServices.TaskType.TaskType(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. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /_/src/DotNext.Metaprogramming/Runtime/CompilerServices/TaskType.cs(41,17): Trim analysis error IL2067: DotNext.Runtime.CompilerServices.TaskType.TaskType(Type): 'type' argument does not satisfy 'DynamicallyAccessedMemberTypes.Interfaces' in call to 'DotNext.Reflection.TypeExtensions.GetGenericArguments(Type, Type)'. The parameter 'taskType' of method 'DotNext.Runtime.CompilerServices.TaskType.TaskType(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. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /_/src/DotNext.Metaprogramming/Runtime/CompilerServices/TaskType.cs(48,12): Trim analysis error IL2026: DotNext.Runtime.CompilerServices.TaskType.AdjustTaskType(MethodCallExpression): Using member 'System.Linq.Expressions.Expression.Call(Expression, String, Type[], Expression[])' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. Creating Expressions requires unreferenced code because the members being referenced by the Expression may be trimmed. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /_/src/DotNext.Metaprogramming/Linq/Expressions/UsingExpression.cs(29,9): Trim analysis error IL2072: DotNext.Linq.Expressions.UsingExpression.UsingExpression(Expression): 'type' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicMethods' in call to 'DotNext.Reflection.DisposableType.GetDisposeMethod(Type)'. The return value of method 'System.Linq.Expressions.Expression.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. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /_/src/DotNext.Metaprogramming/Linq/Expressions/UsingExpression.cs(43,9): Trim analysis error IL2072: DotNext.Linq.Expressions.UsingExpression.UsingExpression(Expression, Boolean): 'type' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicMethods' in call to 'DotNext.Reflection.DisposableType.GetDisposeAsyncMethod(Type)'. The return value of method 'System.Linq.Expressions.Expression.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. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /_/src/DotNext.Metaprogramming/Runtime/CompilerServices/ValueTupleBuilder.cs(42,13): Trim analysis error IL2026: DotNext.Runtime.CompilerServices.ValueTupleBuilder.Build(Expression, Span): Using member 'System.Linq.Expressions.Expression.Field(Expression, String)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. Creating Expressions requires unreferenced code because the members being referenced by the Expression may be trimmed. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /_/src/DotNext.Metaprogramming/Runtime/CompilerServices/ValueTupleBuilder.cs(45,13): Trim analysis error IL2026: DotNext.Runtime.CompilerServices.ValueTupleBuilder.Build(Expression, Span): Using member 'System.Linq.Expressions.Expression.Field(Expression, String)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. Creating Expressions requires unreferenced code because the members being referenced by the Expression may be trimmed. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /_/src/DotNext.Metaprogramming/Runtime/CompilerServices/ValueTupleBuilder.cs(36,14): Trim analysis error IL2075: DotNext.Runtime.CompilerServices.ValueTupleBuilder.Build(): 'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicParameterlessConstructor' in call to 'System.Type.MakeGenericType(Type[])'. The return value of method 'DotNext.Runtime.CompilerServices.ValueTupleBuilder.Build()' 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. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] ILLink : Trim analysis error IL2026: System.Configuration.InfiniteTimeSpanConverter..cctor(): 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. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] ILLink : Trim analysis error IL2067: System.Configuration.TypeUtil.CreateInstance(Type): 'type' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicParameterlessConstructor', 'DynamicallyAccessedMemberTypes.NonPublicConstructors' in call to 'System.Activator.CreateInstance(Type, Boolean)'. The parameter 'type' of method 'System.Configuration.TypeUtil.CreateInstance(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. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] ILLink : Trim analysis error IL2070: System.Configuration.TypeUtil.GetConstructor(Type, Type, Boolean): 'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicConstructors', 'DynamicallyAccessedMemberTypes.NonPublicConstructors' in call to 'System.Type.GetConstructor(BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[])'. The parameter 'type' of method 'System.Configuration.TypeUtil.GetConstructor(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. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] ILLink : Trim analysis error IL2026: System.Configuration.TypeUtil.GetImplicitType(String): Using member 'System.Reflection.Assembly.GetType(String, Boolean)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. Types might be removed. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] ILLink : Trim analysis error IL2057: System.Configuration.TypeUtil.GetImplicitType(String): Unrecognized value passed to the parameter 'typeName' of method 'System.Type.GetType(String)'. It's not possible to guarantee the availability of the target type. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] ILLink : Trim analysis error IL2057: System.Configuration.TypeUtil.GetType(String, Boolean): Unrecognized value passed to the parameter 'typeName' of method 'System.Type.GetType(String, Boolean)'. It's not possible to guarantee the availability of the target type. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] /home/alexrp/.nuget/packages/microsoft.net.illink.tasks/8.0.1/build/Microsoft.NET.ILLink.targets(87,5): error NETSDK1144: Optimizing assemblies for size failed. Optimization can be disabled by setting the PublishTrimmed property to false. [/home/alexrp/Source/dotNext/src/DotNext.Trimming/DotNext.Trimming.csproj] ```

Any of these you'd prefer to tackle? If not, I'll take a look over the next few days.

sakno commented 9 months ago

There are few warnings related to DotNext core library that can be fixed easily. I'll do that later after merging this PR. The primary focus of this PR is to fix trimming errors in DotNext.Metaprogramming.

sakno commented 9 months ago

Feel free to modify a branch linked to this PR directly.

alexrp commented 9 months ago

Feel free to modify a branch linked to this PR directly.

Can I actually do that? :eyes: I tried pushing the commit to your feature branch here first, but GitHub rejected that due to permissions. I don't know if there's some other way to do it. :thinking:

sakno commented 9 months ago

rejected that due to permissions

Perhaps, you never contributed to this repository and didn't pass CLA check. I'll close this PR without merge. Could you please open a new one with your branch and merge changes from this branch?

alexrp commented 9 months ago

Yep, will do.