You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
MethodMember.Parameters doesn't return the expected amount of entries when having the same type for parameters #447
I was writing a Custom condition (ICondition<IType>), which validates the existence of a constructor with exactly one parameter having an expected type.
Expectation:
The constructor.Parameters returns an IEnumerable<IType> containing the types of all parameters.
However, analyzing types with multiple parameter having the same type, results in only returning one entry in the property Parameters.
// Analyzing the following type returns one entry in the Parameters Enumerable [IType: UInt32]internalsealedrecordSignatureOne(uintSignature);// Analyzing the following type returns two entries in the Parameters Enumerable [IType: UInt32, IType: String]internalsealedrecordSignatureCustom(uintSignature,stringSignatureString);// ERROR: Analyzing the following type returns only one entry in the Parameters Enumerable [IType: UInt32]internalsealedrecordSignatureTwo(uintSignature,uintSignatureTwo);
Hi @Gorphi, this is on purpose in so far as this has not been a use case of this library in the past. I've created a PR that ensures the parameters stored for a method are not deduplicated for the type itself, but only when instantiating the dependencies.
Activity
Gorphi commentedon Jan 23, 2026
I think I found the potential cause for this in MonoCecilMemberExtensions.GetParameters and MonoCecilMemberExtensions.GetGenericParameters.
Maybe this behaviour is on purpose?
alexanderlinne commentedon Mar 2, 2026
Hi @Gorphi, this is on purpose in so far as this has not been a use case of this library in the past. I've created a PR that ensures the parameters stored for a method are not deduplicated for the type itself, but only when instantiating the dependencies.
Gorphi commentedon Mar 6, 2026
v0.13.3 works like a charm. 🚀
ty for your fast response.