getsentry / sentry-dotnet

Sentry SDK for .NET
https://docs.sentry.io/platforms/dotnet
MIT License
579 stars 206 forks source link

Native AOT stack trace integration test #2772

Open vaind opened 10 months ago

vaind commented 10 months ago

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

More context: https://github.com/getsentry/sentry-dotnet/pull/2732#discussion_r1371006441

TODO items have been left as markers in DebugStackTraceTests.verify, to indicate the test cases that we should try to cover. For example:

// 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);
    }
jamescrosswell commented 10 months ago

@vaind are there any gaps on this issue that I can help with? I see you've already got various integration tests here. I'm not sure if that covers all the scenarios we wanted to cover though... e.g. all the TODO items in DebugStackTraceTests.verify.cs.

I figured integration tests is probably the most important thing still sitting on the backlog besides what you're doing.

vaind commented 10 months ago

I'm not sure if that covers all the scenarios we wanted to cover though... e.g. all the TODO items in DebugStackTraceTests.verify.cs.

It doesn't but that PR will enable us to implement these, once it's merged.

vaind commented 10 months ago

There are some basic runtime tests for AOT in integration-test/runtime.Tests.ps added by #2781

I've had a look at the places marked with TODO linking this issue & integration testing it would be quite a bit of work so I hope we could wait for https://github.com/dotnet/runtime/issues/91069

vaind commented 9 months ago

For future investigation: I've had an idea to run the MAUI devicetest app with a NativeAOT published build. I can't try it out at the moment because we need to update device-tests to net8 first, which is blocked (#2854).

ivanpovazan commented 8 months ago

For future investigation: I've had an idea to run the MAUI devicetest app with a NativeAOT published build. I can't try it out at the moment because we need to update device-tests to net8 first, which is blocked (#2854).

FWIW, we will be standing up MAUI device tests with NativeAOT on iOS, which is being tracked here: https://github.com/dotnet/maui/issues/19817