Skip to content
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

ArgumentNullException when calling a local function with a captured value and [AllureStep] #454

Open
1 of 3 tasks
delatrie opened this issue Mar 4, 2024 · 0 comments
Open
1 of 3 tasks

Comments

@delatrie
Copy link
Contributor

delatrie commented Mar 4, 2024

I'm submitting a ...

  • bug report
  • feature request
  • support request => Please do not submit support request here, see note at the top of this template.

What is the current behavior?

An attribute-based step can't be added with a local non-static method that captures a variable from an outer scope.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem

The following test fails with ArgumentNullException

class MyTestClass
{
    [Test]
    public void MyTest()
    {
        var v = 0;
        Step();

        [AllureStep]
        int Step() => v;
    }
}

Please tell us about your environment:

Other adapters are most probably affected, too.

Other information

The compiler converts each captured value into a method's parameter. That parameter's Name property is set to null, leading to ArgumentNullException when the method's parameters are used to construct the step's title and parameters.

The null value is accessed here and here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant