To get a trial key
fill out the form below
Team License (a basic version)
Enterprise License (extended version)
* By clicking this button you agree to our Privacy Policy statement

Request our prices
New License
License Renewal
--Select currency--
USD
EUR
GBP
RUB
* By clicking this button you agree to our Privacy Policy statement

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

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

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

Message submitted.

Your message has been sent. We will email you at


If you haven't received our response, please do the following:
check your Spam/Junk folder and click the "Not Spam" button for our message.
This way, you won't miss messages from our team in the future.

>
>
>
Examples of errors detected by the V302…

Examples of errors detected by the V3025 diagnostic

V3025. Incorrect format. Consider checking the N format items of the 'Foo' function.


SharpDevelop

V3025 Incorrect format. A different number of actual arguments is expected while calling 'Format' function. Expected: 4. Present: 6. MonoSymbolTable.cs 235


public override string ToString ()
{
  return
    String.Format("[Line {0}:{1,2}-{3,4}:{5}]",
                  File, Row, Column, EndRow, EndColumn, Offset);
}

SharpDevelop

V3025 Incorrect format. A different number of actual arguments is expected while calling 'Format' function. Expected: 2. Present: 3. Thread.cs 235


public override string ToString()
{
  return String.Format("Thread Name = {1} Suspended = {2}",
                       ID, Name, Suspended);
}

Microsoft Code Contracts

V3025 Incorrect format. A different number of actual arguments is expected while calling 'Format' function. Expected: 3. Present: 2. VSServiceProvider.cs 515


void AskToReportError(Exception exn) {
  ....
  var emailBody = new StringBuilder();
  emailBody.AppendLine("Hi Code Contracts user,");
  emailBody.AppendLine();
  ....
  emailBody.AppendLine(
    String.Format(".... {0} {1} Visual Studio {2} Bug Report",
      typeof(VSServiceProvider).Assembly.GetName().Version,
#if DEBUG
                                                 "Debug"
#else
                                                 "Release"
#endif
                                           ));
  ....
}

Microsoft Code Contracts

V3025 Incorrect format. A different number of actual arguments is expected while calling 'Format' function. Expected: 1. Present: 2. Output.cs 68


public override void WriteLine(string value)
{
  output.WriteLine(string.Format("{1}", DateTime.Now,
    value.Replace("{", "{{").Replace("}","}}")));
  //output.WriteLine(string.Format("[{0}] {1}",
    //DateTime.Now., value));
}

Similar errors can be found in some other places:

  • V3025 Incorrect format. A different number of actual arguments is expected while calling 'Format' function. Expected: 6. Present: 7. CacheModelExtensions.cs 46
  • V3025 Incorrect format. A different number of actual arguments is expected while calling 'Format' function. Expected: 1. Present: 2. CodeFixesInference.cs 1608
  • V3025 Incorrect format. A different number of actual arguments is expected while calling 'Format' function. Expected: 2. Present: 3. ExpressionManipulation.cs 442

MonoDevelop

V3025 Incorrect format. A different number of format items is expected while calling 'Format' function. Expected: 3. Present: 4. MonoDevelop.Core ConditionParser.cs 254


ConditionExpression ParseReferenceExpression (string prefix)
{
  StringBuilder sb = new StringBuilder ();

  string ref_type = prefix [0] == '$' ?
                      "a property" : "an item list";
  int token_pos = tokenizer.Token.Position;
  IsAtToken (TokenType.LeftParen, String.Format (
             "Expected {0} at position {1} in condition \"{2}\".
             Missing opening parantheses after the '{3}'.",
             ref_type, token_pos, conditionStr, prefix));
  ....

  IsAtToken (TokenType.RightParen, String.Format (
             "Expected {0} at position {1} in condition \"{2}\".
              Missing closing parantheses'.",
              ref_type, token_pos, conditionStr, prefix));
  ....
}

