Our website uses cookies to enhance your browsing experience.
Accept
to the top
close form

Fill out the form in 2 simple steps below:

Your contact information:

Step 1
Congratulations! This is your promo code!

Desired license type:

Step 2
Team license
Enterprise license
** By clicking this button you agree to our Privacy Policy statement
close form
Request our prices
New License
License Renewal
--Select currency--
USD
EUR
* By clicking this button you agree to our Privacy Policy statement

close form
Free PVS‑Studio license for Microsoft MVP specialists
* By clicking this button you agree to our Privacy Policy statement

close form
To get the licence for your open-source project, please fill out this form
* By clicking this button you agree to our Privacy Policy statement

close form
I am interested to try it on the platforms:
* By clicking this button you agree to our Privacy Policy statement

close form
check circle
Message submitted.

Your message has been sent. We will email you at


If you do not see the email in your inbox, please check if it is filtered to one of the following folders:

  • Promotion
  • Updates
  • Spam

Webinar: C++ semantics - 06.11

>
>
>
Examples of errors detected by the V311…

Examples of errors detected by the V3117 diagnostic

V3117. Constructor parameter is not used.


PowerShell

V3117 Constructor parameter 'errorCategory_Message' is not used. System.Management.Automation ErrorPackage.cs 1125


private void PopulateProperties(
  Exception exception,
  object targetObject,
  string fullyQualifiedErrorId,
  ErrorCategory errorCategory,
  string errorCategory_Activity,
  string errorCategory_Reason,
  string errorCategory_TargetName,
  string errorCategory_TargetType,
  string errorCategory_Message,
  string errorDetails_Message,
  string errorDetails_RecommendedAction,
  string errorDetails_ScriptStackTrace)
{ .... }

internal ErrorRecord(
  Exception exception,
  object targetObject,
  string fullyQualifiedErrorId,
  ErrorCategory errorCategory,
  string errorCategory_Activity,
  string errorCategory_Reason,
  string errorCategory_TargetName,
  string errorCategory_TargetType,
  string errorCategory_Message,
  string errorDetails_Message,
  string errorDetails_RecommendedAction)
{
  PopulateProperties(
    exception,
    targetObject,
    fullyQualifiedErrorId,
    errorCategory,
    errorCategory_Activity,
    errorCategory_Reason,
    errorCategory_TargetName,
    errorCategory_TargetType,
    errorDetails_Message,            // <=
    errorDetails_Message,            // <=
    errorDetails_RecommendedAction,
    null);
}

Infer.NET

V3117 Constructor parameter 'useLazyQuantifier' is not used. Runtime RegexpFormattingSettings.cs 38


public RegexpFormattingSettings(
         bool putOptionalInSquareBrackets,
         bool showAnyElementAsQuestionMark,
         bool ignoreElementDistributionDetails,
         int truncationLength,
         bool escapeCharacters,
         bool useLazyQuantifier)
{
  this.PutOptionalInSquareBrackets = putOptionalInSquareBrackets;
  this.ShowAnyElementAsQuestionMark = showAnyElementAsQuestionMark;
  this.IgnoreElementDistributionDetails = ignoreElementDistributionDetails;
  this.TruncationLength = truncationLength;
  this.EscapeCharacters = escapeCharacters;
}

FastReport

V3117 Constructor parameter 'iniCapacity' is not used. FastString.cs 434


public FastString(int iniCapacity)
{
  Init(initCapacity);
}

.NET Core Libraries (CoreFX)

V3117 Constructor parameter 'securityUrl' is not used. XmlSecureResolver.cs 15


public XmlSecureResolver(XmlResolver resolver, string securityUrl)
{
  _resolver = resolver;
}

.NET Core Libraries (CoreFX)

V3117 Constructor parameter 'checkSecurity' is not used. ObjectManager.cs 33


internal ObjectManager(
  ISurrogateSelector selector,
  StreamingContext context,
  bool checkSecurity,
  bool isCrossAppDomain)
{
  _objects = new ObjectHolder[DefaultInitialSize];
  _selector = selector;
  _context = context;
  _isCrossAppDomain = isCrossAppDomain;
}

.NET Core Libraries (CoreFX)

V3117 Constructor parameter 'userOptions' is not used. DbConnectionPool.cs 26


