Examples of errors detected by the V3066 diagnostic

V3066. Possible incorrect order of arguments passed to method.


FlashDevelop

V3066 Possible incorrect order of arguments passed to '_channelMixer_OVERLAY' method: 'back' and 'fore'. BBCodeStyle.cs 302


static float _channelMixer_OVERLAY(float back, float fore)
{
  ....
}

private static float _channelMixer_HARDLIGHT(float back,
  float fore)
{
  return _channelMixer_OVERLAY(fore, back);
}

Media Portal 2

V3066 Possible incorrect order of arguments passed to 'TryCreateMultimediaCDDriveHandler' method. RemovableMediaManager.cs 109


public static MultimediaDriveHandler
TryCreateMultimediaCDDriveHandler(DriveInfo driveInfo,
  IEnumerable<Guid> videoMIATypeIds,
  IEnumerable<Guid> imageMIATypeIds, // <=
  IEnumerable<Guid> audioMIATypeIds) // <=
  { .... }

protected void ExamineVolume(string drive)
{
  ....
  MultimediaDriveHandler.TryCreateMultimediaCDDriveHandler(
    driveInfo,
    Consts.NECESSARY_VIDEO_MIAS,
    Consts.NECESSARY_AUDIO_MIAS, // <=
    Consts.NECESSARY_IMAGE_MIAS) // <=
  ....
}

'NECESSARY_AUDIO_MIAS' and 'NECESSARY_IMAGE_MIAS' has incorrect order passed to 'TryCreateMultimediaCDDriveHandler' method.


.NET Core Libraries (CoreFX)

V3066 Possible incorrect order of arguments passed to 'SerializationHeaderRecord' constructor: 'minorVersion' and 'majorVersion'. BinaryFormatterWriter.cs 111


internal void WriteSerializationHeader(
  int topId,
  int headerId,
  int minorVersion,
  int majorVersion)
{
  var record = new SerializationHeaderRecord(
                     BinaryHeaderEnum.SerializedStreamHeader,
                     topId,
                     headerId,
                     minorVersion,  // <=
                     majorVersion); // <=
  record.Write(this);
}

internal SerializationHeaderRecord(
  BinaryHeaderEnum binaryHeaderEnum,
  int topId,
  int headerId,
  int majorVersion, // <=
  int minorVersion) // <=
{
  _binaryHeaderEnum = binaryHeaderEnum;
  _topId = topId;
  _headerId = headerId;
  _majorVersion = majorVersion;
  _minorVersion = minorVersion;
}

Azure PowerShell

V3066 Possible incorrect order of arguments passed to 'PersistSyncServerRegistration' method: 'storageSyncServiceUid' and 'discoveryUri'. EcsManagementInteropClient.cs 364


public class EcsManagementInteropClient : IEcsManagement
{
  ....
  public int PersistSyncServerRegistration(....)
  {
    return m_managementObject.PersistSyncServerRegistration(
      serviceUri,
      subscriptionId,
      storageSyncServiceName,
      resourceGroupName,
      clusterId,
      clusterName,
      storageSyncServiceUid,  // <=
      discoveryUri,           // <=
      serviceLocation,
      resourceLocation);
  }
  ....
}

public interface IEcsManagement : IDisposable
{
  ....
  int PersistSyncServerRegistration(
    [In, MarshalAs(UnmanagedType.BStr)]
    string serviceUri,
    [In, MarshalAs(UnmanagedType.BStr)]
    string subscriptionId,
    [In, MarshalAs(UnmanagedType.BStr)]
    string storageSyncServiceName,
    [In, MarshalAs(UnmanagedType.BStr)]
    string resourceGroupName,
    [In, MarshalAs(UnmanagedType.BStr)]
    string clusterId,
    [In, MarshalAs(UnmanagedType.BStr)]
    string clusterName,
    [In, MarshalAs(UnmanagedType.BStr)]
    string discoveryUri,                  // <=
    [In, MarshalAs(UnmanagedType.BStr)]
    string storageSyncServiceUid,         // <=
    [In, MarshalAs(UnmanagedType.BStr)]
    string serviceLocation,
    [In, MarshalAs(UnmanagedType.BStr)]
    string resourceLocation);
  ....
}

Telerik UI for UWP

V3066 Possible incorrect order of arguments passed to 'NotifyCollectionChangedEventArgs' constructor: 'oldItem' and 'newItem'. CheckedItemsCollection.cs 470


public NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction action,
                                        object newItem, // <=
                                        object oldItem, // <=
                                        int index);

public class CheckedItemsCollection<T> : IList<T>, INotifyCollectionChanged
{
  ....
  private NotifyCollectionChangedEventArgs GenerateArgs(....)
  {
    switch (action)
    {
      case NotifyCollectionChangedAction.Add:
        ....

      case NotifyCollectionChangedAction.Remove:
        ....

      case NotifyCollectionChangedAction.Replace:
        return new NotifyCollectionChangedEventArgs(action,
                                                    oldItem, // <=
                                                    newItem, // <=
                                                    changeIndex);

      default:
        return new NotifyCollectionChangedEventArgs(action);
    }
  }
}

