From a421af5c608287563ac0caa8c751b23d6b7901a1 Mon Sep 17 00:00:00 2001 From: James Crosswell Date: Thu, 19 Dec 2024 01:09:42 +1300 Subject: [PATCH] Address Trim warnings and prevent future regressions (#3841) --- .generated.NoMobile.sln | 14 + .github/actions/environment/action.yml | 2 +- .github/workflows/build.yml | 52 +- CHANGELOG.md | 1 + Sentry-CI-Build-Linux.slnf | 1 + Sentry.sln | 14 + modules/Ben.Demystifier | 2 +- scripts/generate-solution-filters-config.yaml | 25 +- .../Sentry.AspNetCore.Grpc.csproj | 2 +- .../Sentry.AspNetCore.csproj | 3 + .../SentryFunctionsWorkerMiddleware.cs | 5 +- .../DiagnosticSource/ReflectionHelper.cs | 2 +- .../Sentry.Google.Cloud.Functions.csproj | 6 + .../SentryStartup.cs | 4 +- src/Sentry.Hangfire/Sentry.Hangfire.csproj | 2 + .../Internal/PageNavigationExtensions.cs | 28 +- .../Sentry.OpenTelemetry.csproj | 3 +- .../SentrySpanProcessor.cs | 23 +- src/Sentry.Profiling/Sentry.Profiling.csproj | 1 + .../WinUIUnhandledExceptionIntegration.cs | 6 +- src/Sentry/Internal/AotHelper.cs | 29 +- src/Sentry/Internal/DebugStackTrace.cs | 8 +- .../Internal/Extensions/JsonExtensions.cs | 8 +- src/Sentry/Internal/ModuleExtensions.cs | 4 +- src/Sentry/Internal/StackFrame.cs | 6 +- src/Sentry/Platforms/Native/SentryNative.cs | 2 +- src/Sentry/SentryClient.cs | 10 +- src/Sentry/SentrySdk.cs | 17 +- test/Sentry.MauiTrimTest/App.xaml | 14 + test/Sentry.MauiTrimTest/App.xaml.cs | 14 + test/Sentry.MauiTrimTest/AppShell.xaml | 15 + test/Sentry.MauiTrimTest/AppShell.xaml.cs | 9 + .../Sentry.MauiTrimTest/Directory.Build.props | 2 + .../Directory.Build.targets | 2 + test/Sentry.MauiTrimTest/MainPage.xaml | 36 + test/Sentry.MauiTrimTest/MainPage.xaml.cs | 24 + test/Sentry.MauiTrimTest/MauiProgram.cs | 24 + .../Platforms/Android/AndroidManifest.xml | 6 + .../Platforms/Android/MainActivity.cs | 10 + .../Platforms/Android/MainApplication.cs | 15 + .../Android/Resources/values/colors.xml | 6 + .../Platforms/MacCatalyst/AppDelegate.cs | 9 + .../Platforms/MacCatalyst/Entitlements.plist | 14 + .../Platforms/MacCatalyst/Info.plist | 38 + .../Platforms/MacCatalyst/Program.cs | 15 + .../Platforms/Tizen/Main.cs | 16 + .../Platforms/Tizen/tizen-manifest.xml | 15 + .../Platforms/Windows/App.xaml | 8 + .../Platforms/Windows/App.xaml.cs | 24 + .../Platforms/Windows/Package.appxmanifest | 46 + .../Platforms/Windows/app.manifest | 15 + .../Platforms/iOS/AppDelegate.cs | 9 + .../Platforms/iOS/Info.plist | 32 + .../Platforms/iOS/Program.cs | 15 + .../iOS/Resources/PrivacyInfo.xcprivacy | 51 + .../Properties/launchSettings.json | 8 + test/Sentry.MauiTrimTest/README.md | 15 + .../Resources/AppIcon/appicon.svg | 4 + .../Resources/AppIcon/appiconfg.svg | 8 + .../Resources/Fonts/FluentUI.cs | 7920 +++++++++++++++++ .../Resources/Fonts/OpenSans-Regular.ttf | Bin 0 -> 107280 bytes .../Resources/Fonts/OpenSans-Semibold.ttf | Bin 0 -> 111184 bytes .../Resources/Images/dotnet_bot.png | Bin 0 -> 93437 bytes .../Resources/Raw/AboutAssets.txt | 15 + .../Resources/Splash/splash.svg | 8 + .../Resources/Styles/Colors.xaml | 45 + .../Resources/Styles/Styles.xaml | 451 + .../Sentry.MauiTrimTest.csproj | 92 + .../Sentry.OpenTelemetry.Tests.csproj | 4 +- test/Sentry.TrimTest/Directory.Build.props | 2 + test/Sentry.TrimTest/Directory.Build.targets | 2 + test/Sentry.TrimTest/Program.cs | 2 + test/Sentry.TrimTest/README.md | 16 + test/Sentry.TrimTest/Sentry.TrimTest.csproj | 52 + 74 files changed, 9337 insertions(+), 71 deletions(-) create mode 100644 test/Sentry.MauiTrimTest/App.xaml create mode 100644 test/Sentry.MauiTrimTest/App.xaml.cs create mode 100644 test/Sentry.MauiTrimTest/AppShell.xaml create mode 100644 test/Sentry.MauiTrimTest/AppShell.xaml.cs create mode 100644 test/Sentry.MauiTrimTest/Directory.Build.props create mode 100644 test/Sentry.MauiTrimTest/Directory.Build.targets create mode 100644 test/Sentry.MauiTrimTest/MainPage.xaml create mode 100644 test/Sentry.MauiTrimTest/MainPage.xaml.cs create mode 100644 test/Sentry.MauiTrimTest/MauiProgram.cs create mode 100644 test/Sentry.MauiTrimTest/Platforms/Android/AndroidManifest.xml create mode 100644 test/Sentry.MauiTrimTest/Platforms/Android/MainActivity.cs create mode 100644 test/Sentry.MauiTrimTest/Platforms/Android/MainApplication.cs create mode 100644 test/Sentry.MauiTrimTest/Platforms/Android/Resources/values/colors.xml create mode 100644 test/Sentry.MauiTrimTest/Platforms/MacCatalyst/AppDelegate.cs create mode 100644 test/Sentry.MauiTrimTest/Platforms/MacCatalyst/Entitlements.plist create mode 100644 test/Sentry.MauiTrimTest/Platforms/MacCatalyst/Info.plist create mode 100644 test/Sentry.MauiTrimTest/Platforms/MacCatalyst/Program.cs create mode 100644 test/Sentry.MauiTrimTest/Platforms/Tizen/Main.cs create mode 100644 test/Sentry.MauiTrimTest/Platforms/Tizen/tizen-manifest.xml create mode 100644 test/Sentry.MauiTrimTest/Platforms/Windows/App.xaml create mode 100644 test/Sentry.MauiTrimTest/Platforms/Windows/App.xaml.cs create mode 100644 test/Sentry.MauiTrimTest/Platforms/Windows/Package.appxmanifest create mode 100644 test/Sentry.MauiTrimTest/Platforms/Windows/app.manifest create mode 100644 test/Sentry.MauiTrimTest/Platforms/iOS/AppDelegate.cs create mode 100644 test/Sentry.MauiTrimTest/Platforms/iOS/Info.plist create mode 100644 test/Sentry.MauiTrimTest/Platforms/iOS/Program.cs create mode 100644 test/Sentry.MauiTrimTest/Platforms/iOS/Resources/PrivacyInfo.xcprivacy create mode 100644 test/Sentry.MauiTrimTest/Properties/launchSettings.json create mode 100644 test/Sentry.MauiTrimTest/README.md create mode 100644 test/Sentry.MauiTrimTest/Resources/AppIcon/appicon.svg create mode 100644 test/Sentry.MauiTrimTest/Resources/AppIcon/appiconfg.svg create mode 100644 test/Sentry.MauiTrimTest/Resources/Fonts/FluentUI.cs create mode 100644 test/Sentry.MauiTrimTest/Resources/Fonts/OpenSans-Regular.ttf create mode 100644 test/Sentry.MauiTrimTest/Resources/Fonts/OpenSans-Semibold.ttf create mode 100644 test/Sentry.MauiTrimTest/Resources/Images/dotnet_bot.png create mode 100644 test/Sentry.MauiTrimTest/Resources/Raw/AboutAssets.txt create mode 100644 test/Sentry.MauiTrimTest/Resources/Splash/splash.svg create mode 100644 test/Sentry.MauiTrimTest/Resources/Styles/Colors.xaml create mode 100644 test/Sentry.MauiTrimTest/Resources/Styles/Styles.xaml create mode 100644 test/Sentry.MauiTrimTest/Sentry.MauiTrimTest.csproj create mode 100644 test/Sentry.TrimTest/Directory.Build.props create mode 100644 test/Sentry.TrimTest/Directory.Build.targets create mode 100644 test/Sentry.TrimTest/Program.cs create mode 100644 test/Sentry.TrimTest/README.md create mode 100644 test/Sentry.TrimTest/Sentry.TrimTest.csproj diff --git a/.generated.NoMobile.sln b/.generated.NoMobile.sln index d6474cf575..62290abdc9 100644 --- a/.generated.NoMobile.sln +++ b/.generated.NoMobile.sln @@ -193,6 +193,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sentry.Analyzers.Tests", "t EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sentry.Samples.Console.HeapDump", "samples\Sentry.Samples.Console.HeapDump\Sentry.Samples.Console.HeapDump.csproj", "{D7DF0B26-AD43-4F8B-9BFE-C4471CCC9821}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sentry.TrimTest", "test\Sentry.TrimTest\Sentry.TrimTest.csproj", "{6030B748-0000-43B5-B8A8-399AA42F5229}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sentry.MauiTrimTest", "test\Sentry.MauiTrimTest\Sentry.MauiTrimTest.csproj", "{DF92E098-822C-4B94-B96B-56BFB91FBB54}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -520,6 +524,14 @@ Global {D7DF0B26-AD43-4F8B-9BFE-C4471CCC9821}.Debug|Any CPU.Build.0 = Debug|Any CPU {D7DF0B26-AD43-4F8B-9BFE-C4471CCC9821}.Release|Any CPU.ActiveCfg = Release|Any CPU {D7DF0B26-AD43-4F8B-9BFE-C4471CCC9821}.Release|Any CPU.Build.0 = Release|Any CPU + {6030B748-0000-43B5-B8A8-399AA42F5229}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6030B748-0000-43B5-B8A8-399AA42F5229}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6030B748-0000-43B5-B8A8-399AA42F5229}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6030B748-0000-43B5-B8A8-399AA42F5229}.Release|Any CPU.Build.0 = Release|Any CPU + {DF92E098-822C-4B94-B96B-56BFB91FBB54}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DF92E098-822C-4B94-B96B-56BFB91FBB54}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DF92E098-822C-4B94-B96B-56BFB91FBB54}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DF92E098-822C-4B94-B96B-56BFB91FBB54}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -605,5 +617,7 @@ Global {E36C8DCA-464E-41CB-B189-F58553AAA8D4} = {230B9384-90FD-4551-A5DE-1A5C197F25B6} {5A17FEF9-07BB-47B8-9883-9C2CC93F09E8} = {6987A1CC-608E-4868-A02C-09D30C8B7B2D} {D7DF0B26-AD43-4F8B-9BFE-C4471CCC9821} = {21B42F60-5802-404E-90F0-AEBCC56760C0} + {6030B748-0000-43B5-B8A8-399AA42F5229} = {6987A1CC-608E-4868-A02C-09D30C8B7B2D} + {DF92E098-822C-4B94-B96B-56BFB91FBB54} = {6987A1CC-608E-4868-A02C-09D30C8B7B2D} EndGlobalSection EndGlobal diff --git a/.github/actions/environment/action.yml b/.github/actions/environment/action.yml index 82012aa43e..f67824f33f 100644 --- a/.github/actions/environment/action.yml +++ b/.github/actions/environment/action.yml @@ -15,7 +15,7 @@ runs: - name: Pin the Xcode Version if: runner.os == 'macOS' shell: bash - run: sudo xcode-select --switch /Applications/Xcode_16.0.app + run: sudo xcode-select --switch /Applications/Xcode_16.2.app # Needed for Android SDK setup step - uses: actions/setup-java@v3 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 51b7fa118c..7ce2ff8dc0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,7 +16,7 @@ jobs: strategy: fail-fast: false matrix: - # Pin macos to get the version of XCode that we need: https://github.com/actions/runner-images/issues/10703 + # Pin macos to get the version of Xcode that we need: https://github.com/actions/runner-images/issues/10703 os: [ubuntu-latest, windows-latest, macos-15] steps: @@ -53,7 +53,7 @@ jobs: strategy: fail-fast: false matrix: - # Pin macos to get the version of XCode that we need: https://github.com/actions/runner-images/issues/10703 + # Pin macos to get the version of Xcode that we need: https://github.com/actions/runner-images/issues/10703 os: [ubuntu-latest, windows-latest, macos-15] steps: @@ -154,7 +154,7 @@ jobs: strategy: fail-fast: false matrix: - # Pin macos to get the version of XCode that we need: https://github.com/actions/runner-images/issues/10703 + # Pin macos to get the version of Xcode that we need: https://github.com/actions/runner-images/issues/10703 os: [ubuntu-latest, windows-latest, macos-15] steps: @@ -187,6 +187,52 @@ jobs: with: path: integration-test + + trim-analysis: + name: Trim analysis + runs-on: macos-15 + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + submodules: recursive + fetch-depth: 2 # default is 1 and codecov needs > 1 + + # We use macOS for the final publishing build so we get all the iOS/macCatalyst targets in the packages + - name: Set Environment Variables + run: echo "CI_PUBLISHING_BUILD=true" >> $GITHUB_ENV + + - name: Download sentry-native (macOS) + uses: actions/cache/restore@v4 + with: + path: src/Sentry/Platforms/Native/sentry-native + key: sentry-native-macOS-${{ hashFiles('scripts/build-sentry-native.ps1') }}-${{ hashFiles('.git/modules/modules/sentry-native/HEAD') }} + fail-on-cache-miss: true + + - name: Setup Environment + uses: ./.github/actions/environment + + - name: Build Native Dependencies + uses: ./.github/actions/buildnative + + - name: Install Android SDKs + if: runner.os == 'macOS' + run: | + dotnet build src/Sentry/Sentry.csproj -t:InstallAndroidDependencies -f:net8.0-android34.0 -p:AcceptAndroidSDKLicenses=True -p:AndroidSdkPath="/usr/local/lib/android/sdk/" + + - name: Publish Test app (macOS) + run: dotnet publish test/Sentry.TrimTest/Sentry.TrimTest.csproj -c Release -r osx-arm64 + + - name: Publish Test app (Android) + run: dotnet publish test/Sentry.MauiTrimTest/Sentry.MauiTrimTest.csproj -c Release -f net9.0-android35.0 -r android-arm64 + +# We can't publish iOS applications on CI yet. We'd need a valid bundle identifier and to install the relevant +# certificates/profiles on CI (presumably certs associated with the Sentry org). +# See https://youtrack.jetbrains.com/issue/RIDER-17115/Could-not-find-any-available-provisioning-profiles-for-iOS +# - name: Publish Test app (iOS) +# run: dotnet publish test/Sentry.MauiTrimTest/Sentry.MauiTrimTest.csproj -c Release -f net9.0-ios18.0 -r ios-arm64 + test-solution-filters: runs-on: ubuntu-latest if: ${{ !startsWith(github.ref_name, 'release/') }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 682c030231..d5a51b0211 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ - Fixed JNI Error when accessing Android device data from multiple threads ([#3802](https://github.com/getsentry/sentry-dotnet/pull/3802)) - Android - fix bug that prevents logcat.log from getting attached to unhandled events (SIGSEGV Segfault) ([#3694](https://github.com/getsentry/sentry-dotnet/pull/3694)) - Fix "System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. (Parameter 'idData')" error propagating OpenTelemetry span ids ([#3850](https://github.com/getsentry/sentry-dotnet/pull/3850)) +- Address Trim warnings so that MAUI applications can be compiled AOT ([#3841](https://github.com/getsentry/sentry-dotnet/pull/3841)) ### Dependencies diff --git a/Sentry-CI-Build-Linux.slnf b/Sentry-CI-Build-Linux.slnf index bc53783e35..06a3bafeea 100644 --- a/Sentry-CI-Build-Linux.slnf +++ b/Sentry-CI-Build-Linux.slnf @@ -55,6 +55,7 @@ "test\\Sentry.AspNet.Tests\\Sentry.AspNet.Tests.csproj", "test\\Sentry.AspNetCore.Grpc.Tests\\Sentry.AspNetCore.Grpc.Tests.csproj", "test\\Sentry.AspNetCore.Tests\\Sentry.AspNetCore.Tests.csproj", + "test\\Sentry.AspNetCore.TestUtils\\Sentry.AspNetCore.TestUtils.csproj", "test\\Sentry.Azure.Functions.Worker.Tests\\Sentry.Azure.Functions.Worker.Tests.csproj", "test\\Sentry.DiagnosticSource.IntegrationTests\\Sentry.DiagnosticSource.IntegrationTests.csproj", "test\\Sentry.DiagnosticSource.Tests\\Sentry.DiagnosticSource.Tests.csproj", diff --git a/Sentry.sln b/Sentry.sln index d6474cf575..62290abdc9 100644 --- a/Sentry.sln +++ b/Sentry.sln @@ -193,6 +193,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sentry.Analyzers.Tests", "t EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sentry.Samples.Console.HeapDump", "samples\Sentry.Samples.Console.HeapDump\Sentry.Samples.Console.HeapDump.csproj", "{D7DF0B26-AD43-4F8B-9BFE-C4471CCC9821}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sentry.TrimTest", "test\Sentry.TrimTest\Sentry.TrimTest.csproj", "{6030B748-0000-43B5-B8A8-399AA42F5229}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sentry.MauiTrimTest", "test\Sentry.MauiTrimTest\Sentry.MauiTrimTest.csproj", "{DF92E098-822C-4B94-B96B-56BFB91FBB54}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -520,6 +524,14 @@ Global {D7DF0B26-AD43-4F8B-9BFE-C4471CCC9821}.Debug|Any CPU.Build.0 = Debug|Any CPU {D7DF0B26-AD43-4F8B-9BFE-C4471CCC9821}.Release|Any CPU.ActiveCfg = Release|Any CPU {D7DF0B26-AD43-4F8B-9BFE-C4471CCC9821}.Release|Any CPU.Build.0 = Release|Any CPU + {6030B748-0000-43B5-B8A8-399AA42F5229}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6030B748-0000-43B5-B8A8-399AA42F5229}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6030B748-0000-43B5-B8A8-399AA42F5229}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6030B748-0000-43B5-B8A8-399AA42F5229}.Release|Any CPU.Build.0 = Release|Any CPU + {DF92E098-822C-4B94-B96B-56BFB91FBB54}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DF92E098-822C-4B94-B96B-56BFB91FBB54}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DF92E098-822C-4B94-B96B-56BFB91FBB54}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DF92E098-822C-4B94-B96B-56BFB91FBB54}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -605,5 +617,7 @@ Global {E36C8DCA-464E-41CB-B189-F58553AAA8D4} = {230B9384-90FD-4551-A5DE-1A5C197F25B6} {5A17FEF9-07BB-47B8-9883-9C2CC93F09E8} = {6987A1CC-608E-4868-A02C-09D30C8B7B2D} {D7DF0B26-AD43-4F8B-9BFE-C4471CCC9821} = {21B42F60-5802-404E-90F0-AEBCC56760C0} + {6030B748-0000-43B5-B8A8-399AA42F5229} = {6987A1CC-608E-4868-A02C-09D30C8B7B2D} + {DF92E098-822C-4B94-B96B-56BFB91FBB54} = {6987A1CC-608E-4868-A02C-09D30C8B7B2D} EndGlobalSection EndGlobal diff --git a/modules/Ben.Demystifier b/modules/Ben.Demystifier index b1dd53b9b1..fe04751006 160000 --- a/modules/Ben.Demystifier +++ b/modules/Ben.Demystifier @@ -1 +1 @@ -Subproject commit b1dd53b9b194de9430dc31df27184966ee28e7d0 +Subproject commit fe0475100614508fff1c76aa896e17807adde83f diff --git a/scripts/generate-solution-filters-config.yaml b/scripts/generate-solution-filters-config.yaml index daad716898..d3f0701202 100644 --- a/scripts/generate-solution-filters-config.yaml +++ b/scripts/generate-solution-filters-config.yaml @@ -24,6 +24,13 @@ groupConfigs: windowsOnly: # .NET Framework projects - "**/*.AspNet.csproj" + artefacts: + # Any projects in the obj or bin directories + - "**/obj/**/*.csproj" + - "**/bin/**/*.csproj" + trimTests: + - "**/Sentry.TrimTest.csproj" + - "**/Sentry.MauiTrimTest.csproj" filterConfigs: @@ -35,12 +42,13 @@ filterConfigs: groups: - "macOnly" - "windowsOnly" + - "artefacts" + - "trimTests" patterns: - "**/*AndroidTestApp.csproj" - "**/*DeviceTests*.csproj" - "**/*Maui.Device.TestApp.csproj" - "**/*SourceGen.csproj" - - "**/*TestUtils*.csproj" - outputPath: Sentry-CI-Build-macOS.slnf include: @@ -50,6 +58,9 @@ filterConfigs: - "modules/perfview/**/TraceEvent.csproj" - "modules/perfview/**/FastSerialization.csproj" exclude: + groups: + - "artefacts" + - "trimTests" patterns: - "**/*AndroidTestApp.csproj" - "**/*DeviceTests*.csproj" @@ -65,6 +76,8 @@ filterConfigs: exclude: groups: - "macOnly" + - "artefacts" + - "trimTests" patterns: - "**/*AndroidTestApp.csproj" - "**/*DeviceTests*.csproj" @@ -78,6 +91,8 @@ filterConfigs: groups: - "allProjects" exclude: + groups: + - "artefacts" patterns: - "**/Sentry.Bindings*.csproj" - "benchmarks/**/*.csproj" @@ -115,6 +130,9 @@ filterConfigs: - "**/Sentry.Testing.CrashableApp.csproj" - "**/Sentry.Tests.csproj" - "**/Sentry.Analyzers.Tests.csproj" + exclude: + groups: + - "artefacts" - outputPath: SentryCore.slnf solution: .generated.NoMobile.sln @@ -173,6 +191,9 @@ filterConfigs: groups: - "allProjects" exclude: + groups: + - "artefacts" + - "trimTests" patterns: - "**/*Bindings*.csproj" - "**/*Android*.csproj" @@ -184,6 +205,8 @@ filterConfigs: groups: - "allProjects" exclude: + groups: + - "trimTests" patterns: - "samples/**/*" - "**/*Bindings*" diff --git a/src/Sentry.AspNetCore.Grpc/Sentry.AspNetCore.Grpc.csproj b/src/Sentry.AspNetCore.Grpc/Sentry.AspNetCore.Grpc.csproj index 8963ddfd82..cafddf4b7e 100644 --- a/src/Sentry.AspNetCore.Grpc/Sentry.AspNetCore.Grpc.csproj +++ b/src/Sentry.AspNetCore.Grpc/Sentry.AspNetCore.Grpc.csproj @@ -11,7 +11,7 @@ - + diff --git a/src/Sentry.AspNetCore/Sentry.AspNetCore.csproj b/src/Sentry.AspNetCore/Sentry.AspNetCore.csproj index 5220958947..d75cabef9f 100644 --- a/src/Sentry.AspNetCore/Sentry.AspNetCore.csproj +++ b/src/Sentry.AspNetCore/Sentry.AspNetCore.csproj @@ -19,6 +19,9 @@ + + + diff --git a/src/Sentry.Azure.Functions.Worker/SentryFunctionsWorkerMiddleware.cs b/src/Sentry.Azure.Functions.Worker/SentryFunctionsWorkerMiddleware.cs index 889153bcd6..c3c57fe71e 100644 --- a/src/Sentry.Azure.Functions.Worker/SentryFunctionsWorkerMiddleware.cs +++ b/src/Sentry.Azure.Functions.Worker/SentryFunctionsWorkerMiddleware.cs @@ -81,7 +81,8 @@ public async Task Invoke(FunctionContext context, FunctionExecutionDelegate next } } - [UnconditionalSuppressMessage("Trimming", "IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code", Justification = AotHelper.SuppressionJustification)] + [UnconditionalSuppressMessage("Trimming", "IL2026: RequiresUnreferencedCode", Justification = AotHelper.AvoidAtRuntime)] + [UnconditionalSuppressMessage("Trimming", "IL2075: DynamicallyAccessedMembers", Justification = AotHelper.AvoidAtRuntime)] private async Task StartOrContinueTraceAsync(FunctionContext context) { var transactionName = context.FunctionDefinition.Name; @@ -101,7 +102,7 @@ private async Task StartOrContinueTraceAsync(FunctionContext // attribute. In that case the route name will always be /api/ // If this is ever a problem for customers, we can potentially see if there are alternate ways to get this info // from route tables or something. We're not even sure if anyone will use this functionality for now though. - if (!AotHelper.IsNativeAot && !TransactionNameCache.TryGetValue(transactionNameKey, out transactionName)) + if (!AotHelper.IsTrimmed && !TransactionNameCache.TryGetValue(transactionNameKey, out transactionName)) { // Find the HTTP Trigger attribute via reflection var assembly = Assembly.LoadFrom(context.FunctionDefinition.PathToAssembly); diff --git a/src/Sentry.DiagnosticSource/Internal/DiagnosticSource/ReflectionHelper.cs b/src/Sentry.DiagnosticSource/Internal/DiagnosticSource/ReflectionHelper.cs index f569c885f3..a7414ef865 100644 --- a/src/Sentry.DiagnosticSource/Internal/DiagnosticSource/ReflectionHelper.cs +++ b/src/Sentry.DiagnosticSource/Internal/DiagnosticSource/ReflectionHelper.cs @@ -12,7 +12,7 @@ namespace Sentry.Internal.DiagnosticSource; /// internal static class ReflectionHelper { - [UnconditionalSuppressMessage("TrimAnalyzer", "IL2075", Justification = AotHelper.SuppressionJustification)] + [UnconditionalSuppressMessage("TrimAnalyzer", "IL2075: DynamicallyAccessedMembers", Justification = AotHelper.AvoidAtRuntime)] public static object? GetProperty(this object obj, string name, IDiagnosticLogger? logger = null) { if (AotHelper.IsTrimmed) diff --git a/src/Sentry.Google.Cloud.Functions/Sentry.Google.Cloud.Functions.csproj b/src/Sentry.Google.Cloud.Functions/Sentry.Google.Cloud.Functions.csproj index b3961278f8..e704ddaf3a 100644 --- a/src/Sentry.Google.Cloud.Functions/Sentry.Google.Cloud.Functions.csproj +++ b/src/Sentry.Google.Cloud.Functions/Sentry.Google.Cloud.Functions.csproj @@ -6,9 +6,15 @@ Official Google Cloud Functions integration for Sentry - Open-source error tracking that helps developers monitor and fix crashes in real time. + + true + true + + + diff --git a/src/Sentry.Google.Cloud.Functions/SentryStartup.cs b/src/Sentry.Google.Cloud.Functions/SentryStartup.cs index 7d42e9f66a..73cae34ce8 100644 --- a/src/Sentry.Google.Cloud.Functions/SentryStartup.cs +++ b/src/Sentry.Google.Cloud.Functions/SentryStartup.cs @@ -29,7 +29,9 @@ public override void ConfigureLogging(WebHostBuilderContext context, ILoggingBui // TODO: refactor this with SentryWebHostBuilderExtensions var section = context.Configuration.GetSection("Sentry"); - logging.Services.Configure(section); + logging.Services.AddSingleton>( + _ => new SentryAspNetCoreOptionsSetup(section) + ); logging.Services.Configure(options => { diff --git a/src/Sentry.Hangfire/Sentry.Hangfire.csproj b/src/Sentry.Hangfire/Sentry.Hangfire.csproj index 03ff86933d..d2f0ba0aa1 100644 --- a/src/Sentry.Hangfire/Sentry.Hangfire.csproj +++ b/src/Sentry.Hangfire/Sentry.Hangfire.csproj @@ -8,6 +8,8 @@ + true diff --git a/src/Sentry.Maui/Internal/PageNavigationExtensions.cs b/src/Sentry.Maui/Internal/PageNavigationExtensions.cs index 3c1af81839..9ce0a221c6 100644 --- a/src/Sentry.Maui/Internal/PageNavigationExtensions.cs +++ b/src/Sentry.Maui/Internal/PageNavigationExtensions.cs @@ -1,16 +1,36 @@ +using Sentry.Internal; + namespace Sentry.Maui.Internal; internal static class PageNavigationExtensions { - private static readonly PropertyInfo? DestinationPageProperty = - typeof(NavigatedFromEventArgs).GetProperty("DestinationPage", BindingFlags.Instance | BindingFlags.NonPublic); + private static readonly PropertyInfo? DestinationPageProperty; + private static readonly PropertyInfo? PreviousPageProperty; - private static readonly PropertyInfo? PreviousPageProperty = - typeof(NavigatedToEventArgs).GetProperty("PreviousPage", BindingFlags.Instance | BindingFlags.NonPublic); + [UnconditionalSuppressMessage("Trimming", "IL2075: DynamicallyAccessedMembers", Justification = AotHelper.AvoidAtRuntime)] + static PageNavigationExtensions() + { + if (AotHelper.IsTrimmed) + { + return; + } + DestinationPageProperty = typeof(NavigatedFromEventArgs) + .GetProperty("DestinationPage", BindingFlags.Instance | BindingFlags.NonPublic); + PreviousPageProperty = typeof(NavigatedToEventArgs) + .GetProperty("PreviousPage", BindingFlags.Instance | BindingFlags.NonPublic); + } + /// + /// Reads the (internal) NavigatedFromEventArgs.DestinationPage property via reflection. + /// Note that this will return null if trimming is enabled. + /// public static Page? GetDestinationPage(this NavigatedFromEventArgs eventArgs) => DestinationPageProperty?.GetValue(eventArgs) as Page; + /// + /// Reads the (internal) NavigatedFromEventArgs.PreviousPage property via reflection. + /// Note that this will return null if trimming is enabled. + /// public static Page? GetPreviousPage(this NavigatedToEventArgs eventArgs) => PreviousPageProperty?.GetValue(eventArgs) as Page; } diff --git a/src/Sentry.OpenTelemetry/Sentry.OpenTelemetry.csproj b/src/Sentry.OpenTelemetry/Sentry.OpenTelemetry.csproj index 1af2c859eb..66daebfda3 100644 --- a/src/Sentry.OpenTelemetry/Sentry.OpenTelemetry.csproj +++ b/src/Sentry.OpenTelemetry/Sentry.OpenTelemetry.csproj @@ -16,7 +16,8 @@ - + + diff --git a/src/Sentry.OpenTelemetry/SentrySpanProcessor.cs b/src/Sentry.OpenTelemetry/SentrySpanProcessor.cs index 9f32987db5..09172c0636 100644 --- a/src/Sentry.OpenTelemetry/SentrySpanProcessor.cs +++ b/src/Sentry.OpenTelemetry/SentrySpanProcessor.cs @@ -463,9 +463,12 @@ private void GenerateSentryErrorsFromOtelSpan(Activity activity, IDictionary + true diff --git a/src/Sentry/Integrations/WinUIUnhandledExceptionIntegration.cs b/src/Sentry/Integrations/WinUIUnhandledExceptionIntegration.cs index 3ff6e4bcfa..d9b2fc3f9c 100644 --- a/src/Sentry/Integrations/WinUIUnhandledExceptionIntegration.cs +++ b/src/Sentry/Integrations/WinUIUnhandledExceptionIntegration.cs @@ -82,8 +82,8 @@ public void Register(IHub hub, SentryOptions options) /// This method uses reflection to hook up an UnhandledExceptionHandler. When IsTrimmed is true, users will have /// follow our guidance to perform this initialization manually. /// - [UnconditionalSuppressMessage("Trimming", "IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code", Justification = AotHelper.SuppressionJustification)] - [UnconditionalSuppressMessage("Trimming", "IL2075:\'this\' argument does not satisfy \'DynamicallyAccessedMembersAttribute\' in call to target method. The return value of the source method does not have matching annotations.", Justification = AotHelper.SuppressionJustification)] + [UnconditionalSuppressMessage("Trimming", "IL2026: RequiresUnreferencedCode", Justification = AotHelper.AvoidAtRuntime)] + [UnconditionalSuppressMessage("TrimAnalyzer", "IL2075: DynamicallyAccessedMembers", Justification = AotHelper.AvoidAtRuntime)] private void AttachEventHandler() { try @@ -105,7 +105,7 @@ private void AttachEventHandler() } } - [UnconditionalSuppressMessage("TrimAnalyzer", "IL2075", Justification = AotHelper.SuppressionJustification)] + [UnconditionalSuppressMessage("TrimAnalyzer", "IL2075: DynamicallyAccessedMembers", Justification = AotHelper.AvoidAtRuntime)] private void WinUIUnhandledExceptionHandler(object sender, object e) { bool handled; diff --git a/src/Sentry/Internal/AotHelper.cs b/src/Sentry/Internal/AotHelper.cs index 5c3387b535..53165c81ca 100644 --- a/src/Sentry/Internal/AotHelper.cs +++ b/src/Sentry/Internal/AotHelper.cs @@ -1,35 +1,22 @@ +using Sentry.Protocol; + namespace Sentry.Internal; internal static class AotHelper { - internal const string SuppressionJustification = "Non-trimmable code is avoided at runtime"; - internal static bool IsTrimmed { get; } - - private class AotTester - { - public void Test() { } - } + internal const string AvoidAtRuntime = "Non-trimmable code is avoided at runtime"; -#if NET8_0_OR_GREATER - // TODO this probably more closely represents trimming rather than NativeAOT? - internal static bool IsNativeAot { get; } + internal static bool IsTrimmed { get; } - [UnconditionalSuppressMessage("Trimming", "IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code", Justification = AotHelper.SuppressionJustification)] static AotHelper() { - var stackTrace = new StackTrace(false); - IsTrimmed = stackTrace.GetFrame(0)?.GetMethod() is null; - IsNativeAot = IsTrimmed; + IsTrimmed = CheckIsTrimmed(); } -#else - // This is a compile-time const so that the irrelevant code is removed during compilation. - internal const bool IsNativeAot = false; - [UnconditionalSuppressMessage("Trimming", "IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code", Justification = AotHelper.SuppressionJustification)] - static AotHelper() + [UnconditionalSuppressMessage("Trimming", "IL2026: RequiresUnreferencedCode", Justification = AvoidAtRuntime)] + private static bool CheckIsTrimmed() { var stackTrace = new StackTrace(false); - IsTrimmed = stackTrace.GetFrame(0)?.GetMethod() is null; + return stackTrace.GetFrame(0)?.GetMethod() is null; } -#endif } diff --git a/src/Sentry/Internal/DebugStackTrace.cs b/src/Sentry/Internal/DebugStackTrace.cs index c048d78b75..3f43297772 100644 --- a/src/Sentry/Internal/DebugStackTrace.cs +++ b/src/Sentry/Internal/DebugStackTrace.cs @@ -173,10 +173,10 @@ internal void MergeDebugImagesInto(SentryEvent @event) /// /// Creates an enumerator of from a . /// - [UnconditionalSuppressMessage("Trimming", "IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code", Justification = AotHelper.SuppressionJustification)] + [UnconditionalSuppressMessage("Trimming", "IL2026: RequiresUnreferencedCode", Justification = AotHelper.AvoidAtRuntime)] private IEnumerable CreateFrames(StackTrace stackTrace, bool isCurrentStackTrace, Func skipFrame) { - var frames = (!AotHelper.IsNativeAot && _options.StackTraceMode == StackTraceMode.Enhanced) + var frames = (!AotHelper.IsTrimmed && _options.StackTraceMode == StackTraceMode.Enhanced) ? EnhancedStackTrace.GetFrames(stackTrace).Select(p => new RealStackFrame(p)) : stackTrace.GetFrames().Select(p => new RealStackFrame(p)); @@ -291,7 +291,7 @@ internal static SentryStackFrame ParseNativeAOTToString(string info) /// /// Default the implementation of CreateFrame. /// - [UnconditionalSuppressMessage("Trimming", "IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code", Justification = AotHelper.SuppressionJustification)] + [UnconditionalSuppressMessage("Trimming", "IL2026: RequiresUnreferencedCode", Justification = AotHelper.AvoidAtRuntime)] private SentryStackFrame? TryCreateManagedFrame(IStackFrame stackFrame) { if (stackFrame.GetMethod() is not { } method) @@ -508,7 +508,7 @@ private static void DemangleLambdaReturnType(SentryStackFrame frame) } } - [UnconditionalSuppressMessage("SingleFile", "IL3002:Avoid calling members marked with 'RequiresAssemblyFilesAttribute' when publishing as a single-file", Justification = "Code is avoided at runtime.")] + [UnconditionalSuppressMessage("SingleFile", "IL3002: calling members marked with 'RequiresAssemblyFilesAttribute'", Justification = AotHelper.AvoidAtRuntime)] private static PEReader? TryReadAssemblyFromDisk(Module module, SentryOptions options, out string? assemblyName) { try diff --git a/src/Sentry/Internal/Extensions/JsonExtensions.cs b/src/Sentry/Internal/Extensions/JsonExtensions.cs index e8a919d23c..fa29909eac 100644 --- a/src/Sentry/Internal/Extensions/JsonExtensions.cs +++ b/src/Sentry/Internal/Extensions/JsonExtensions.cs @@ -564,8 +564,8 @@ byte[] AotSerializeToUtf8Bytes() return JitSerializeToUtf8Bytes(); #endif - [UnconditionalSuppressMessage("Trimming", "IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code", Justification = AotHelper.SuppressionJustification)] - [UnconditionalSuppressMessage("AOT", "IL3050:Calling members annotated with 'RequiresDynamicCodeAttribute' may break functionality when AOT compiling.", Justification = AotHelper.SuppressionJustification)] + [UnconditionalSuppressMessage("Trimming", "IL2026: RequiresUnreferencedCode", Justification = AotHelper.AvoidAtRuntime)] + [UnconditionalSuppressMessage("AOT", "IL3050: RequiresDynamicCode", Justification = AotHelper.AvoidAtRuntime)] byte[] JitSerializeToUtf8Bytes() => JsonSerializer.SerializeToUtf8Bytes(value, SerializerOptions); } @@ -586,8 +586,8 @@ private static void InternalSerialize(Utf8JsonWriter writer, object value, bool #endif return; - [UnconditionalSuppressMessage("AOT", "IL3050:Calling members annotated with 'RequiresDynamicCodeAttribute' may break functionality when AOT compiling.", Justification = AotHelper.SuppressionJustification)] - [UnconditionalSuppressMessage("Trimming", "IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code", Justification = AotHelper.SuppressionJustification)] + [UnconditionalSuppressMessage("AOT", "IL3050: RequiresDynamicCode", Justification = AotHelper.AvoidAtRuntime)] + [UnconditionalSuppressMessage("Trimming", "IL2026: RequiresUnreferencedCode", Justification = AotHelper.AvoidAtRuntime)] void JitSerialize() { var options = preserveReferences ? AltSerializerOptions : SerializerOptions; diff --git a/src/Sentry/Internal/ModuleExtensions.cs b/src/Sentry/Internal/ModuleExtensions.cs index bb48ff5d88..40657986e6 100644 --- a/src/Sentry/Internal/ModuleExtensions.cs +++ b/src/Sentry/Internal/ModuleExtensions.cs @@ -11,10 +11,10 @@ internal static class ModuleExtensions /// /// A Module instance /// module.Name, if this is available. module.ScopeName otherwise - [UnconditionalSuppressMessage("SingleFile", "IL3002:Avoid calling members marked with 'RequiresAssemblyFilesAttribute' when publishing as a single-file", Justification = AotHelper.SuppressionJustification)] + [UnconditionalSuppressMessage("SingleFile", "IL3002: calling members marked with 'RequiresAssemblyFilesAttribute'", Justification = AotHelper.AvoidAtRuntime)] public static string? GetNameOrScopeName(this Module module) { - return (AotHelper.IsNativeAot || module?.Name is null || module.Name.Equals(UnknownLocation)) + return (AotHelper.IsTrimmed || module?.Name is null || module.Name.Equals(UnknownLocation)) ? module?.ScopeName : module?.Name; } diff --git a/src/Sentry/Internal/StackFrame.cs b/src/Sentry/Internal/StackFrame.cs index cdfe61f01a..5d11ec2145 100644 --- a/src/Sentry/Internal/StackFrame.cs +++ b/src/Sentry/Internal/StackFrame.cs @@ -109,13 +109,11 @@ public RealStackFrame(StackFrame frame) public int GetILOffset() => _frame.GetILOffset(); - [UnconditionalSuppressMessage("Trimming", - "IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code", - Justification = AotHelper.SuppressionJustification)] + [UnconditionalSuppressMessage("Trimming", "IL2026: RequiresUnreferencedCode", Justification = AotHelper.AvoidAtRuntime)] public MethodBase? GetMethod() { #pragma warning disable 0162 // Unreachable code on old .NET frameworks - return AotHelper.IsNativeAot ? null : _frame.GetMethod(); + return AotHelper.IsTrimmed ? null : _frame.GetMethod(); #pragma warning restore 0162 } diff --git a/src/Sentry/Platforms/Native/SentryNative.cs b/src/Sentry/Platforms/Native/SentryNative.cs index 3cb8fd868c..758d365feb 100644 --- a/src/Sentry/Platforms/Native/SentryNative.cs +++ b/src/Sentry/Platforms/Native/SentryNative.cs @@ -11,7 +11,7 @@ internal static class SentryNative static SentryNative() { - IsAvailable = AotHelper.IsNativeAot && !SentryRuntime.Current.IsBrowserWasm(); + IsAvailable = AotHelper.IsTrimmed && !SentryRuntime.Current.IsBrowserWasm(); } #else // This is a compile-time const so that the irrelevant code is removed during compilation. diff --git a/src/Sentry/SentryClient.cs b/src/Sentry/SentryClient.cs index 9d7a91e40d..7d5b071dc5 100644 --- a/src/Sentry/SentryClient.cs +++ b/src/Sentry/SentryClient.cs @@ -176,6 +176,9 @@ public void CaptureTransaction(SentryTransaction transaction, Scope? scope, Sent CaptureEnvelope(Envelope.FromTransaction(processedTransaction)); } +#if NET6_0_OR_GREATER + [UnconditionalSuppressMessage("Trimming", "IL2026: RequiresUnreferencedCode", Justification = AotHelper.AvoidAtRuntime)] +#endif private SentryTransaction? BeforeSendTransaction(SentryTransaction transaction, SentryHint hint) { if (_options.BeforeSendTransactionInternal is null) @@ -191,7 +194,7 @@ public void CaptureTransaction(SentryTransaction transaction, Scope? scope, Sent } catch (Exception e) { - if (!AotHelper.IsNativeAot) + if (!AotHelper.IsTrimmed) { // Attempt to demystify exceptions before adding them as breadcrumbs. e.Demystify(); @@ -415,6 +418,9 @@ public bool CaptureEnvelope(Envelope envelope) return false; } +#if NET6_0_OR_GREATER + [UnconditionalSuppressMessage("Trimming", "IL2026: RequiresUnreferencedCode", Justification = AotHelper.AvoidAtRuntime)] +#endif private SentryEvent? BeforeSend(SentryEvent? @event, SentryHint hint) { if (_options.BeforeSendInternal == null) @@ -429,7 +435,7 @@ public bool CaptureEnvelope(Envelope envelope) } catch (Exception e) { - if (!AotHelper.IsNativeAot) + if (!AotHelper.IsTrimmed) { // Attempt to demystify exceptions before adding them as breadcrumbs. e.Demystify(); diff --git a/src/Sentry/SentrySdk.cs b/src/Sentry/SentrySdk.cs index cfd0fe2956..505bf7bb1b 100644 --- a/src/Sentry/SentrySdk.cs +++ b/src/Sentry/SentrySdk.cs @@ -48,18 +48,14 @@ internal static IHub InitHub(SentryOptions options) options.LogWarning("The provided DSN that contains a secret key. This is not required and will be ignored."); } - if (AotHelper.IsNativeAot) #pragma warning disable CS0162 // Unreachable code detected - { #pragma warning disable 0162 // Unreachable code on old .NET frameworks - options.LogDebug("This looks like a Native AOT application build."); + options.LogDebug(AotHelper.IsTrimmed + ? "This looks like a Native AOT application build." + : "This doesn't look like a Native AOT application build." + ); #pragma warning restore 0162 - } - else - { #pragma warning restore CS0162 // Unreachable code detected - options.LogDebug("This doesn't look like a Native AOT application build."); - } // Initialize native platform SDKs here if (options.InitNativeSdks) @@ -69,6 +65,9 @@ internal static IHub InitHub(SentryOptions options) #elif ANDROID InitSentryAndroidSdk(options); #elif NET8_0_OR_GREATER + // TODO: Is this working properly? Currently we don't have any way to check if the app is being compiled AOT + // All we know is whether trimming has been enabled or not. I think at the moment we'll be initialising + // SentryNative for managed applications when they've been trimmed! if (SentryNative.IsAvailable) { InitNativeSdk(options); @@ -94,7 +93,7 @@ internal static IHub InitHub(SentryOptions options) LogWarningIfProfilingMisconfigured(options, " on Android"); #else #if NET8_0_OR_GREATER - if (AotHelper.IsNativeAot) + if (AotHelper.IsTrimmed) { LogWarningIfProfilingMisconfigured(options, " for NativeAOT"); } diff --git a/test/Sentry.MauiTrimTest/App.xaml b/test/Sentry.MauiTrimTest/App.xaml new file mode 100644 index 0000000000..abbee2a6f8 --- /dev/null +++ b/test/Sentry.MauiTrimTest/App.xaml @@ -0,0 +1,14 @@ + + + + + + + + + + + diff --git a/test/Sentry.MauiTrimTest/App.xaml.cs b/test/Sentry.MauiTrimTest/App.xaml.cs new file mode 100644 index 0000000000..3430b321fa --- /dev/null +++ b/test/Sentry.MauiTrimTest/App.xaml.cs @@ -0,0 +1,14 @@ +namespace Sentry.MauiTrimTest; + +public partial class App : Application +{ + public App() + { + InitializeComponent(); + } + + protected override Window CreateWindow(IActivationState? activationState) + { + return new Window(new AppShell()); + } +} diff --git a/test/Sentry.MauiTrimTest/AppShell.xaml b/test/Sentry.MauiTrimTest/AppShell.xaml new file mode 100644 index 0000000000..2a252bfebb --- /dev/null +++ b/test/Sentry.MauiTrimTest/AppShell.xaml @@ -0,0 +1,15 @@ + + + + + + diff --git a/test/Sentry.MauiTrimTest/AppShell.xaml.cs b/test/Sentry.MauiTrimTest/AppShell.xaml.cs new file mode 100644 index 0000000000..511a4221db --- /dev/null +++ b/test/Sentry.MauiTrimTest/AppShell.xaml.cs @@ -0,0 +1,9 @@ +namespace Sentry.MauiTrimTest; + +public partial class AppShell : Shell +{ + public AppShell() + { + InitializeComponent(); + } +} diff --git a/test/Sentry.MauiTrimTest/Directory.Build.props b/test/Sentry.MauiTrimTest/Directory.Build.props new file mode 100644 index 0000000000..bbb7413d29 --- /dev/null +++ b/test/Sentry.MauiTrimTest/Directory.Build.props @@ -0,0 +1,2 @@ + + diff --git a/test/Sentry.MauiTrimTest/Directory.Build.targets b/test/Sentry.MauiTrimTest/Directory.Build.targets new file mode 100644 index 0000000000..bbb7413d29 --- /dev/null +++ b/test/Sentry.MauiTrimTest/Directory.Build.targets @@ -0,0 +1,2 @@ + + diff --git a/test/Sentry.MauiTrimTest/MainPage.xaml b/test/Sentry.MauiTrimTest/MainPage.xaml new file mode 100644 index 0000000000..d9866e8519 --- /dev/null +++ b/test/Sentry.MauiTrimTest/MainPage.xaml @@ -0,0 +1,36 @@ + + + + + + + +