Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- Support musl on Linux ([#4188](https://github.com/getsentry/sentry-dotnet/pull/4188))
- Support for Windows ARM64 with Native AOT ([#4187](https://github.com/getsentry/sentry-dotnet/pull/4187))
- Addressed potential performance issue with Sentry.Maui ([#4219](https://github.com/getsentry/sentry-dotnet/pull/4219))
- Respect `SentryNative=false` at runtime ([#4220](https://github.com/getsentry/sentry-dotnet/pull/4220))

## 5.8.0

Expand Down
37 changes: 29 additions & 8 deletions integration-test/runtime.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -68,18 +68,28 @@ internal class FakeTransport : ITransport
}
}

function publishConsoleApp([bool]$SentryNative = $true)
{
dotnet publish console-app `
-c Release `
--nologo `
--framework $framework `
-p:SentryNative=$($SentryNative.ToString().ToLower()) `
| ForEach-Object { Write-Host $_ }
if ($LASTEXITCODE -ne 0)
{
throw 'Failed to publish the test app project.'
}
}

function runConsoleApp([bool]$IsAOT = $true, [string]$CrashType = 'Managed', [string]$Dsn = 'http://key@127.0.0.1:9999/123')
{
if ($IsAOT)
{
$executable = getConsoleAppPath
If (!(Test-Path $executable))
{
dotnet publish console-app -c Release --nologo --framework $framework | ForEach-Object { Write-Host $_ }
if ($LASTEXITCODE -ne 0)
{
throw 'Failed to publish the test app project.'
}
publishConsoleApp
}
}
else
Expand All @@ -90,7 +100,7 @@ internal class FakeTransport : ITransport
Write-Host "::group::Executing $executable"
try
{
Invoke-Expression $executable | ForEach-Object {
Invoke-Expression "$executable 2>&1" | ForEach-Object {
Write-Host " $_"
$_
}
Expand Down Expand Up @@ -120,8 +130,19 @@ internal class FakeTransport : ITransport
"console-app$exeExtension", "console-app$debugExtension") | Sort-Object -Unique)
}

It "'dotnet publish' produces an app that's recognized as AOT by Sentry" {
runConsoleApp | Should -AnyElementMatch 'This looks like a Native AOT application build.'
It "'dotnet publish' produces an app that's recognized as AOT by Sentry (SentryNative=<_>)" -ForEach @($false, $true) {
publishConsoleApp $_
$output = runConsoleApp
$output | Should -AnyElementMatch 'This looks like a Native AOT application build.'
$output | Should -Not -AnyElementMatch 'System.DllNotFoundException: Unable to load (shared library|DLL) ''sentry-native'' or one of its dependencies'
if ($_)
{
$output | Should -AnyElementMatch 'Initializing sentry native'
}
else
{
$output | Should -Not -AnyElementMatch 'Initializing sentry native'
}
}

It "'dotnet run' produces an app that's recognized as JIT by Sentry" {
Expand Down
4 changes: 4 additions & 0 deletions src/Sentry/Internal/DebugStackTrace.cs
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,10 @@ private IEnumerable<SentryStackFrame> CreateFrames(StackTrace stackTrace, bool i
#elif __IOS__ || MACCATALYST
_nativeDebugImages ??= Sentry.Cocoa.C.LoadDebugImages(_options.DiagnosticLogger);
#else
if (!SentryNative.IsAvailable)
{
_nativeDebugImages ??= new();
}
_nativeDebugImages ??= Sentry.Native.C.LoadDebugImages(_options.DiagnosticLogger);
#endif

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
<!-- SentryNative.IsEnabled should result in compile-time constant for trimmed applications -->
<!-- Effectively disabling native library -->
<RuntimeHostConfigurationOption Include="Sentry.Native.IsEnabled"
Condition="'$(SentryNative)' != 'false' and '$(SentryNative)' != 'disable'"
Value="true"
Condition="'$(SentryNative)' == 'false' or '$(SentryNative)' == 'disable'"
Value="false"
Trim="true" />
</ItemGroup>

Expand Down
Loading