This repository was archived by the owner on Nov 10, 2026. It is now read-only.
Repository navigation
feat: match exceptions with a snapshot, written member-wise - #57
Merged
Merged
Conversation
An exception was written as its type and message, so a snapshot could not show its parameter name, data or inner exceptions. Since aweXpect 3.4.0 a snapshot writes it member-wise instead: its message, its data when not empty, its inner exception (the inner exceptions of an `AggregateException`) and its other public members, recursively and sorted like any object, but without the members that differ between builds, runtimes, machines and Native AOT, like the stack trace. This package needs no change, so this adds the tests, the smoke tests under Native AOT and the documentation:
```csharp
await Expect.That(() => player.Play(album, -1)).Throws<ArgumentOutOfRangeException>().Which.MatchesSnapshot()
.For.Members().WithName("Message").Ignore();
```
The member rules apply to the members of an exception, e.g. to leave out a message that differs between runtimes. Under Native AOT, the own members of a custom exception are left out, as the source generator of aweXpect registers no type derived from `Exception`, whose `TargetSite` requires unreferenced code; the members of the framework exceptions, e.g. `ParamName` and `ActualValue`, are still written.
vbreuss
enabled auto-merge (squash)
October 18, 2026 09:52
|
🚀 Benchmark ResultsDetails
|
This was referenced Oct 18, 2026
|
This is addressed in release v0.5.0. |
This was referenced Oct 18, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



An exception was written as its type and message, so a snapshot could not show its parameter name, data or inner exceptions. Since aweXpect 3.4.0 a snapshot writes it member-wise instead: its message, its data when not empty, its inner exception (the inner exceptions of an
AggregateException) and its other public members, recursively and sorted like any object, but without the members that differ between builds, runtimes, machines and Native AOT, like the stack trace. This package needs no change, so this adds the tests, the smoke tests under Native AOT and the documentation:The member rules apply to the members of an exception, e.g. to leave out a message that differs between runtimes. Under Native AOT, the own members of a custom exception are left out, as the source generator of aweXpect registers no type derived from
Exception, whoseTargetSiterequires unreferenced code; the members of the framework exceptions, e.g.ParamNameandActualValue, are still written.