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 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 V306…

Examples of errors detected by the V3061 diagnostic

V3061. Parameter 'A' is always rewritten in method body before being used.


Xenko

V3061 Parameter 'internalEvent' is always rewritten in method body before being used. SiliconStudio.Xenko ParameterCollection.cs 1158


internal delegate void InternalValueChangedDelegate(
  InternalValue internalValue, object oldValue);

private static InternalValueChangedDelegate
CreateInternalValueChangedEvent(
  ParameterKey key,
  InternalValueChangedDelegate internalEvent,
  ValueChangedDelegate originalEvent)
{
    internalEvent = (internalValue, oldValue) =>
      originalEvent(key, internalValue, oldValue);
    return internalEvent;
}

Xenko

V3061 Parameter 'libraryData' is always rewritten in method body before being used. SiliconStudio.TextureConverter DxtTexLib.cs 213


private void Load(TexImage image,
                         DxtTextureLibraryData libraryData,
                         LoadingRequest loader)
{
  ....
  libraryData = new DxtTextureLibraryData(); // <=
  image.LibraryData[this] = libraryData;

  libraryData.Image = new ScratchImage();
  ....
}

Similar errors can be found in some other places:

  • V3061 Parameter 'libraryData' is always rewritten in method body before being used. SiliconStudio.TextureConverter FITexLib.cs 244

Accord.Net

V3061 Parameter 'mode' is always rewritten in method body before being used. Accord.Statistics TriangularDistribution.cs 646


private static double WeightedMode(double[] observations,
                                   double[] weights,
                                   double mode,
                                   int imax,
                                   int imin)
{
  ....
  var bestValue = currentValue;
  ....
  mode = bestValue;
  return mode;
}

Similar errors can be found in some other places:

  • V3061 Parameter 'mode' is always rewritten in method body before being used. Accord.Statistics TriangularDistribution.cs 678
  • V3061 Parameter 'mode' is always rewritten in method body before being used. Accord.Statistics TriangularDistribution.cs 706
  • V3061 Parameter 'mode' is always rewritten in method body before being used. Accord.Statistics TriangularDistribution.cs 735

