18 [
RequiresUnreferencedCode(
"Enumerating in-memory collections as IQueryable can require unreferenced code because expressions referencing IQueryable extension methods can get rebound to IEnumerable extension methods. The IEnumerable extension methods could be trimmed causing the application to fail at runtime.")]
23 [
UnconditionalSuppressMessage(
"ReflectionAnalysis",
"IL2026:RequiresUnreferencedCode", Justification =
"This class's ctor is annotated as RequiresUnreferencedCode.")]
52 if (parameters.Length != 0)
56 for (
int num = parameters.Length; i < num; i++)
64 for (
int j = 0;
j < i;
j++)
97 if (
type.IsAssignableFrom(c))
137 [
UnconditionalSuppressMessage(
"ReflectionAnalysis",
"IL2075:UnrecognizedReflectionPattern", Justification =
"The IGrouping<,> is kept since it's directly referenced hereand so it will also be preserved in all places where it's implemented.The GetInterfaces may return less after trimming but it will includethe IGrouping<,> if it was there before trimming, which is enough for thismethod to work.")]
142 [
UnconditionalSuppressMessage(
"ReflectionAnalysis",
"IL2070:UnrecognizedReflectionPattern", Justification =
"The IEnumerable<> is kept since it's directly referenced hereand so it will also be preserved in all places where it's implemented.The GetInterfaces may return less after trimming but it will includethe IEnumerable<> if it was there before trimming, which is enough for thismethod to work.")]
205 [
UnconditionalSuppressMessage(
"ReflectionAnalysis",
"IL2070:UnrecognizedReflectionPattern", Justification =
"The enumerable interface type (IOrderedQueryable<>, IOrderedEnumerable<>, IQueryable<> and IEnumerable<>) is kept since it's directly referenced hereand so it will also be preserved in all places where it's implemented.The GetInterfaces may return less after trimming but it will includethe enumerable interface type if it was there before trimming, which is enough for thismethod to work.")]
210 where i.IsGenericType && i.GenericTypeArguments.Length == 1
214 GenType = i.GetGenericTypeDefinition()
218 select i.Info.GenericTypeArguments[0]).
Distinct().SingleOrDefault();
225 select i.Info.GenericTypeArguments[0]).
Distinct().Single();
248 [
UnconditionalSuppressMessage(
"ReflectionAnalysis",
"IL2060:MakeGenericMethod", Justification =
"Enumerable methods don't have trim annotations.")]
261 [
UnconditionalSuppressMessage(
"ReflectionAnalysis",
"IL2070:UnrecognizedReflectionPattern", Justification =
"This method is intentionally hiding the Enumerable type from the trimmer so it doesn't preserve all Enumerable's methods. This is safe because all Queryable methods have a DynamicDependency to the corresponding Enumerable method.")]
268 [
RequiresUnreferencedCode(
"Enumerating in-memory collections as IQueryable can require unreferenced code because expressions referencing IQueryable extension methods can get rebound to IEnumerable extension methods. The IEnumerable extension methods could be trimmed causing the application to fail at runtime.")]
273 select
m).GetEnumerator())
303 if (!
m.IsGenericMethodDefinition &&
m.IsGenericMethod &&
m.ContainsGenericParameters)
305 m =
m.GetGenericMethodDefinition();
307 if (
m.IsGenericMethodDefinition)
313 if (
m.GetGenericArguments().Length !=
typeArgs.Length)
345 [
UnconditionalSuppressMessage(
"ReflectionAnalysis",
"IL2060:MakeGenericMethod", Justification =
"MakeGenericMethod is only called to get the parameter types, which are only used to make a 'match' decision. The generic method is not invoked.")]
368 return type2.MakeArrayType();
378 return base.VisitConditional(c);
405 if (
type ==
node.Expressions.Last().Type)
bool TryGetValue(TKey key, [MaybeNullWhen(false)] out TValue value)
bool ICollection< KeyValuePair< TKey, TValue > >. Contains(KeyValuePair< TKey, TValue > keyValuePair)
void Add(TKey key, TValue value)
static MethodInfo FindEnumerableMethodForQueryable(string name, ReadOnlyCollection< Expression > args, params Type[] typeArgs)
Dictionary< LabelTarget, LabelTarget > _targetCache
Dictionary< Type, Type > _equivalentTypeCache
static bool ArgsMatch(MethodInfo m, ReadOnlyCollection< Expression > args, Type[] typeArgs)
static Type GetPublicType(Type t)
Type GetEquivalentType(Type type)
override Expression VisitConditional(ConditionalExpression c)
static Type StripExpression(Type type)
override Expression VisitBlock(BlockExpression node)
override Expression VisitLambda< T >(Expression< T > node)
static ILookup< string, MethodInfo > s_seqMethods
static MethodInfo FindMethod(Type type, string name, ReadOnlyCollection< Expression > args, Type[] typeArgs)
override Expression VisitConstant(ConstantExpression c)
Expression FixupQuotedExpression(Type type, Expression expression)
override Expression VisitMethodCall(MethodCallExpression m)
override Expression VisitGoto(GotoExpression node)
ReadOnlyCollection< Expression > FixupQuotedArgs(MethodInfo mi, ReadOnlyCollection< Expression > argList)
override LabelTarget VisitLabelTarget(LabelTarget node)
static Exception NoMethodOnType(string name, object type)
static Exception NoMethodOnTypeMatchingArguments(string name, object type)
virtual ? Expression Visit(Expression? node)
static ConstantExpression Constant(object? value)
static BlockExpression Block(Expression arg0, Expression arg1)
static MethodCallExpression Call(MethodInfo method)
static LabelExpression Label(LabelTarget target)
static ConditionalExpression Condition(Expression test, Expression ifTrue, Expression ifFalse)
static GotoExpression MakeGoto(GotoExpressionKind kind, LabelTarget target, Expression? value, Type type)
static NewArrayExpression NewArrayInit(Type type, params Expression[] initializers)
static Type FindGenericType(Type definition, Type type)
virtual MethodInfo MakeGenericMethod(params Type[] typeArguments)
virtual Type[] GetGenericArguments()
virtual bool IsGenericType