Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add net9.0 support #3699

Merged
merged 37 commits into from
Nov 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
c64ca21
Add net9.0 support
jamescrosswell Oct 22, 2024
582045d
Workaround CastleProxy errors in device tests
jamescrosswell Oct 22, 2024
d3c40ca
Skip SystemDiagnosticsMetricsListenerTests in DeviceTests (will depre…
jamescrosswell Oct 22, 2024
df2cd5e
Disabled Handle_UnobservedTaskException_CaptureEvent (flaky test)
jamescrosswell Oct 22, 2024
1154070
Update CHANGELOG.md
jamescrosswell Oct 22, 2024
10550f7
Merge branch 'version-5.0.0' into net9
jamescrosswell Oct 22, 2024
f013b99
Made logic for detecting net8.0 or later more robust in Sentry.target…
jamescrosswell Oct 22, 2024
bdca1bb
Bump device tests to Xcode 16
jamescrosswell Oct 22, 2024
8150ca8
Moved error from runtime to compile time in SingleFileApp
jamescrosswell Oct 22, 2024
968e87b
Bump to XHarness 10 (prerelease)
jamescrosswell Oct 22, 2024
c3231da
Format code
getsentry-bot Oct 22, 2024
93a950b
Merge branch 'version-5.0.0' into net9
jamescrosswell Oct 27, 2024
ba88d7e
Removed reference to obsolete member (Java SDK)
jamescrosswell Oct 28, 2024
4a30dfd
Disabled iOS device tests
jamescrosswell Oct 28, 2024
813a119
Removed hard coded alpha VersionSuffix
jamescrosswell Oct 28, 2024
5efc0d5
Update ApiApprovalTests.Run.DotNet9_0.verified.txt
jamescrosswell Oct 28, 2024
5beafd0
Debug native library references in integration tests on CI
jamescrosswell Oct 28, 2024
196d00d
Reenable iOS device tests
jamescrosswell Oct 29, 2024
c9f3bc3
Fixed typo in MS Build condition on FrameworkSupportsNative
jamescrosswell Oct 29, 2024
faad873
Added temporary diagnostic logging to device-tests-ios.yml
jamescrosswell Oct 29, 2024
306eefc
Update Sentry.Samples.Maui.csproj
jamescrosswell Oct 29, 2024
301a854
Update device-tests-ios.yml
jamescrosswell Oct 29, 2024
ec2335e
Update device-test.ps1
jamescrosswell Oct 29, 2024
58206a9
Update device-tests-ios.yml
jamescrosswell Oct 30, 2024
7261983
Update build.yml
jamescrosswell Oct 30, 2024
bcc3f00
Disable Flaky tests
jamescrosswell Oct 30, 2024
d45ea42
Update Sentry.Native.targets
jamescrosswell Oct 30, 2024
830ba36
Update Sentry.Native.targets
jamescrosswell Oct 30, 2024
867073e
Merge branch 'version-5.0.0' into net9
jamescrosswell Oct 30, 2024
4f59199
Update verify tests
jamescrosswell Oct 30, 2024
bab8ee7
Update SentryOptionsTests.Integrations_default_ones_are_properly_regi…
jamescrosswell Oct 31, 2024
8699018
Update CHANGELOG.md
jamescrosswell Oct 31, 2024
97b8a65
Update LocalDbFixture.cs
jamescrosswell Oct 31, 2024
3da79c2
Merge branch 'net9' of github.com:getsentry/sentry-dotnet into net9
jamescrosswell Oct 31, 2024
480814b
Format code
getsentry-bot Oct 31, 2024
e0ceb09
Update HubTests.cs
jamescrosswell Oct 31, 2024
ef82fb9
Merge branch 'net9' of github.com:getsentry/sentry-dotnet into net9
jamescrosswell Oct 31, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/actions/environment/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,19 @@ runs:

# .NET 6 and .NET 8 are not built-in with macos-13
- name: Install .NET SDK
uses: actions/setup-dotnet@v3
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.0.x
7.0.x
8.0.x
9.0.100-rc.2.24474.11

- name: Install .NET Workloads
shell: bash
run: >
dotnet workload install \
wasm-tools maui-android \
wasm-tools wasm-tools-net8 maui-android \
${{ runner.os == 'macOS' && 'maui-ios maui-maccatalyst maui-windows macos' || '' }} \
${{ runner.os == 'Windows' && 'maui-windows' || '' }} \
--temp-dir "${{ runner.temp }}" \
Expand Down
48 changes: 48 additions & 0 deletions .github/actions/freediskspace/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Remove unused applications
description: Frees disk space by removing unused applications
runs:
using: composite
steps:

- name: Free Disk Space
if: runner.os == 'Linux'
uses: jlumbroso/free-disk-space@f68fdb76e2ea636224182cfb7377ff9a1708f9b8
with:
android: false
dotnet: false
haskell: true
large-packages: false
docker-images: true
swap-storage: true

# TODO: Do we need all of these or just one?
# 514M /usr/lib/llvm-15
# 486M /usr/lib/llvm-14
# 448M /usr/lib/llvm-13
- name: Remove unused applications
if: runner.os == 'Linux'
shell: bash
run: |
df -h /dev/root
sudo rm -rf /usr/local/.ghcup
sudo rm -rf /usr/local/julia1.10.5
sudo rm -rf /usr/lib/heroku
sudo rm -rf /opt/hostedtoolcache/go
sudo rm -rf /opt/hostedtoolcache/Ruby
sudo apt-get remove -y '^mysql-.*' --fix-missing || echo "::warning::The command [sudo apt-get remove -y '^mysql-.*' --fix-missing] failed to complete successfully. Proceeding..."
sudo apt-get autoremove -y || echo "::warning::The command [sudo apt-get autoremove -y] failed to complete successfully. Proceeding..."
sudo apt-get clean || echo "::warning::The command [sudo apt-get clean] failed to complete successfully. Proceeding..."
df -h /dev/root

# We only use Xcode 16
- name: Remove unused applications
if: runner.os == 'macOS'
shell: bash
run: |
df -hI /dev/disk3s1s1
sudo rm -rf /Applications/Xcode_14.3.1.app
sudo rm -rf /Applications/Xcode_15.0.1.app
sudo rm -rf /Applications/Xcode_15.1.app
sudo rm -rf /Applications/Xcode_15.2.app
sudo rm -rf /Applications/Xcode_15.3.app
df -hI /dev/disk3s1s1
49 changes: 18 additions & 31 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ env:
jobs:
build-sentry-native:
name: sentry-native (${{ matrix.os }})
runs-on: ${{ matrix.os }}-latest
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu, windows, macos]
os: [ubuntu-latest, windows-latest, macos-latest]