Old NASA World Wind (C#)

V3061 Parameter 'fDistance' is always rewritten in method body before being used. GPSTrackerPlugin.WorldWind.cs 1667


void ShowInfo(.... , float fDistance )
{
  ....
  if (m_fTotalDistance>=0F)
  {
    string sUnit=(m_fTotalDistance>=1F)?"km":"m";
    fDistance = (m_fTotalDistance < 1F) ?
                (m_fTotalDistance * 1000F) :
                 m_fTotalDistance;
    sInfo += "Track Distance: " +
              Convert.ToString(
               decimal.Round(
                Convert.ToDecimal(fDistance),3)) +
              sUnit +
              "\n";
  }
  ....
}

MSBuild

V3061 Parameter 'numericValue' is always rewritten in method body before being used. NodePacketTranslator.cs 320


public void TranslateEnum<T>(ref T value, int numericValue)
{
  numericValue = _reader.ReadInt32();  // <=
  Type enumType = value.GetType();
  value = (T)Enum.ToObject(enumType, numericValue);
}

Similar errors can be found in some other places:

  • V3061 Parameter 'defaultToolsVersion' is always rewritten in method body before being used. ToolsetProvider.cs 118

Mono

V3061 Parameter 'errorInfo' is always rewritten in method body before being used. corlib-net_4_x Marshal.cs 1552


internal static int SetErrorInfo (int dwReserved,
                                  IErrorInfo errorInfo)
{
  int retVal = 0;
  errorInfo = null;  // <=

  ....
  retVal = _SetErrorInfo (dwReserved, errorInfo);
  ....
}

.NET Core Libraries (CoreFX)

V3061 Parameter 'docPos' is always rewritten in method body before being used. CanonicalXmlDocument.cs 37


public void Write(StringBuilder strBuilder,
                  DocPosition docPos,
                  AncestralNamespaceContextManager anc)
{
  docPos = DocPosition.BeforeRootElement; // <=
  foreach (XmlNode childNode in ChildNodes)
  {
    if (childNode.NodeType == XmlNodeType.Element)
    {
      ....
      docPos = DocPosition.AfterRootElement;
    }
    else
    {
      CanonicalizationDispatcher.Write(
        childNode, strBuilder, docPos, anc); // <=
    }
  }
}

Similar errors can be found in some other places:

  • V3061 Parameter 'docPos' is always rewritten in method body before being used. CanonicalXmlDocument.cs 54

Telerik UI for UWP

V3061 Parameter 'index' is always rewritten in method body before being used. DataEngine.cs 1443


private static Tuple<Group, int> FindGroupAndItemIndex(.... int index, ....)
{
  if (exhaustiveSearch)
  {
    ....
  }
  else
  {
    var aggregateRowGroup = rowRootGroup;
    var rowGroupNames = valueProvider.GetRowGroupNames(item);
    foreach (var groupName in rowGroupNames)
    {
      Group group;
      if (aggregateRowGroup.TryGetGroup(groupName, out group))
      {
        aggregateRowGroup = group;
      }
    }

    index = aggregateRowGroup.IndexOf(item, valueProvider.GetSortComparer());

    return Tuple.Create(aggregateRowGroup, index);
  }
}

RavenDB

V3061 Parameter 'numberOfResults' is always rewritten in method body before being used. DocumentHandler.cs(273), DocumentHandler.cs(267) Raven.Server


private async Task<int> WriteDocumentsJsonAsync(...., int numberOfResults)
{
  using (
    var writer = new AsyncBlittableJsonTextWriter(
      context,
      ResponseBodyStream(),
      Database.DatabaseShutdown
    )
  )
  {
    writer.WriteStartObject();
    writer.WritePropertyName(nameof(GetDocumentsResult.Results));
    numberOfResults = await writer.WriteDocumentsAsync(            // <=
      context,
      documentsToWrite,
      metadataOnly
    );

    ....
  }
  return numberOfResults;
}

QuantConnect Lean

V3061 Parameter 'array' is always rewritten in method body before being used. SecurityPortfolioManager.cs 192


public void CopyTo(KeyValuePair<Symbol, SecurityHolding>[] array, int index)
{
  array = new KeyValuePair<Symbol, SecurityHolding>[Securities.Count];
  var i = 0;
  foreach (var asset in Securities)
  {
    if (i >= index)
    {
      array[i] = new KeyValuePair<Symbol,SecurityHolding>(asset.Key,
                                                          asset.Value.Holdings);
    }
    i++;
  }
}

Ryujinx

V3061 Parameter 'instruction' is always rewritten in method body before being used. EndConditionalBlock.cs 18


public static void Emit(byte[] instruction, CompilationContext context)
{
    // 20000000

    // Use the conditional begin instruction stored in the stack.
    instruction = context.CurrentBlock.BaseInstruction;
    ....
}

PeachPie

V3061 Parameter 'mode' is always rewritten in method body before being used. Ftp.cs 306


private static bool Put(Context context,
                        PhpResource ftp_stream,
                        string remote_file,
                        string local_file,
                        int mode,
                        bool append,
                        int startpos)
{ .... }

public static bool ftp_put(Context context,
                           PhpResource ftp_stream,
                           string remote_file,
                           string local_file,
                           int mode = FTP_IMAGE,
                           int startpos = 0)
{
    return Put(context,
               ftp_stream,
               remote_file,
               local_file,
               mode = FTP_IMAGE, // <=
               false,
               startpos);
}

Unity C# reference source code

V3061 Parameter 'namedBuildTarget' is always rewritten in method body before being used. PlayerSettingsIconsEditor.cs 396


public void IconSectionGUI(NamedBuildTarget namedBuildTarget,....)
{
  ....
  if (platformUsesStandardIcons)
  {
    var selectedDefault = (m_SelectedPlatform < 0);
    // Set default platform variables
    BuildPlatform platform = null;
    namedBuildTarget = NamedBuildTarget.Standalone;
    ....
  }
  ....
}

BTCPay Server

V3061 Parameter 'storeId' is always rewritten in method body before being used. BTCPayServer\Controllers\UIStoresController.cs 890


[HttpPost("{storeId}/tokens/create")]
public async Task<IActionResult> CreateToken(string storeId, ....)
{
    if (!ModelState.IsValid)
    {
        return View(nameof(CreateToken), model);
    }
    model.Label = model.Label ?? String.Empty;
    var userId = GetUserId();
    if (userId == null)
        return Challenge(AuthenticationSchemes.Cookie);
    storeId = model.StoreId; // <=
    ....
}