OpenCvSharp

V3066 Possible incorrect order of arguments passed to 'calib3d_Rodrigues_MatToVec' method: 'matrixM.CvPtr' and 'vectorM.CvPtr'. Cv2_calib3d.cs 86


public static void Rodrigues(double[,] matrix, out double[] vector,
  out double[,] jacobian)
{
  ....
  using (var jacobianM = new Mat<double>())
  {
    NativeMethods.calib3d_Rodrigues_MatToVec
      (matrixM.CvPtr, vectorM.CvPtr,
       jacobianM.CvPtr);
    ....
  }
}

public static extern void calib3d_Rodrigues_MatToVec(
  IntPtr vector, IntPtr matrix, IntPtr jacobian)

Azure SDK for .NET

V3066 Possible incorrect order of arguments passed to 'EventHubConsumer' constructor: 'partitionId' and 'consumerGroup'. TrackOneEventHubClient.cs 394


public override EventHubConsumer CreateConsumer(....)
{
  return new EventHubConsumer
  (
    new TrackOneEventHubConsumer(....),
    TrackOneClient.EventHubName,
    partitionId,                  // <= 3
    consumerGroup,                // <= 4
    eventPosition,
    consumerOptions,
    initialRetryPolicy
  );
}
....
internal EventHubConsumer(TransportEventHubConsumer transportConsumer,
                          string eventHubName,
                          string consumerGroup,         // <= 3
                          string partitionId,           // <= 4
                          EventPosition eventPosition,
                          EventHubConsumerOptions consumerOptions,
                          EventHubRetryPolicy retryPolicy)
{
  ....
}

AvaloniaUI

V3066 Possible incorrect order of arguments passed to 'SelectionChangedEventArgs' constructor: 'removedSelectedItems' and 'addedSelectedItems'. DataGridSelectedItemsCollection.cs 338


internal SelectionChangedEventArgs GetSelectionChangedEventArgs()
{
  ....
  return new SelectionChangedEventArgs
    (DataGrid.SelectionChangedEvent,
     removedSelectedItems,
     addedSelectedItems)
      {
        Source = OwningGrid
      };
}

AvaloniaUI

V3066 Possible incorrect order of arguments passed to 'SelectionChangedEventArgs' constructor: 'removed' and 'added'. AutoCompleteBox.cs 707


OnSelectionChanged(new SelectionChangedEventArgs(SelectionChangedEvent,
                                                 removed,
                                                 added));

AvaloniaUI

V3066: Possible incorrect order of arguments passed to 'ItemsRepeaterElementIndexChangedEventArgs' constructor: 'oldIndex' and 'newIndex'. ItemsRepeater.cs 532


internal void OnElementIndexChanged(IControl element,
                                    int oldIndex,
                                    int newIndex)
{
  if (ElementIndexChanged != null)
  {
    if (_elementIndexChangedArgs == null)
    {
      _elementIndexChangedArgs =
         new ItemsRepeaterElementIndexChangedEventArgs(element,
                                                       oldIndex,
                                                       newIndex);
    }
    else
    {
       _elementIndexChangedArgs.Update(element, oldIndex, newIndex);
    }
    ....
  }
}

AvaloniaUI

V3066: Possible incorrect order of arguments passed to 'ItemsRepeaterElementIndexChangedEventArgs' constructor: 'oldIndex' and 'newIndex'. ItemsRepeater.cs 536


internal void OnElementIndexChanged(IControl element,
                                    int oldIndex,
                                    int newIndex)
{
  if (ElementIndexChanged != null)
  {
    if (_elementIndexChangedArgs == null)
    {
      _elementIndexChangedArgs =
         new ItemsRepeaterElementIndexChangedEventArgs(element,
                                                       oldIndex,
                                                       newIndex);
    }
    else
    {
       _elementIndexChangedArgs.Update(element, oldIndex, newIndex);
    }
    ....
  }
}

osu!

V3066 [CWE-683] Possible incorrect order of arguments passed to 'Atan2' method: 'diff.X' and 'diff.Y'. SliderBall.cs 182


public void UpdateProgress(double completionProgress)
{
  ....
  Rotation = -90 + (float)(-Math.Atan2(diff.X, diff.Y) * 180 / Math.PI);
  ....
}

// Parameters:
//   y:
//     The y coordinate of a point.
//
//   x:
//     The x coordinate of a point.
public static double Atan2(double y, double x);

RunUO

V3066 Possible incorrect order of arguments passed to 'OnSwing' method: 'defender' and 'attacker'. BaseWeapon.cs 1188


public virtual int AbsorbDamageAOS( Mobile attacker,
                                    Mobile defender,
                                    int damage )
{
  ....
  if ( weapon != null )
  {
    defender.FixedParticles(0x3779,
                            1,
                            15,
                            0x158B,
                            0x0,
                            0x3,
                            EffectLayer.Waist);
    weapon.OnSwing( defender, attacker );
  }
  ....
}

public virtual TimeSpan OnSwing( Mobile attacker, Mobile defender )
{
  return OnSwing( attacker, defender, 1.0 );
}


Bugs Found

Checked Projects
377
Collected Errors
13 692