steps:
- name: Checkout
Expand All @@ -34,16 +34,8 @@ jobs:
key: sentry-native-${{ runner.os }}-${{ hashFiles('scripts/build-sentry-native.ps1') }}-${{ hashFiles('.git/modules/modules/sentry-native/HEAD') }}
enableCrossOsArchive: true

- name: Free Disk Space (Ubuntu)
if: matrix.os == 'ubuntu-latest'
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be
with:
android: true
dotnet: false
haskell: true
large-packages: false
docker-images: false
swap-storage: true
- name: Remove unused applications
uses: ./.github/actions/freediskspace

- name: Install build dependencies
if: steps.cache.outputs.cache-hit != 'true' && runner.os == 'Linux'
Expand All @@ -70,31 +62,22 @@ jobs:
if: github.ref_name != 'main' && !startsWith(github.ref_name, 'release/')
uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # Tag: 0.12.1

- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 2 # default is 1 and codecov needs > 1

- name: Setup Xcode
if: matrix.os == 'macos-latest'
run: |
sudo xcode-select --switch /Applications/Xcode_${{env.XCODE_VERSION}}.app/Contents/Developer
xcodebuild -version

# We only use Xcode 16
- name: Remove unused applications
if: matrix.os == 'macos-latest'
run: |
df -hI /dev/disk3s1s1
sudo rm -rf /Applications/Xcode_14.3.1.app
sudo rm -rf /Applications/Xcode_15.0.1.app
sudo rm -rf /Applications/Xcode_15.1.app
sudo rm -rf /Applications/Xcode_15.2.app
sudo rm -rf /Applications/Xcode_15.3.app
df -hI /dev/disk3s1s1

- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 2 # default is 1 and codecov needs > 1
uses: ./.github/actions/freediskspace

# We use macOS for the final publishing build so we we get all the iOS/macCatalyst targets in the packages
# We use macOS for the final publishing build so we get all the iOS/macCatalyst targets in the packages
- name: Set Environment Variables
if: startsWith(matrix.os, 'macos')
run: echo "CI_PUBLISHING_BUILD=true" >> $GITHUB_ENV
Expand Down Expand Up @@ -199,9 +182,12 @@ jobs:
sudo apt update
sudo apt install libcurl4-openssl-dev

# Possibly instead of installing net9.0 here we could pin the workload version when installing workloads
- uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
dotnet-version: |
8.0.x
9.0.100-rc.2.24474.11

- name: Setup Xcode
if: matrix.os == 'macos-latest'
Expand All @@ -218,7 +204,8 @@ jobs:
- name: Setup Android SDK
uses: android-actions/setup-android@00854ea68c109d98c75d956347303bf7c45b0277 # v3.2.1

- run: dotnet workload install android maui-android
- name: Install android Workloads
run: dotnet workload install maui-android

- name: Test
uses: getsentry/github-workflows/sentry-cli/integration-test/@v2
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ jobs:
languages: csharp

- name: Restore .NET Dependencies
run: dotnet restore Sentry-CI-CodeQL.slnf --nologo
# We should be able to get rid of the restore here, if we install the correct workloads in actions/environment
run: |
dotnet workload restore
dotnet restore Sentry-CI-CodeQL.slnf --nologo

- name: Build
run: dotnet build Sentry-CI-CodeQL.slnf --no-restore --nologo
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/device-tests-android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
with:
name: device-test-android
if-no-files-found: error
path: test/Sentry.Maui.Device.TestApp/bin/Release/net7.0-android/android-x64/io.sentry.dotnet.maui.device.testapp-Signed.apk
path: test/Sentry.Maui.Device.TestApp/bin/Release/net8.0-android/android-x64/io.sentry.dotnet.maui.device.testapp-Signed.apk

android:
needs: [build]
Expand Down
39 changes: 10 additions & 29 deletions .github/workflows/device-tests-ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ on:
paths-ignore:
- "**.md"

env:
XCODE_VERSION: 16

jobs:
build:
# Pinning `macos-13` because Microsoft.iOS 16.4 requires Xcode 14.3 which is only built-in in 13
runs-on: macos-13
ios-tests:
runs-on: macos-latest
env:
DOTNET_CLI_TELEMETRY_OPTOUT: 1
DOTNET_NOLOGO: 1
Expand All @@ -34,35 +36,14 @@ jobs:
- name: Setup Environment
uses: ./.github/actions/environment

- name: Setup Xcode
run: |
sudo xcode-select --switch /Applications/Xcode_${{env.XCODE_VERSION}}.app/Contents/Developer
xcodebuild -version

- name: Build iOS Test App
run: pwsh ./scripts/device-test.ps1 ios -Build

- name: Upload iOS Test App
uses: actions/upload-artifact@v4
with:
name: device-test-ios
if-no-files-found: error
path: test/Sentry.Maui.Device.TestApp/bin/Release/net7.0-ios/iossimulator-x64/Sentry.Maui.Device.TestApp.app

ios:
needs: [build]
name: Run iOS Tests
runs-on: macos-13
strategy:
fail-fast: false
env:
DOTNET_CLI_TELEMETRY_OPTOUT: 1
DOTNET_NOLOGO: 1
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Download test app artifact
uses: actions/download-artifact@v4
with:
name: device-test-ios
path: bin/Sentry.Maui.Device.TestApp.app

