getsentry / getsentry/sentry-dotnet
Native AOT stack trace integration test
- Dominant language
- C#
- Stars
- 770
- Forks
- 248
- Avg merge
- 3d 4h
- Merged PRs (30d)
- 49
Description
We can't unit test Native AOT implementation of `DebugStackTrace` (there's no xUnit runner to support AOT so no way to test this in unit tests. There's a tracking issue: https://github.com/dotnet/runtime/issues/91069). Instead, we need to have an integration test that captures app requests.
Possible solutions
* use something like the Sentry CLI integration test pwsh script and mock the sentry server
* use something like the SingleFileTestApp and run through unit tests: https://github.com/getsentry/sentry-dotnet/blob/feat/4.0.0/test/Sentry.Tests/Internals/ILSpy/SingleFileAppTests.cs
More context: https://github.com/getsentry/sentry-dotnet/pull/2732#discussion_r1371006441
TODO items have been left as markers in [DebugStackTraceTests.verify](https://github.com/getsentry/sentry-dotnet/blob/257787b47393d00b530662597bdf569673d73340/test/Sentry.Tests/Internals/DebugStackTraceTests.verify.cs), to indicate the test cases that we should try to cover. For example:
```csharp
// TODO: Create integration test to test this behaviour when publishing AOT apps
// See https://github.com/getsentry/sentry-dotnet/issues/2772
[Fact]
public void CreateSentryStackFrame_AppNamespace_InAppFrame()
{
var frame = new StackFrame();
var sut = _fixture.GetSut();
var actual = sut.CreateFrame(new RealStackFrame(frame));
Assert.True(actual?.InApp);
}
```
Contributor guide
Assessment
This issue has not been assessed yet.