testfx icon indicating copy to clipboard operation
testfx copied to clipboard

Investigate why stacktrace are empty in release mode

Open Evangelink opened this issue 10 months ago • 4 comments

Some tests are checking the StackTrace and it's either null or empty when in release mode. We have some helper doing cleanup of them so I am wondering if the logic is not working properly with MTP as the processing is different (more "normal" app like).

AB#2404445

Evangelink avatar Feb 24 '25 08:02 Evangelink

Issues talks about this PR https://github.com/microsoft/testfx/pull/5014 , and the assertions wrapped in if #DEBUG

nohwnd avatar Feb 24 '25 08:02 nohwnd

Leaving a note here: we are targeting net462:

https://github.com/microsoft/testfx/blob/bb3c852afe2e5a43795b9fdbee6f14b445a6d29e/test/UnitTests/MSTestAdapter.UnitTests/MSTestAdapter.UnitTests.csproj#L5

So one important difference that happens with the move from VSTest to MTP is that testhost.exe.config has:

<AppContextSwitchOverrides value="Switch.System.Diagnostics.IgnorePortablePDBsInStackTraces=false" />

which is linked to https://github.com/dotnet/designs/blob/238ca0202ea5df96d378a06c01960fc289aba166/accepted/2020/diagnostics/debugging-with-symbols-and-sources.md#stack-traces.

That's one possible area to look at.

Youssef1313 avatar Jun 03 '25 11:06 Youssef1313

This happens only under code coverage, specifically with our coverage.config. More specifically, removing the ModulePaths element in the config file resolves it.

Youssef1313 avatar Aug 05 '25 03:08 Youssef1313

Ping @fhnaseer

Youssef1313 avatar Oct 11 '25 10:10 Youssef1313