- name: Run Tests
id: first-run
continue-on-error: true
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/format-code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,21 @@ jobs:
uses: ./.github/actions/environment

- name: Restore .NET Dependencies
run: dotnet restore Sentry.sln --nologo
# We should be able to get rid of the restore here, if we install the correct workloads in actions/environment
run: |
dotnet workload restore
dotnet restore Sentry.sln --nologo

- name: Install dotnet format
run: dotnet tool install -g dotnet-format

- name: Format Code
# We're excluding `./**/*OptionsSetup.cs` from the format because the tool struggles with
# We're excluding `./**/*OptionsSetup.cs` from the format because the tool struggles with
# source generators
run: dotnet format Sentry.sln --no-restore --exclude ./modules --exclude ./**/*OptionsSetup.cs

# actions/checkout fetches only a single commit in a detached HEAD state. Therefore
# we need to pass the current branch, otherwise we can't commit the changes.
# GITHUB_HEAD_REF is the name of the head branch. GitHub Actions only sets this for PRs.
- name: Commit Formatted Code
run: ./scripts/commit-formatted-code.sh $GITHUB_HEAD_REF
run: ./scripts/commit-formatted-code.sh $GITHUB_HEAD_REF
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
- `Scope.Transaction` is now always stored as an `AsyncLocal` also in [Global Mode](https://docs.sentry.io/platforms/dotnet/configuration/options/#is-global-mode-enabled), to prevent auto-instrumented spans from the UI ending up parented to transactions from a background task (or vice versa). ([#3596](https://github.com/getsentry/sentry-dotnet/pull/3596))
- Sentry's Experimental Metrics feature has been deprecated and removed from the SDK. ([#3718](https://github.com/getsentry/sentry-dotnet/pull/3718))

## Unreleased
### Features
- Added support for `.NET 9` (preview) ([#3699](https://github.com/getsentry/sentry-dotnet/pull/3699))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Added support for `.NET 9` (preview) ([#3699](https://github.com/getsentry/sentry-dotnet/pull/3699))
- Added support for `.NET 9` (preview) ([#3699](https://github.com/getsentry/sentry-dotnet/pull/3699))


## Unreleased

### Features
Expand Down
12 changes: 11 additions & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@

<!-- Allow references to unsigned assemblies (like MAUI) from signed projects -->
<NoWarn>$(NoWarn);CS8002</NoWarn>

<!-- We need to support old stuff. Applications should definitely address these advisory warnings though. -->
<NoWarn>$(NoWarn);NU1903</NoWarn>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since it's a major, it's a good time to review the lowest we support and bump some a bit (not necessarily to latest)


<!-- https://learn.microsoft.com/en-us/dotnet/core/compatibility/sdk/8.0/dotnet-restore-audit#version-introduced -->
<WarningsNotAsErrors>NU1903</WarningsNotAsErrors>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)' != 'Release'">
Expand All @@ -34,10 +40,14 @@
<!--
Note: The following platform-specific properties need to be set in both Directory.Build.props and DirectoryBuild.targets.
TODO: Figure out how to consolidate to a single location.
- Directory.Build.props will get imported at the beginning of the project files, so sets properties that are
prerequisites for the build and can be overriden in the project files.
- Directory.Build.targets will get imported at the end of the project files, so can be used to run common custom
tasks or ultimately override properties set in Directory.Build.props or the project files.
-->
<PropertyGroup>
<TargetPlatformIdentifier>$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)'))</TargetPlatformIdentifier>
<SupportedOSPlatformVersion Condition="'$(TargetPlatformIdentifier)' == 'ios'">10.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="'$(TargetPlatformIdentifier)' == 'ios'">11.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="'$(TargetPlatformIdentifier)' == 'maccatalyst'">13.1</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="'$(TargetPlatformIdentifier)' == 'android'">21.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="'$(TargetPlatformIdentifier)' == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
Expand Down
6 changes: 5 additions & 1 deletion Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@
<!--
Note: The following platform-specific properties need to be set in both Directory.Build.props and DirectoryBuild.targets.
TODO: Figure out how to consolidate to a single location.
- Directory.Build.props will get imported at the beginning of the project files, so sets properties that are
prerequisites for the build and can be overriden in the project files.
- Directory.Build.targets will get imported at the end of the project files, so can be used to run common custom
tasks or ultimately override properties set in Directory.Build.props or the project files.
-->
<PropertyGroup>
<TargetPlatformIdentifier>$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)'))</TargetPlatformIdentifier>
<SupportedOSPlatformVersion Condition="'$(TargetPlatformIdentifier)' == 'ios'">10.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="'$(TargetPlatformIdentifier)' == 'ios'">11.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="'$(TargetPlatformIdentifier)' == 'maccatalyst'">13.1</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="'$(TargetPlatformIdentifier)' == 'android'">21.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="'$(TargetPlatformIdentifier)' == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
Expand Down
6 changes: 6 additions & 0 deletions Sentry.sln
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sentry.Samples.Serilog", "samples\Sentry.Samples.Serilog\Sentry.Samples.Serilog.csproj", "{AA98FD8D-1254-4B34-840C-06BB263933DE}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{230B9384-90FD-4551-A5DE-1A5C197F25B6}"
ProjectSection(SolutionItems) = preProject
src\Directory.Build.props = src\Directory.Build.props
src\Directory.Build.targets = src\Directory.Build.targets
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sentry.Android.AssemblyReader", "src\Sentry.Android.AssemblyReader\Sentry.Android.AssemblyReader.csproj", "{20386BBE-1F55-4503-9F5F-F2C6B29DE865}"
EndProject
Expand Down Expand Up @@ -174,6 +178,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "root", "root", "{233D34AB-9
Directory.Build.targets = Directory.Build.targets
global.json = global.json
nuget.config = nuget.config
.codecov.yml = .codecov.yml
.gitignore = .gitignore
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sentry.AspNetCore.Blazor.WebAssembly", "src\Sentry.AspNetCore.Blazor.WebAssembly\Sentry.AspNetCore.Blazor.WebAssembly.csproj", "{8298202C-9983-4D0A-851D-805539EE481A}"
Expand Down
4 changes: 2 additions & 2 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"sdk": {
"version": "8.0.100",
"version": "9.0.100-rc.2.24474.11",
"rollForward": "latestMinor",
"allowPrerelease": false
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,8 @@
<ProjectReference Include="..\..\src\Sentry.AspNetCore.Blazor.WebAssembly\Sentry.AspNetCore.Blazor.WebAssembly.csproj" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
<!-- https://github.com/advisories/GHSA-hh2w-p6rv-4g7w -->
<PackageReference Include="System.Text.Json" Version="8.0.4" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<OutputType>Exe</OutputType>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<TargetFrameworks>net8.0;net6.0;net462</TargetFrameworks>
<TargetFrameworks>net9.0;net8.0;net6.0;net462</TargetFrameworks>
</PropertyGroup>
<PropertyGroup Condition="$(TargetFramework.StartsWith('net8'))">
<PublishAot>true</PublishAot>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<ItemGroup>
<ProjectReference Include="..\..\src\Sentry.EntityFramework\Sentry.EntityFramework.csproj" />

<PackageReference Include="EntityFramework" Version="6.4.4" />
<PackageReference Include="EntityFramework" Version="6.5.1" />
<PackageReference Include="Effort.EF6" Version="2.2.16" />

<!-- this is needed because the version that is brought in transitively has a vulnerability warning -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<ItemGroup>
<ProjectReference Include="..\..\src\Sentry.Extensions.Logging\Sentry.Extensions.Logging.csproj" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
<!-- https://github.com/advisories/GHSA-hh2w-p6rv-4g7w -->
<PackageReference Include="System.Text.Json" Version="8.0.4" />
</ItemGroup>

</Project>
Loading
Loading