allure-framework / allure-framework/allure-csharp

System.Reflection.TargetInvocationException is throwing instead of actual step exception

Open
#347 4 comments 0 reactions 0 assignees View on GitHub
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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.