Skip to content

Obsolete TestMethodIdentifierProperty constructor and add new constructor with arity parameter #5516

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Youssef1313 opened this issue Apr 25, 2025 · 3 comments · Fixed by #5528
Assignees
Labels
Area: MTP Belongs to the Microsoft.Testing.Platform core library

Comments

@Youssef1313
Copy link
Member

Today, TestMethodIdentifierProperty is declared as:

public sealed record TestMethodIdentifierProperty(string AssemblyFullName, string Namespace, string TypeName, string MethodName, string[] ParameterTypeFullNames, string ReturnTypeFullName) : IProperty

This doesn't have a good place to specify arity. I suggest obsoleting the current constructor (but keeping it for binary compatibility), and add another constructor with int arity parameter.

So, for a method like:

namespace MyNamespace1.MyNamespace2
{
    public class C<T>
    {
         public void M<T2>() { }
    }
}
  • Namespace will be MyNamespace1.MyNamespace2
  • TypeName will be C`1
  • MethodName will be M
  • Arity will be 1
@Youssef1313 Youssef1313 added the Area: MTP Belongs to the Microsoft.Testing.Platform core library label Apr 25, 2025
@Youssef1313 Youssef1313 added this to the MSTest 3.9 / MTP 1.7 milestone Apr 28, 2025
@Youssef1313 Youssef1313 self-assigned this Apr 28, 2025
@Youssef1313
Copy link
Member Author

FYI @bradwilson @thomhurst

@bradwilson
Copy link

We don't have this information in our metadata, since we don't permit overloaded test methods. If this is going to become a hard requirement we'll need to make a breaking change to store it.

@Youssef1313
Copy link
Member Author

Youssef1313 commented Apr 28, 2025

@bradwilson It probably won't impact you that much if you just pass 0, but any custom extension that will attempt to read TestMethodIdentifierProperty.MethodArity may not work as expected (No extension that I know of will want to read that today). It's best if the contract of the public API isn't violated though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: MTP Belongs to the Microsoft.Testing.Platform core library
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants