Unicorn with delicious cookie
Nous utilisons des cookies pour améliorer votre expérience de navigation. En savoir plus
Accepter
to the top
>
>
>
Examples of errors detected by the V306…

Examples of errors detected by the V3062 diagnostic

V3062. An object is used as an argument to its own method. Consider checking the first actual argument of the 'Foo' method.


Accord.Net

V3062 An object 'observations' is used as an argument to its own method. Consider checking the first actual argument of the 'WeightedMean' method. Accord.Statistics InverseGaussianDistribution.cs 325


public static double WeightedMean(this double[] values,
                                       double[] weights)
{
  ....
}

public override void Fit(double[] observations,
                         double[] weights,
                         IFittingOptions options)
{
  ....
  mean = observations.WeightedMean(observations);
  ....
}

AWS SDK for .NET

V3062 An object 'attributeName' is used as an argument to its own method. Consider checking the first actual argument of the 'Contains' method. AWSSDK.MobileAnalytics.Net45 CustomEvent.cs 261


public string GetAttribute(string attributeName)
{
  if(string.IsNullOrEmpty(attributeName))
  {
    throw new ArgumentNullException("attributeName");
  }
  string ret = null;
  lock(_lock)
  {
    if(attributeName.Contains(attributeName))  // <=
      ret = _attributes[attributeName];
  }
  return ret;
}

.NET 7

V3062 An object 'DiagnosticLocation' is used as an argument to its own method. Consider checking the first actual argument of the 'Equals' method. LibraryImportGenerator.cs 43


public bool Equals(IncrementalStubGenerationContext? other)
{
  return    other is not null
         && StubEnvironment.AreCompilationSettingsEqual(Environment,
                                                        other.Environment)
         && SignatureContext.Equals(other.SignatureContext)
         && ContainingSyntaxContext.Equals(other.ContainingSyntaxContext)
         && StubMethodSyntaxTemplate.Equals(other.StubMethodSyntaxTemplate)
         && LibraryImportData.Equals(other.LibraryImportData)
         && DiagnosticLocation.Equals(DiagnosticLocation)     // <=
         && ForwardedAttributes.SequenceEqual(
              other.ForwardedAttributes,
              (IEqualityComparer<AttributeSyntax>)
                SyntaxEquivalentComparer.Instance)
        && GeneratorFactoryKey.Equals(other.GeneratorFactoryKey)
        && Diagnostics.SequenceEqual(other.Diagnostics);
}

Similar errors can be found in some other places:

  • V3062 An object 'DiagnosticLocation' is used as an argument to its own method. Consider checking the first actual argument of the 'Equals' method. JSImportGenerator.cs 42
  • V3062 An object 'DiagnosticLocation' is used as an argument to its own method. Consider checking the first actual argument of the 'Equals' method. JSExportGenerator.cs 37

nopCommerce

V3062 An object 'other' is used as an argument to its own method. Consider checking the first actual argument of the 'Equals' method. ImportManager.cs 3392


public partial class CategoryKey
{
  ....

  public bool Equals(CategoryKey y)
  {
    if (y == null)
      return false;

    if (Category != null && y.Category != null)
      return Category.Id == y.Category.Id;

    if (....)
    {
      return false;
    }

    return Key.Equals(y.Key);
  }

  public override bool Equals(object obj)
  {
    var other = obj as CategoryKey;
    return other?.Equals(other) ?? false;        // <=
  }
}

close form

Remplissez le formulaire ci‑dessous en 2 étapes simples :

Vos coordonnées :

Étape 1
Félicitations ! Voici votre code promo !

Type de licence souhaité :

Étape 2
Team license
Enterprise licence
** En cliquant sur ce bouton, vous déclarez accepter notre politique de confidentialité
close form
Demandez des tarifs
Nouvelle licence
Renouvellement de licence
--Sélectionnez la devise--
USD
EUR
* En cliquant sur ce bouton, vous déclarez accepter notre politique de confidentialité

close form
La licence PVS‑Studio gratuit pour les spécialistes Microsoft MVP
close form
Pour obtenir la licence de votre projet open source, s’il vous plait rempliez ce formulaire
* En cliquant sur ce bouton, vous déclarez accepter notre politique de confidentialité

close form
I want to join the test
* En cliquant sur ce bouton, vous déclarez accepter notre politique de confidentialité

close form
check circle
Votre message a été envoyé.

Nous vous répondrons à


Si l'e-mail n'apparaît pas dans votre boîte de réception, recherchez-le dans l'un des dossiers suivants:

  • Promotion
  • Notifications
  • Spam