allure-framework / allure-framework/allure-csharp
System.Reflection.TargetInvocationException is throwing instead of actual step exception
- Dominant language
- C#
- Stars
- 125
- Forks
- 76
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 18
Description
Consider this code:
```
[AllureStep("This step should fail")]
public static int FailedStep()
{
var x = 1;
return 1 / (1 - x);
}
[Test]
[AllureName("Should fail on step")]
public void ReturnFail()
{
FailedStep();
}
```
This test failed with exception:
```
System.Reflection.TargetInvocationException : Exception has been thrown by the target of an invocation.
----> System.DivideByZeroException : Attempted to divide by zero.
```
but should be failed with `System.DivideByZeroException : Attempted to divide by zero.`
- Allure version: 2.9.5-preview.1
Contributor guide
Research direction
Reproduce the issue with the FailedStep and ReturnFail entry points shown in the report, then inspect how the AllureStep invocation handles exceptions from reflection. Done means the test reports the underlying DivideByZeroException instead of System.Reflection.TargetInvocationException.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100