Similar errors can be found in some other places:

  • V3025 Incorrect format. A different number of format items is expected while calling 'Format' function. Expected: 1. Present: 2. MonoDevelop.Xml XmlFormatterWriter.cs 1131
  • V3025 Incorrect format. A different number of format items is expected while calling 'Format' function. Expected: 4. Present: 6. ICSharpCode.NRefactory.CSharp MonoSymbolTable.cs 235
  • V3025 Incorrect format. A different number of format items is expected while calling 'Format' function. Expected: 1. Present: 2. MonoDevelop.Ide HelpOperations.cs 212
  • And 2 additional diagnostic messages.

IronPython and IronRuby

V3025 Incorrect format. A different number of format items is expected while calling 'Format' function. Expected: 1. Present: 2. ConversionWrappers.cs 235


public T Current {
  get {
    try {
      return (T)enumerable.Current;
    }
    catch (InvalidCastException iex) {
      throw new InvalidCastException(string.Format(
    "Error in IEnumeratorOfTWrapper. Could not cast: {0} in {0}",
    typeof(T).ToString(),
    enumerable.Current.GetType().ToString()),
    iex);
    }
  }
}

IronPython and IronRuby

V3025 Incorrect format. A different number of format items is expected while calling 'WriteLine' function. Expected: 2. Present: 3. Program.cs 268


