/// <summary>
 /// Initializes a <see cref="HazardousUsageEvaluator"/> that evaluates a method invocation on the type being tracked by PropertySetAnalysis.
 /// </summary>
 /// <param name="trackedTypeMethodName">Name of the method within the tracked type.</param>
 /// <param name="evaluator">Evaluation callback.</param>
 /// <param name="derivedClass">Whether to consider derived class.</param>
 public HazardousUsageEvaluator(string trackedTypeMethodName, InvocationEvaluationCallback evaluator, bool derivedClass = false)
 {
     MethodName          = trackedTypeMethodName ?? throw new ArgumentNullException(nameof(trackedTypeMethodName));
     InvocationEvaluator = evaluator ?? throw new ArgumentNullException(nameof(evaluator));
     Kind         = HazardousUsageEvaluatorKind.Invocation;
     DerivedClass = derivedClass;
 }
Exemplo n.º 2
0
 /// <summary>
 /// Initializes a <see cref="HazardousUsageEvaluator"/> that evaluates a method invocation with an argument of the type being tracked by PropertySetAnalysis.
 /// </summary>
 /// <param name="containingType">Name of the instance that the method is invoked on.</param>
 /// <param name="methodName">Name of the method within <paramref name="containingType"/>.</param>
 /// <param name="parameterNameOfPropertySetObject">Name of the method parameter containing the type being tracked by PropertySetAnalysis.</param>
 /// <param name="evaluator">Evaluation callback.</param>
 public HazardousUsageEvaluator(string containingType, string methodName, string parameterNameOfPropertySetObject, InvocationEvaluationCallback evaluator)
 {
     ContainingTypeName = containingType ?? throw new ArgumentNullException(nameof(containingType));
     MethodName         = methodName ?? throw new ArgumentNullException(nameof(methodName));
     ParameterNameOfPropertySetObject = parameterNameOfPropertySetObject ?? throw new ArgumentNullException(nameof(parameterNameOfPropertySetObject));
     InvocationEvaluator = evaluator ?? throw new ArgumentNullException(nameof(evaluator));
     Kind = HazardousUsageEvaluatorKind.Invocation;
 }