Skip to content

Commit

Permalink
Document that PathMap is currently not supported
Browse files Browse the repository at this point in the history
  • Loading branch information
jnyrup committed Dec 20, 2022
1 parent ce207ca commit 6c1d92c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion docs/_pages/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ This will throw a test framework-specific exception with the following message:

`Expected username to be "jonas" with a length of 5, but "dennis" has a length of 6, differs near "den" (index 0).`

The way this works is that Fluent Assertions will try to traverse the current stack trace to find the line and column numbers as well as the full path to the source file. Since it needs the debug symbols for that, this will require you to compile the unit tests in debug mode, even on your build servers. Also, since only .NET Standard 2.0 and newer as well as the full .NET Framework support getting direct access to the current stack trace, subject identification only works for the platforms targeting those frameworks.
The way this works is that Fluent Assertions will try to traverse the current stack trace to find the line and column numbers as well as the full path to the source file. Since it needs the debug symbols for that, this will require you to compile the unit test projects in debug mode, even on your build servers.
Also, this does not work with [`PathMap`](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-options/advanced#pathmap) for unit test projects as it assumes that source files are present on the path returned from [`StackFrame.GetFileName()`](https://learn.microsoft.com/en-us/dotnet/api/system.diagnostics.stackframe.getfilename).

Now, if you've built your own extensions that use Fluent Assertions directly, you can tell it to skip that extension code while traversing the stack trace. Consider for example the customer assertion:

Expand Down

0 comments on commit 6c1d92c

Please sign in to comment.