private static void DumpGenericParameters(
  MetadataTableView genericParams,
  MetadataRecord owner) {
  foreach (GenericParamDef gp in genericParams) {
    _output.WriteLine("  generic parameter #{0}: {1}",
    gp.Index, gp.Name, gp.Attributes);
  ....
}

.NET Compiler Platform ("Roslyn")

V3025 Incorrect format. A different number of format items is expected while calling 'Format' function. Expected: 2. Present: 3. CompilerServerLogger.cs 49


static CompilerServerLogger()
{
  ....
  loggingFileName = Path.Combine(loggingFileName,
    string.Format("server.{1}.{2}.log",
                  loggingFileName,
                  GetCurrentProcessId(),
                  Environment.TickCount));
  ....
}

.NET Compiler Platform ("Roslyn")

V3025 Incorrect format. A different number of format items is expected while calling 'Format' function. Expected: 2. Present: 1. CompilerPackage.cs 105


private const string WriteFileExceptionMessage =
  @"{1}
  To reload the Roslyn compiler package, close Visual Studio and
  any MSBuild processes, then restart Visual Studio.";

private void WriteMSBuildFiles(....)
{
  ....
  catch (Exception e)
  {
    VsShellUtilities.ShowMessageBox(
      this,
      string.Format(WriteFileExceptionMessage, e.Message),
      null,
      OLEMSGICON.OLEMSGICON_WARNING,
      OLEMSGBUTTON.OLEMSGBUTTON_OK,
      OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST);
  }
}

.NET Compiler Platform ("Roslyn")

V3025 Incorrect format. A different number of format items is expected while calling 'WriteLine' function. Expected: 3. Present: 1. LoadingAttributes.cs 551


private void DumpAttributes(Symbol s)
{
  int i = 0;
  foreach (var sa in s.GetAttributes())
  {
    int j = 0;
    foreach (var pa in sa.CommonConstructorArguments)
    {
      Console.WriteLine("{0} {1} {2}", pa.ToString());
      j += 1;
    }
    j = 0;
    foreach (var na in sa.CommonNamedArguments)
    {
      Console.WriteLine("{0} {1} {2} = {3}",
                        na.Key, na.Value.ToString());
      j += 1;
    }
    i += 1;
  }
}

Similar errors can be found in some other places:

  • V3025 Incorrect format. A different number of format items is expected while calling 'WriteLine' function. Expected: 4. Present: 2. LoadingAttributes.cs 558

Xenko

V3025 Incorrect format. A different number of format items is expected while calling 'Format' function. Expected: 4. Present: 3. SiliconStudio.Core.Mathematics Color3.cs 765


public string ToString(string format,
                                IFormatProvider formatProvider)
{
  if (format == null)
    return ToString(formatProvider);

  return string.Format(
                      formatProvider,
                      "Red:{1} Green:{2} Blue:{3}",
                      R.ToString(format, formatProvider),
                      G.ToString(format, formatProvider),
                      B.ToString(format, formatProvider));
}

Xenko

V3025 Incorrect format. A different number of format items is expected while calling 'Format' function. Expected: 1. Present: 2. SiliconStudio.Core.Design NamingHelper.cs 56


public static bool IsValidNamespace(
                            string text, out string error)
{
  ....
  error = items.Where(s => !IsIdentifier(s))
               .Select(item =>
                            string.Format("[{0}]", item, text))
               .FirstOrDefault();
  ....
}

Unity3D

V3025 Incorrect format. A different number of format items is expected while calling 'WriteLine' function. Arguments not used: port. AssetBundleDemo AssetBundleServer.cs 59


public static void Main(string[] args)
{
  ....
  Console.WriteLine("Starting up asset bundle server.", port);
  ....
}

MSBuild

V3025 Incorrect format. A different number of format items is expected while calling 'WriteLine' function. Arguments not used: 1st. Scheduler.cs 2216


private void DumpSchedulerState()
{
  ....
  file.WriteLine("Scheduler state at timestamp {0}:",
    _schedulingData.EventTime.Ticks);
  file.WriteLine("--------------------------------------------",
    _schedulingData.EventTime.Ticks);  // <=
  ....
}

Similar errors can be found in some other places:

  • V3025 Incorrect format. A different number of format items is expected while calling 'Format' function. Arguments not used: resource. XmlUtil.cs 75
  • V3025 Incorrect format. A different number of format items is expected while calling 'Format' function. Arguments not used: resource. XmlUtil.cs 82
  • V3025 Incorrect format. A different number of format items is expected while calling 'Format' function. Arguments not used: resource. XmlUtil.cs 91
  • And 1 additional diagnostic messages.

Mono

V3025 Incorrect format. A different number of format items is expected while calling 'Format' function. Arguments not used: url. corlib-net_4_x RemotingServices.cs 700


static IMessageSink GetClientChannelSinkChain(string url, ....)
{
  ....
  if (url != null)
  {
    string msg = String.Format (
      "Cannot create channel sink to connect to URL {0}.
       An appropriate channel has probably not been registered.",
      url);
    throw new RemotingException (msg);
  }
  else
  {
    string msg = String.Format (
      "Cannot create channel sink to connect
       to the remote object.
       An appropriate channel has probably not been registered.",
      url);
    throw new RemotingException (msg);
  }
  ....
}

Mono

V3025 Incorrect format. A different number of format items is expected while calling 'Format' function. Arguments not used: text. System.Windows.Forms-net_4_x ListViewItem.cs 1287


public override string ToString ()
{
  return string.Format ("ListViewSubItem {{0}}", text);
}

Mono

V3025 Incorrect format. A different number of format items is expected while calling 'Format' function. Format items not used: {2}. Arguments not used: 1st. System.ServiceModel-net_4_x WSTrustMessageConverters.cs 147


void ReadEntropy ()
{
  if (reader.IsEmptyElement)
    throw new XmlException (
      String.Format ("WS-Trust Entropy element is empty.{2}",
                      LineInfo ()));
  ....
}

GitExtensions

V3025 Incorrect format. A different number of format items is expected while calling 'WriteLine' function. Arguments not used: pluginFile.Name. GitUI LoadPlugins.cs 35


public static void Load()
{
  ....
  Debug.WriteLine("Loading plugin...", pluginFile.Name); // <=
  ....
}

Umbraco

V3025 Incorrect format. A different number of format items is expected while calling 'Format' function. Format items not used: {1}. Arguments not used: 1st. HtmlHelperRenderExtensions.cs 938


public static IHtmlString EnableCanvasDesigner(....)
{
  ....
  string noPreviewLinks = @"<link href=""{1}"" type=
    ""text/css"" rel=""stylesheet"
    " data-title=""canvasdesignerCss"" />";
  ....
  if (....)
    result = string.Format(noPreviewLinks, cssPath) +
             Environment.NewLine;
  ....
}

Similar errors can be found in some other places:

  • V3025 Incorrect format. A different number of format items is expected while calling 'Format' function. Format items not used: {1}. Arguments not used: 1st. HtmlHelperRenderExtensions.cs 946
  • V3025 Incorrect format. A different number of format items is expected while calling 'Format' function. Arguments not used: path. requestModule.cs 204
  • V3025 Incorrect format. A different number of format items is expected while calling 'Format' function. Arguments not used: Alias.Replace(" ", ""). Template.cs 382
  • And 2 additional diagnostic messages.

Unity C# reference source code

V3025 CWE-685 Incorrect format. A different number of format items is expected while calling 'Format' function. Arguments not used: index. Physics2D.bindings.cs 2823


public void SetPath(....)
{
  if (index < 0)
    throw new ArgumentOutOfRangeException(
      String.Format("Negative path index is invalid.", index));
  ....
}

AWS SDK for .NET

V3025 [CWE-685] Incorrect format. A different number of format items is expected while calling 'Format' function. Arguments not used: AWSConfigs.AWSRegionKey. AWSSDK.Core.Net45 AWSRegion.cs 116


public InstanceProfileAWSRegion()
{
  ....
  if (region == null)
  {
    throw new InvalidOperationException(
      string.Format(CultureInfo.InvariantCulture,
        "EC2 instance metadata was not available or did not contain
          region information.",
        AWSConfigs.AWSRegionKey));
  }
  ....
}

Azure PowerShell

V3025 Incorrect format. A different number of format items is expected while calling 'Format' function. Arguments not used: this.ResourceGroupName. NewScheduledQueryRuleCommand.cs 117


protected override void ProcessRecordInternal()
{
  ....
  if (this.ShouldProcess(this.Name,
    string.Format("Creating Log Alert Rule '{0}' in resource group {0}",
      this.Name, this.ResourceGroupName)))
  {
    ....
  }
  ....
}

Similar errors can be found in some other places:

  • V3025 Incorrect format. A different number of format items is expected while calling 'Format' function. Arguments not used: this.ResourceGroupName. RemoveScheduledQueryRuleCommand.cs 88

ILSpy

V3025 Incorrect format. A different number of format items is expected while calling 'Format' function. Arguments not used: End. ICSharpCode.Decompiler Interval.cs 269


public override string ToString()
{
  if (End == long.MinValue)
  {
    if (Start == long.MinValue)
      return string.Format("[long.MinValue..long.MaxValue]", End); // <=
    else
      return string.Format("[{0}..long.MaxValue]", Start);
  }
  else if (Start == long.MinValue)
  {
    return string.Format("[long.MinValue..{0})", End);
  }
  else
  {
    return string.Format("[{0}..{1})", Start, End);
  }
}

ILSpy

V3025 Incorrect format. A different number of format items is expected while calling 'AppendFormat' function. Arguments not used: angle. ILSpy.BamlDecompiler XamlPathDeserializer.cs 177


public static string Deserialize(BinaryReader reader)
{
  ....
  var sb = new StringBuilder();
  ....
  sb.AppendFormat(CultureInfo.InvariantCulture,
                  "A{0} {2:R} {2} {3} {4}",
                  size, angle, largeArc ? '1' : '0',
                  sweepDirection ? '1' : '0', pt1);
  ....
}

PeachPie

V3025 Incorrect format. A different number of format items is expected while calling 'WriteLine' function. Arguments not used: 1st, 2nd, 3rd, 4th, 5th. Mail.cs 25


public static void WriteLine(string format, params object[] args);

public static bool mail(....)
{
  // to and subject cannot contain newlines, replace with spaces
  to = (to != null) ? to.Replace("\r\n", " ").Replace('\n', ' ') : "";
  subject = (subject != null) ? subject.Replace("\r\n", " ").Replace('\n', ' ')
                              : "";

  Debug.WriteLine("MAILER",
                  "mail('{0}','{1}','{2}','{3}')",
                  to,
                  subject,
                  message,
                  additional_headers);

  var config = ctx.Configuration.Core;

  ....
}

This website uses cookies and other technology to provide you a more personalized experience. By continuing the view of our web-pages you accept the terms of using these files. If you don't want your personal data to be processed, please, leave this site.
Learn More →
Accept