private sealed class PendingGetConnection
{
  public PendingGetConnection(
           long dueTime,
           DbConnection owner,
           TaskCompletionSource<DbConnectionInternal> completion,
           DbConnectionOptions userOptions)
  {
    DueTime = dueTime;
    Owner = owner;
    Completion = completion;
  }

  public long DueTime { get; private set; }
  public DbConnection Owner { get; private set; }
  public TaskCompletionSource<DbConnectionInternal>
           Completion { get; private set; }
  public DbConnectionOptions UserOptions { get; private set; }
}

AvaloniaUI

V3117 Constructor parameter 'phones' is not used. Country.cs 25


public Country(string name,
               string region,
               int population,
               int area,
               double density,
               double coast,
               double? migration,
               double? infantMorality,
               int gdp,
               double? literacy,
               double? phones,
               double? birth,
               double? death)
{
  Name = name;
  Region = region;
  Population = population;
  Area = area;
  PopulationDensity = density;
  CoastLine = coast;
  NetMigration = migration;
  InfantMortality = infantMorality;
  GDP = gdp;
  LiteracyPercent = literacy;
  BirthRate = birth;
  DeathRate = death;
}

Ryujinx

V3117 Constructor parameter 'context' is not used. IAccountServiceForAdministrator.cs 12


public IAccountServiceForAdministrator(ServiceCtx context,
    AccountServiceFlag serviceFlag)
{
    _applicationServiceServer = new ApplicationServiceServer(serviceFlag);
}

Similar errors can be found in some other places:

  • V3117 Constructor parameter 'context' is not used. IAccountServiceForApplication.cs 13
  • V3117 Constructor parameter 'context' is not used. IAccountServiceForSystemService.cs 11
  • V3117 Constructor parameter 'context' is not used. IDeliveryCacheStorageService.cs 12
  • And 6 additional diagnostic messages.

.NET 6 libraries

V3117 Constructor parameter 'options' is not used. JsonObject.cs 35


public sealed partial class JsonObject : JsonNode
{
  ....
  public JsonObject(JsonNodeOptions? options = null) : base(options) { }

  public JsonObject(IEnumerable<KeyValuePair<string, JsonNode?>> properties,
                    JsonNodeOptions? options = null)
  {
    foreach (KeyValuePair<string, JsonNode?> node in properties)
    {
      Add(node.Key, node.Value);
    }
  }
  ....
}

Discord.NET

V3117 Constructor parameter 'after' is not used. ThreadUpdateAuditLogData.cs 13


public class ThreadUpdateAuditLogData : IAuditLogData
{
  private ThreadUpdateAuditLogData(IThreadChannel thread,
                                   ThreadType type,
                                   ThreadInfo before,
                                   ThreadInfo after)
  {
    Thread = thread;
    ThreadType = type;
    Before = before;
    After = After;
  }
  ....
}

MassTransit

V3117 Constructor parameter 'initialize' is not used. BusHostInfo.cs 17


[Serializable]
public class BusHostInfo : HostInfo
{
  public BusHostInfo()
  {
  }

  public BusHostInfo(bool initialize)
  {
    FrameworkVersion = Environment.Version.ToString();
    OperatingSystemVersion = Environment.OSVersion.ToString();
    var entryAssembly =   System.Reflection.Assembly.GetEntryAssembly()
                       ?? System.Reflection.Assembly.GetCallingAssembly();

    MachineName = Environment.MachineName;

    MassTransitVersion = typeof(HostInfo).GetTypeInfo()
                                         .Assembly
                                         .GetName()
                                         .Version
                                         ?.ToString();

    try
    {
      using var currentProcess = Process.GetCurrentProcess();
      ProcessId = currentProcess.Id;
      ProcessName = currentProcess.ProcessName;
      if ("dotnet".Equals(ProcessName, StringComparison.OrdinalIgnoreCase))
        ProcessName = GetUsefulProcessName(ProcessName);
    }
    catch (PlatformNotSupportedException)
    {
      ProcessId = 0;
      ProcessName = GetUsefulProcessName("UWP");
    }

    var assemblyName = entryAssembly.GetName();
    Assembly = assemblyName.Name;
    AssemblyVersion = assemblyName.Version?.ToString() ?? "Unknown";
  }

  ....
}