Earlier, I found some places in .NET 7 where the order of arguments was incorrect. Here are the issues: #78306, #78212
I found one more place. However, I'm not sure whether this is an error or not.
....
Debug.Assert(ChildTable != null, "On a DataSet, but not on Table. Bad state");
ForeignKeyConstraint? constraint = ChildTable.Constraints.FindForeignKeyConstraint(ChildKey.ColumnsReference, ParentKey.ColumnsReference); // <=
constraint?.CheckConstraint();
....
}
The first parameter is parentColumns and the second one is childColumns. In the method call mentioned above the first argument is ChildKey.ColumnsReference and the second one is the ParentKey.ColumnsReference.
So, the arguments order is Child..., Parent... whereas the parameters order is parent..., child....
Is the reversed order of arguments an error, or is this code fragment correct?
Tagging subscribers to this area: @roji, @ajcvickers
See info in area-owners.md if you want to be subscribed.
Issue Details
Earlier, I found some places in .NET 7 where the order of arguments was incorrect. Here are the issues: #78145, #78306, #78212
I found one more place. However, I'm not sure whether this is an error or not.
```csharp
....
Debug.Assert(ChildTable != null, "On a DataSet, but not on Table. Bad state");
ForeignKeyConstraint? constraint = ChildTable.Constraints.FindForeignKeyConstraint(ChildKey.ColumnsReference, ParentKey.ColumnsReference); // <=
constraint?.CheckConstraint();
....
}
```
[Link to the sources](https://github.com/dotnet/runtime/blob/d099f075e45d2aa6007a22b71b45a08758559f80/src/libraries/System.Data.Common/src/System/Data/DataRelation.cs#L486)
The `FindForeignKeyConstraint` method's definition:
```csharp
ForeignKeyConstraint? FindForeignKeyConstraint(DataColumn[] parentColumns, DataColumn[] childColumns)
```
[Link to the sources](https://github.com/dotnet/runtime/blob/d099f075e45d2aa6007a22b71b45a08758559f80/src/libraries/System.Data.Common/src/System/Data/ConstraintCollection.cs#L548)
The first parameter is `parentColumns` and the second one is `childColumns`. In the method call mentioned above the first argument is `ChildKey.ColumnsReference` and the second one is the `ParentKey.ColumnsReference`.
So, the arguments order is `Child...`, `Parent...` whereas the parameters order is `parent...`, `child...`.
Is the reversed order of arguments an error, or is this code fragment correct?
Earlier, I found some places in .NET 7 where the order of arguments was incorrect. Here are the issues: #78306, #78212
I found one more place. However, I'm not sure whether this is an error or not.
Link to the sources
The
FindForeignKeyConstraint
method's definition:Link to the sources
The first parameter is
parentColumns
and the second one ischildColumns
. In the method call mentioned above the first argument isChildKey.ColumnsReference
and the second one is theParentKey.ColumnsReference
.So, the arguments order is
Child...
,Parent...
whereas the parameters order isparent...
,child...
.Is the reversed order of arguments an error, or is this code fragment correct?