Skip to content

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

Closed

Description

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

Activity

  1. added
    area/mtp
    on Apr 25, 2025
  2. Youssef1313 commented on Apr 28, 2025

    @Youssef1313
    MemberAuthor
  3. bradwilson commented on Apr 28, 2025

    @bradwilson

    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.

  4. Youssef1313 commented on Apr 28, 2025

    @Youssef1313
    MemberAuthor

    Brad Wilson (@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.

  5. added a commit that references this issue on May 25, 2025
  6. bradwilson commented on May 25, 2025

    @bradwilson

    Available in xUnit.net v3 3.0.0-pre.4 https://xunit.net/docs/using-ci-builds

  7. Youssef1313 commented on May 25, 2025

    @Youssef1313
    MemberAuthor

    Brad Wilson (@bradwilson) I left this comment xunit/xunit@76cae7a#r157969047, in case you found the upgrade to 1.7.0 breaking source info in VS.

  8. added 4 commits that reference this issue on May 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area/mtp

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions