diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d4450c07d7..e13d285f80 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,13 +21,14 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, windows-latest, macos-latest] + # Using macos-12 because we need Xcode 13.3 or later to build Sentry.Samples.Maui. (macos-latest currently points at macos-11 which uses Xcode 13.2) + os: [ubuntu-latest, windows-latest, macos-12] include: - os: ubuntu-latest slnf: SentryLinux.slnf - os: windows-latest slnf: SentryWindows.slnf - - os: macos-latest + - os: macos-12 slnf: SentryMac.slnf steps: @@ -36,11 +37,6 @@ jobs: with: submodules: recursive - - name: "Set up Java: 11" - uses: actions/setup-java@v1 - with: - java-version: 11 - - name: Setup .NET SDK (Windows) if: startsWith(matrix.os, 'windows') uses: actions/setup-dotnet@v2 @@ -59,22 +55,22 @@ jobs: with: dotnet-version: 2.1.818 - # .NET Android workload doesn't support Linux https://github.com/dotnet/sdk/issues/22411 - - name: Install Android workload (macOS) - if: startsWith(matrix.os, 'macos') - run: sudo dotnet workload install android - - - name: Install Android workload (Windows) - if: startsWith(matrix.os, 'windows') - run: dotnet workload install android - - name: Dependency Caching uses: actions/cache@v3 with: path: ~/.nuget/packages - ## we don't use a lockfile, so hash all files where we might be keeping tags - key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.*proj', '**/*.props') }} - restore-keys: ${{ runner.os }}-nuget + # We don't use a lockfile, so hash all files where we might be keeping tags + # Workloads also get installed in the nuget packages cache, so if you modify workloads below, increment the number in the cache keys + key: ${{ runner.os }}-nuget+workloads2-${{ hashFiles('**/*.*proj', '**/*.props') }} + restore-keys: ${{ runner.os }}-nuget+workloads2 + + # .NET Android workloads don't support Linux https://github.com/dotnet/sdk/issues/22411 + - name: Install .NET Workloads (Windows) + if: startsWith(matrix.os, 'windows') + run: dotnet workload install maui-android maui-windows + - name: Install .NET Workloads (macOS) + if: startsWith(matrix.os, 'macos') + run: dotnet workload install maui-android maui-ios maui-maccatalyst - name: Build run: dotnet build ${{ matrix.slnf }} -c Release /p:CopyLocalLockFileAssemblies=true @@ -98,6 +94,11 @@ jobs: if: startsWith(matrix.os, 'windows') run: dotnet pack ${{ matrix.slnf }} -c Release --no-build + - name: Pack (MAUI) + # only pack on macos since we need ios native targets included + if: startsWith(matrix.os, 'macos') + run: dotnet pack src/Sentry.Maui -c Release --no-build + - name: Upload Verify Results if: failure() uses: actions/upload-artifact@v3 @@ -115,3 +116,13 @@ jobs: if-no-files-found: error path: | ${{ github.workspace }}/src/**/Release/*.nupkg + + - name: Archive Artifacts (MAUI) + # only archive MAUI on macos since we only pack MAUI on macos. See Pack step. + if: startsWith(matrix.os, 'macos') + uses: actions/upload-artifact@v3 + with: + name: ${{ github.sha }} + if-no-files-found: error + path: | + ${{ github.workspace }}/src/Sentry.Maui/bin/Release/*.nupkg diff --git a/CHANGELOG.md b/CHANGELOG.md index c9029841f3..2721033478 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ ## Unreleased +### Features + +- Initial support for .NET MAUI ([#1663](https://github.com/getsentry/sentry-dotnet/pull/1663)) +- Initial support for `net6.0-android` apps ([#1288](https://github.com/getsentry/sentry-dotnet/pull/1288)) + ### Fixes - Remove IInternalSdkIntegration ([#1656](https://github.com/getsentry/sentry-dotnet/pull/1656)) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0fcb59dd46..00f99a2ced 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -23,6 +23,11 @@ For big feature it's advised to raise an issue to discuss it first. - `Sentry.DiagnosticSource.IntegrationTests.csproj` uses [SQL LocalDb](https://docs.microsoft.com/en-us/sql/database-engine/configure-windows/sql-server-express-localdb) - [download SQL LocalDB 2019](https://download.microsoft.com/download/7/c/1/7c14e92e-bdcb-4f89-b7cf-93543e7112d1/SqlLocalDB.msi). To avoid running these tests, unload `Sentry.DiagnosticSource.IntegrationTests.csproj` from the solution. * On macOS/Linux: [Mono 6 or higher](https://www.mono-project.com/download/stable) to run the unit tests on the `net4x` targets. +## .NET MAUI Requirements + +To build any of `Sentry.Maui`, `Sentry.Maui.Tests`, or `Sentry.Samples.Maui`, you'll need to have .NET SDK 6.0.300 or greater installed, and have installed the MAUI workload installed, either through Visual Studio setup, or through `dotnet workload install maui`. +You may also need other platform dependencies. See https://docs.microsoft.com/dotnet/maui/ for details. Basically, if you can build and run the "MyMauiApp" example you should also be able to build and run the Sentry MAUI sample app. + ## API changes approval process This repository uses [Verify](https://github.com/VerifyTests/Verify) to store the public API diffs in snapshot files. diff --git a/Sentry.sln b/Sentry.sln index 667994d33c..5cece0360a 100644 --- a/Sentry.sln +++ b/Sentry.sln @@ -141,6 +141,12 @@ EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sentry.Samples.Android", "samples\Sentry.Samples.Android\Sentry.Samples.Android.csproj", "{5CB9167E-ED23-4A67-8D3A-B66B0C5196C8}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sentry.DiagnosticSource.IntegrationTests", "test\Sentry.DiagnosticSource.IntegrationTests\Sentry.DiagnosticSource.IntegrationTests.csproj", "{F8120B9C-D4CA-43DA-B5E1-1CFBA7C36E3B}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sentry.Samples.Maui", "samples\Sentry.Samples.Maui\Sentry.Samples.Maui.csproj", "{EBCCABF9-F670-4C8D-AABC-4EB132961929}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sentry.Maui", "src\Sentry.Maui\Sentry.Maui.csproj", "{FFFC74C5-680B-43E3-9C42-A7A23B589CB6}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sentry.Maui.Tests", "test\Sentry.Maui.Tests\Sentry.Maui.Tests.csproj", "{143076C0-8D6B-4054-9F45-06B21655F417}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -325,6 +331,18 @@ Global {F8120B9C-D4CA-43DA-B5E1-1CFBA7C36E3B}.Debug|Any CPU.Build.0 = Debug|Any CPU {F8120B9C-D4CA-43DA-B5E1-1CFBA7C36E3B}.Release|Any CPU.ActiveCfg = Release|Any CPU {F8120B9C-D4CA-43DA-B5E1-1CFBA7C36E3B}.Release|Any CPU.Build.0 = Release|Any CPU + {EBCCABF9-F670-4C8D-AABC-4EB132961929}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EBCCABF9-F670-4C8D-AABC-4EB132961929}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EBCCABF9-F670-4C8D-AABC-4EB132961929}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EBCCABF9-F670-4C8D-AABC-4EB132961929}.Release|Any CPU.Build.0 = Release|Any CPU + {FFFC74C5-680B-43E3-9C42-A7A23B589CB6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FFFC74C5-680B-43E3-9C42-A7A23B589CB6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FFFC74C5-680B-43E3-9C42-A7A23B589CB6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FFFC74C5-680B-43E3-9C42-A7A23B589CB6}.Release|Any CPU.Build.0 = Release|Any CPU + {143076C0-8D6B-4054-9F45-06B21655F417}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {143076C0-8D6B-4054-9F45-06B21655F417}.Debug|Any CPU.Build.0 = Debug|Any CPU + {143076C0-8D6B-4054-9F45-06B21655F417}.Release|Any CPU.ActiveCfg = Release|Any CPU + {143076C0-8D6B-4054-9F45-06B21655F417}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -377,6 +395,9 @@ Global {D870B028-16ED-4551-8B0F-5529479D04C9} = {83263231-1A2A-4733-B759-EEFF14E8C5D5} {5CB9167E-ED23-4A67-8D3A-B66B0C5196C8} = {77454495-55EE-4B40-A089-71B9E8F82E89} {F8120B9C-D4CA-43DA-B5E1-1CFBA7C36E3B} = {83263231-1A2A-4733-B759-EEFF14E8C5D5} + {EBCCABF9-F670-4C8D-AABC-4EB132961929} = {77454495-55EE-4B40-A089-71B9E8F82E89} + {FFFC74C5-680B-43E3-9C42-A7A23B589CB6} = {AF6AF4C7-8AA2-4D59-8064-2D79560904EB} + {143076C0-8D6B-4054-9F45-06B21655F417} = {83263231-1A2A-4733-B759-EEFF14E8C5D5} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {0C652B1A-DF72-4EE5-A98B-194FE2C054F6} diff --git a/SentryCore.slnf b/SentryCore.slnf index fb20eecdeb..1b8c350a75 100644 --- a/SentryCore.slnf +++ b/SentryCore.slnf @@ -7,4 +7,4 @@ "test\\Sentry.Tests\\Sentry.Tests.csproj" ] } -} \ No newline at end of file +} diff --git a/SentryLinux.slnf b/SentryLinux.slnf index 5ea34ea00f..e1f213ea31 100644 --- a/SentryLinux.slnf +++ b/SentryLinux.slnf @@ -46,4 +46,4 @@ "test\\Sentry.Tunnel.Tests\\Sentry.Tunnel.Tests.csproj" ] } -} \ No newline at end of file +} diff --git a/SentryMac.slnf b/SentryMac.slnf index ea0084adf0..687e88b636 100644 --- a/SentryMac.slnf +++ b/SentryMac.slnf @@ -17,6 +17,7 @@ "samples\\Sentry.Samples.GenericHost\\Sentry.Samples.GenericHost.csproj", "samples\\Sentry.Samples.Google.Cloud.Functions\\Sentry.Samples.Google.Cloud.Functions.csproj", "samples\\Sentry.Samples.Log4Net\\Sentry.Samples.Log4Net.csproj", + "samples\\Sentry.Samples.Maui\\Sentry.Samples.Maui.csproj", "samples\\Sentry.Samples.ME.Logging\\Sentry.Samples.ME.Logging.csproj", "samples\\Sentry.Samples.NLog\\Sentry.Samples.NLog.csproj", "samples\\Sentry.Samples.Serilog\\Sentry.Samples.Serilog.csproj", @@ -28,6 +29,7 @@ "src\\Sentry.Extensions.Logging\\Sentry.Extensions.Logging.csproj", "src\\Sentry.Google.Cloud.Functions\\Sentry.Google.Cloud.Functions.csproj", "src\\Sentry.Log4Net\\Sentry.Log4Net.csproj", + "src\\Sentry.Maui\\Sentry.Maui.csproj", "src\\Sentry.NLog\\Sentry.NLog.csproj", "src\\Sentry.Serilog\\Sentry.Serilog.csproj", "src\\Sentry.Tunnel\\Sentry.Tunnel.csproj", @@ -40,6 +42,7 @@ "test\\Sentry.Extensions.Logging.Tests\\Sentry.Extensions.Logging.Tests.csproj", "test\\Sentry.Google.Cloud.Functions.Tests\\Sentry.Google.Cloud.Functions.Tests.csproj", "test\\Sentry.Log4Net.Tests\\Sentry.Log4Net.Tests.csproj", + "test\\Sentry.Maui.Tests\\Sentry.Maui.Tests.csproj", "test\\Sentry.NLog.Tests\\Sentry.NLog.Tests.csproj", "test\\Sentry.Serilog.Tests\\Sentry.Serilog.Tests.csproj", "test\\Sentry.Testing\\Sentry.Testing.csproj", @@ -47,4 +50,4 @@ "test\\Sentry.Tunnel.Tests\\Sentry.Tunnel.Tests.csproj" ] } -} \ No newline at end of file +} diff --git a/SentryMaui.slnf b/SentryMaui.slnf new file mode 100644 index 0000000000..14280443f8 --- /dev/null +++ b/SentryMaui.slnf @@ -0,0 +1,15 @@ +{ + "solution": { + "path": "Sentry.sln", + "projects": [ + "samples\\Sentry.Samples.Maui\\Sentry.Samples.Maui.csproj", + "src\\Sentry.Extensions.Logging\\Sentry.Extensions.Logging.csproj", + "src\\Sentry.Maui\\Sentry.Maui.csproj", + "src\\Sentry\\Sentry.csproj", + "test\\Sentry.Extensions.Logging.Tests\\Sentry.Extensions.Logging.Tests.csproj", + "test\\Sentry.Maui.Tests\\Sentry.Maui.Tests.csproj", + "test\\Sentry.Testing\\Sentry.Testing.csproj", + "test\\Sentry.Tests\\Sentry.Tests.csproj" + ] + } +} diff --git a/SentryNoSamples.slnf b/SentryNoSamples.slnf index 36d3bf0b6f..acced0ac2b 100644 --- a/SentryNoSamples.slnf +++ b/SentryNoSamples.slnf @@ -11,6 +11,7 @@ "src\\Sentry.Extensions.Logging\\Sentry.Extensions.Logging.csproj", "src\\Sentry.Google.Cloud.Functions\\Sentry.Google.Cloud.Functions.csproj", "src\\Sentry.Log4Net\\Sentry.Log4Net.csproj", + "src\\Sentry.Maui\\Sentry.Maui.csproj", "src\\Sentry.NLog\\Sentry.NLog.csproj", "src\\Sentry.Serilog\\Sentry.Serilog.csproj", "src\\Sentry.Tunnel\\Sentry.Tunnel.csproj", @@ -24,6 +25,7 @@ "test\\Sentry.Extensions.Logging.Tests\\Sentry.Extensions.Logging.Tests.csproj", "test\\Sentry.Google.Cloud.Functions.Tests\\Sentry.Google.Cloud.Functions.Tests.csproj", "test\\Sentry.Log4Net.Tests\\Sentry.Log4Net.Tests.csproj", + "test\\Sentry.Maui.Tests\\Sentry.Maui.Tests.csproj", "test\\Sentry.NLog.Tests\\Sentry.NLog.Tests.csproj", "test\\Sentry.Serilog.Tests\\Sentry.Serilog.Tests.csproj", "test\\Sentry.Testing\\Sentry.Testing.csproj", @@ -31,4 +33,4 @@ "test\\Sentry.Tunnel.Tests\\Sentry.Tunnel.Tests.csproj" ] } -} \ No newline at end of file +} diff --git a/SentryWindows.slnf b/SentryWindows.slnf index ea0084adf0..687e88b636 100644 --- a/SentryWindows.slnf +++ b/SentryWindows.slnf @@ -17,6 +17,7 @@ "samples\\Sentry.Samples.GenericHost\\Sentry.Samples.GenericHost.csproj", "samples\\Sentry.Samples.Google.Cloud.Functions\\Sentry.Samples.Google.Cloud.Functions.csproj", "samples\\Sentry.Samples.Log4Net\\Sentry.Samples.Log4Net.csproj", + "samples\\Sentry.Samples.Maui\\Sentry.Samples.Maui.csproj", "samples\\Sentry.Samples.ME.Logging\\Sentry.Samples.ME.Logging.csproj", "samples\\Sentry.Samples.NLog\\Sentry.Samples.NLog.csproj", "samples\\Sentry.Samples.Serilog\\Sentry.Samples.Serilog.csproj", @@ -28,6 +29,7 @@ "src\\Sentry.Extensions.Logging\\Sentry.Extensions.Logging.csproj", "src\\Sentry.Google.Cloud.Functions\\Sentry.Google.Cloud.Functions.csproj", "src\\Sentry.Log4Net\\Sentry.Log4Net.csproj", + "src\\Sentry.Maui\\Sentry.Maui.csproj", "src\\Sentry.NLog\\Sentry.NLog.csproj", "src\\Sentry.Serilog\\Sentry.Serilog.csproj", "src\\Sentry.Tunnel\\Sentry.Tunnel.csproj", @@ -40,6 +42,7 @@ "test\\Sentry.Extensions.Logging.Tests\\Sentry.Extensions.Logging.Tests.csproj", "test\\Sentry.Google.Cloud.Functions.Tests\\Sentry.Google.Cloud.Functions.Tests.csproj", "test\\Sentry.Log4Net.Tests\\Sentry.Log4Net.Tests.csproj", + "test\\Sentry.Maui.Tests\\Sentry.Maui.Tests.csproj", "test\\Sentry.NLog.Tests\\Sentry.NLog.Tests.csproj", "test\\Sentry.Serilog.Tests\\Sentry.Serilog.Tests.csproj", "test\\Sentry.Testing\\Sentry.Testing.csproj", @@ -47,4 +50,4 @@ "test\\Sentry.Tunnel.Tests\\Sentry.Tunnel.Tests.csproj" ] } -} \ No newline at end of file +} diff --git a/samples/Directory.Build.props b/samples/Directory.Build.props index af7b16e9f3..8a3ecb1283 100644 --- a/samples/Directory.Build.props +++ b/samples/Directory.Build.props @@ -5,6 +5,7 @@ false + false diff --git a/samples/Sentry.Samples.Maui/App.xaml b/samples/Sentry.Samples.Maui/App.xaml new file mode 100644 index 0000000000..5d3ae265db --- /dev/null +++ b/samples/Sentry.Samples.Maui/App.xaml @@ -0,0 +1,14 @@ + + + + + + + + + + + diff --git a/samples/Sentry.Samples.Maui/App.xaml.cs b/samples/Sentry.Samples.Maui/App.xaml.cs new file mode 100644 index 0000000000..89be30a093 --- /dev/null +++ b/samples/Sentry.Samples.Maui/App.xaml.cs @@ -0,0 +1,11 @@ +namespace Sentry.Samples.Maui; + +public partial class App : Application +{ + public App() + { + InitializeComponent(); + + MainPage = new AppShell(); + } +} diff --git a/samples/Sentry.Samples.Maui/AppShell.xaml b/samples/Sentry.Samples.Maui/AppShell.xaml new file mode 100644 index 0000000000..43dc3247fa --- /dev/null +++ b/samples/Sentry.Samples.Maui/AppShell.xaml @@ -0,0 +1,14 @@ + + + + + + diff --git a/samples/Sentry.Samples.Maui/AppShell.xaml.cs b/samples/Sentry.Samples.Maui/AppShell.xaml.cs new file mode 100644 index 0000000000..0dfa23f634 --- /dev/null +++ b/samples/Sentry.Samples.Maui/AppShell.xaml.cs @@ -0,0 +1,9 @@ +namespace Sentry.Samples.Maui; + +public partial class AppShell : Shell +{ + public AppShell() + { + InitializeComponent(); + } +} diff --git a/samples/Sentry.Samples.Maui/MainPage.xaml b/samples/Sentry.Samples.Maui/MainPage.xaml new file mode 100644 index 0000000000..ee1f3e7b02 --- /dev/null +++ b/samples/Sentry.Samples.Maui/MainPage.xaml @@ -0,0 +1,48 @@ + + + + + + + + +