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);
}
ML.NET
V3066 Possible incorrect order of arguments passed to method. ProgressReporter.cs 148
private IProgressChannel StartProgressChannel(int level)
{
var newId = Interlocked.Increment(ref _maxSubId);
return new SubChannel(this, level, newId);
}
ML.NET
V3066 Possible incorrect order of arguments passed to 'AllocateModelMemory' method: 'numVocab' and 'numTopic'. LdaSingleBox.cs 142
internal sealed class LdaSingleBox : IDisposable
{
....
public void AllocateModelMemory(int numTopic, int numVocab, ....)
{
....
LdaInterface.AllocateModelMemory(...., numVocab, numTopic, ....); // <=
}
....
}
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 );
}
RavenDB
V3066 Possible incorrect order of arguments passed to 'ValidateLicense' method: 'newLicense' and 'oldLicense'. LicenseHelper.cs(177) Raven.Server
private static void UpdateEnvironmentVariableLicenseString(....)
{
....
if (ValidateLicense(newLicense, rsaParameters, oldLicense) == false)
return;
....
}
private static bool ValidateLicense(
License oldLicense,
RSAParameters rsaParameters,
License newLicense
)
{
....
}
DotNetNuke
V3066 Possible incorrect order of arguments passed to 'Journal_Save' method: 'journalItem.CommentsDisabled' and 'journalItem.CommentsHidden'. JournalControllerImpl.cs 125
int Journal_Update(int portalId,
int currentUserId,
int profileId,
int groupId,
int journalId,
int journalTypeId,
string title,
string summary,
string body,
string itemData,
string xml,
string objectKey,
Guid accessKey,
string securitySet,
bool commentsHidden, // <=
bool commentsDisabled); // <=
public void SaveJournalItem(JournalItem journalItem, int tabId, int moduleId)
{
....
journalItem.JournalId = this._dataService.Journal_Save(
journalItem.PortalId,
journalItem.UserId,
journalItem.ProfileId,
journalItem.SocialGroupId,
journalItem.JournalId,
journalItem.JournalTypeId,
journalItem.Title,
journalItem.Summary,
journalItem.Body,
journalData,
xml,
journalItem.ObjectKey,
journalItem.AccessKey,
journalItem.SecuritySet,
journalItem.CommentsDisabled, // <=
journalItem.CommentsHidden); // <=
....
}
public void UpdateJournalItem(JournalItem journalItem, int tabId, int moduleId)
{
....
journalItem.JournalId = this._dataService.Journal_Update(
journalItem.PortalId,
journalItem.UserId,
journalItem.ProfileId,
journalItem.SocialGroupId,
journalItem.JournalId,
journalItem.JournalTypeId,
journalItem.Title,
journalItem.Summary,
journalItem.Body,
journalData,
xml,
journalItem.ObjectKey,
journalItem.AccessKey,
journalItem.SecuritySet,
journalItem.CommentsDisabled, // <=
journalItem.CommentsHidden); // <=
....
}
Similar errors can be found in some other places:
- V3066 Possible incorrect order of arguments passed to 'Journal_Update' method: 'journalItem.CommentsDisabled' and 'journalItem.CommentsHidden'. JournalControllerImpl.cs 253
Umbraco
V3066 Possible incorrect order of arguments passed to 'RelationType' constructor. RelateOnCopyNotificationHandler.cs 32
public void Handle(ContentCopiedNotification notification)
{
....
if (relationType == null)
{
relationType = new RelationType(
Constants.Conventions.RelationTypes.RelateDocumentOnCopyAlias,
Constants.Conventions.RelationTypes.RelateDocumentOnCopyName,
true,
Constants.ObjectTypes.Document,
Constants.ObjectTypes.Document);
_relationService.Save(relationType);
}
....
}
.NET 6 libraries
V3066 Possible incorrect order of arguments passed to 'XsltException' constructor: '_linePosition' and '_lineNumber'. Compiler.cs 1187
internal XsltException(string res,
string?[] args,
string? sourceUri,
int lineNumber,
int linePosition,
Exception? inner) : base(....)
{ .... }
public override void CheckErrors()
{
throw new XsltException(SR.Xslt_InvalidXPath,
new string[] { Expression },
_baseUri,
_linePosition,
_lineNumber,
null);
}
Discord.NET
V3066 Possible incorrect order of arguments passed to 'FollowupWithFileAsync' method: 'text' and 'fileName'. RestInteraction.cs 434
async Task<IUserMessage> IDiscordInteraction
.FollowupWithFileAsync(string filePath,
string text,
string fileName,
....)
=> await FollowupWithFileAsync(filePath,
text, // <=
filename, // <=
....).ConfigureAwait(false);
/// <summary>
/// Sends a followup message for this interaction.
/// </summary>
/// <param name="text">The text of the message to be sent.</param>
/// <param name="filePath">The file to upload.</param>
/// <param name="fileName">The file name of the attachment.</param>
....
public abstract Task<RestFollowupMessage>
FollowupWithFileAsync(string filePath,
string fileName = null, // <=
string text = null, // <=
....);
.NET 7
V3066 Possible incorrect order of arguments passed to 'XmlConfigurationElementTextContent' constructor: 'lineNumber' and 'linePosition'. XmlStreamConfigurationProvider.cs 133
public XmlConfigurationElementTextContent(string textContent,
int? linePosition, // <=
int? lineNumber) // <=
{ .... }
public static IDictionary<string, string?> Read(....)
{
....
case XmlNodeType.EndElement:
....
var lineInfo = reader as IXmlLineInfo;
var lineNumber = lineInfo?.LineNumber;
var linePosition = lineInfo?.LinePosition;
parent.TextContent
= new XmlConfigurationElementTextContent(string.Empty,
lineNumber, // <=
linePosition); // <=
....
break;
....
case XmlNodeType.Text:
....
var lineInfo = reader as IXmlLineInfo;
var lineNumber = lineInfo?.LineNumber;
var linePosition = lineInfo?.LinePosition;
XmlConfigurationElement parent = currentPath.Peek();
parent.TextContent
= new XmlConfigurationElementTextContent(reader.Value,
lineNumber, // <=
linePosition); // <=
....
break;
....
}
Similar errors can be found in some other places:
- V3066 Possible incorrect order of arguments passed to 'XmlConfigurationElementTextContent' constructor: 'lineNumber' and 'linePosition'. XmlStreamConfigurationProvider.cs 148
.NET 7
V3066 Possible incorrect order of arguments passed to 'ConfigurationDebugViewContext' constructor: 'child.Key' and 'child.Path'. ConfigurationRootExtensions.cs 50
public ConfigurationDebugViewContext(
string path, // <=
string key, // <=
string? value,
IConfigurationProvider configurationProvider)
{ .... }
void RecurseChildren(....)
{
....
string? value
= processValue != null
? processValue(new ConfigurationDebugViewContext(
child.Key, // <=
child.Path, // <=
valueAndProvider.Value,
valueAndProvider.Provider))
: valueAndProvider.Value;
....
}
Ryujinx
V3066 Possible incorrect order of arguments passed to 'CtorVtableSpecialName' constructor: 'secondType' and 'firstType'. Demangler.cs 803
public CtorVtableSpecialName(BaseNode firstType, BaseNode secondType) :
base(NodeType.CtorVtableSpecialName)
{
_firstType = firstType;
_secondType = secondType;
}
private BaseNode ParseSpecialName(....)
{
switch (....)
{
case 'C':
_position += 2;
BaseNode firstType = ParseType();
if ( firstType == null
|| ParseNumber(true).Length == 0
|| !ConsumeIf("_"))
{
return null;
}
BaseNode secondType = ParseType();
return new CtorVtableSpecialName(secondType, firstType); // <=
}
}
ScreenToGif
V3066 Possible incorrect order of arguments passed to 'ConvertRgbToHsv' method: 'theColor.G' and 'theColor.B'. ColorSelector.xaml.cs 247
private void UpdateMarkerPosition(Color theColor)
{
....
var hsv = ColorExtensions.ConvertRgbToHsv( theColor.R,
theColor.G,
theColor.B);
....
}
public static HsvColor ConvertRgbToHsv( int r,
int b,
int g)
{
....
}