Skip to content

Commit d6bb57d

Browse files
Merge branch 'main' into android-release-symbols
2 parents 2c13d2f + a46bce2 commit d6bb57d

File tree

16 files changed

+89
-393
lines changed

16 files changed

+89
-393
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
# Changelog
22

3-
## Unreleased
3+
## 5.8.1
44

55
### Fixes
66

7+
- Revert W3C traceparent support ([#4204](https://github.com/getsentry/sentry-dotnet/pull/4204))
78
- Support musl on Linux ([#4188](https://github.com/getsentry/sentry-dotnet/pull/4188))
89
- Support for Windows ARM64 with Native AOT ([#4187](https://github.com/getsentry/sentry-dotnet/pull/4187))
910
- Addressed potential performance issue with Sentry.Maui ([#4219](https://github.com/getsentry/sentry-dotnet/pull/4219))
11+
- Respect `SentryNative=false` at runtime ([#4220](https://github.com/getsentry/sentry-dotnet/pull/4220))
1012

1113
## 5.8.0
1214

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project>
22

33
<PropertyGroup>
4-
<VersionPrefix>5.8.0</VersionPrefix>
4+
<VersionPrefix>5.8.1</VersionPrefix>
55
<LangVersion>13</LangVersion>
66
<AccelerateBuildsInVisualStudio>true</AccelerateBuildsInVisualStudio>
77
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>

integration-test/runtime.Tests.ps1

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,18 +68,28 @@ internal class FakeTransport : ITransport
6868
}
6969
}
7070

71+
function publishConsoleApp([bool]$SentryNative = $true)
72+
{
73+
dotnet publish console-app `
74+
-c Release `
75+
--nologo `
76+
--framework $framework `
77+
-p:SentryNative=$($SentryNative.ToString().ToLower()) `
78+
| ForEach-Object { Write-Host $_ }
79+
if ($LASTEXITCODE -ne 0)
80+
{
81+
throw 'Failed to publish the test app project.'
82+
}
83+
}
84+
7185
function runConsoleApp([bool]$IsAOT = $true, [string]$CrashType = 'Managed', [string]$Dsn = 'http://key@127.0.0.1:9999/123')
7286
{
7387
if ($IsAOT)
7488
{
7589
$executable = getConsoleAppPath
7690
If (!(Test-Path $executable))
7791
{
78-
dotnet publish console-app -c Release --nologo --framework $framework | ForEach-Object { Write-Host $_ }
79-
if ($LASTEXITCODE -ne 0)
80-
{
81-
throw 'Failed to publish the test app project.'
82-
}
92+
publishConsoleApp
8393
}
8494
}
8595
else
@@ -90,7 +100,7 @@ internal class FakeTransport : ITransport
90100
Write-Host "::group::Executing $executable"
91101
try
92102
{
93-
Invoke-Expression $executable | ForEach-Object {
103+
Invoke-Expression "$executable 2>&1" | ForEach-Object {
94104
Write-Host " $_"
95105
$_
96106
}
@@ -120,8 +130,19 @@ internal class FakeTransport : ITransport
120130
"console-app$exeExtension", "console-app$debugExtension") | Sort-Object -Unique)
121131
}
122132

123-
It "'dotnet publish' produces an app that's recognized as AOT by Sentry" {
124-
runConsoleApp | Should -AnyElementMatch 'This looks like a Native AOT application build.'
133+
It "'dotnet publish' produces an app that's recognized as AOT by Sentry (SentryNative=<_>)" -ForEach @($false, $true) {
134+
publishConsoleApp $_
135+
$output = runConsoleApp
136+
$output | Should -AnyElementMatch 'This looks like a Native AOT application build.'
137+
$output | Should -Not -AnyElementMatch 'System.DllNotFoundException: Unable to load (shared library|DLL) ''sentry-native'' or one of its dependencies'
138+
if ($_)
139+
{
140+
$output | Should -AnyElementMatch 'Initializing sentry native'
141+
}
142+
else
143+
{
144+
$output | Should -Not -AnyElementMatch 'Initializing sentry native'
145+
}
125146
}
126147

127148
It "'dotnet run' produces an app that's recognized as JIT by Sentry" {

src/Sentry.AspNet/HttpContextExtensions.cs

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -34,27 +34,6 @@ public static class HttpContextExtensions
3434
}
3535
}
3636

37-
private static W3CTraceHeader? TryGetW3CTraceHeader(HttpContext context, SentryOptions? options)
38-
{
39-
var value = context.Request.Headers.Get(W3CTraceHeader.HttpHeaderName);
40-
if (string.IsNullOrWhiteSpace(value))
41-
{
42-
return null;
43-
}
44-
45-
options?.LogDebug("Received Sentry trace header '{0}'.", value);
46-
47-
try
48-
{
49-
return W3CTraceHeader.Parse(value);
50-
}
51-
catch (Exception ex)
52-
{
53-
options?.LogError(ex, "Invalid Sentry trace header '{0}'.", value);
54-
return null;
55-
}
56-
}
57-
5837
private static BaggageHeader? TryGetBaggageHeader(HttpContext context, SentryOptions? options)
5938
{
6039
var value = context.Request.Headers.Get(BaggageHeader.HttpHeaderName);
@@ -86,10 +65,7 @@ public static void StartOrContinueTrace(this HttpContext httpContext)
8665
{
8766
var options = SentrySdk.CurrentOptions;
8867

89-
// If both sentry-trace and traceparent headers are present, sentry-trace takes precedence.
90-
// See: https://github.com/getsentry/team-sdks/issues/41
9168
var traceHeader = TryGetSentryTraceHeader(httpContext, options);
92-
traceHeader ??= TryGetW3CTraceHeader(httpContext, options)?.SentryTraceHeader;
9369
var baggageHeader = TryGetBaggageHeader(httpContext, options);
9470

9571
var method = httpContext.Request.HttpMethod;

src/Sentry.AspNetCore/Extensions/HttpContextExtensions.cs

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -65,27 +65,6 @@ internal static class HttpContextExtensions
6565
}
6666
}
6767

68-
public static W3CTraceHeader? TryGetW3CTraceHeader(this HttpContext context, SentryOptions? options)
69-
{
70-
var value = context.Request.Headers.GetValueOrDefault(W3CTraceHeader.HttpHeaderName);
71-
if (string.IsNullOrWhiteSpace(value))
72-
{
73-
return null;
74-
}
75-
76-
options?.LogDebug("Received Sentry trace header '{0}'.", value);
77-
78-
try
79-
{
80-
return W3CTraceHeader.Parse(value!);
81-
}
82-
catch (Exception ex)
83-
{
84-
options?.LogError(ex, "Invalid Sentry trace header '{0}'.", value);
85-
return null;
86-
}
87-
}
88-
8968
public static BaggageHeader? TryGetBaggageHeader(this HttpContext context, SentryOptions? options)
9069
{
9170
var value = context.Request.Headers.GetValueOrDefault(BaggageHeader.HttpHeaderName);

src/Sentry.AspNetCore/SentryMiddleware.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,7 @@ public async Task InvokeAsync(HttpContext context, RequestDelegate next)
105105
context.Response.OnCompleted(() => hub.FlushAsync(_options.FlushTimeout));
106106
}
107107

108-
// If both sentry-trace and traceparent headers are present, sentry-trace takes precedence.
109-
// See: https://github.com/getsentry/team-sdks/issues/41
110108
var traceHeader = context.TryGetSentryTraceHeader(_options);
111-
traceHeader ??= context.TryGetW3CTraceHeader(_options)?.SentryTraceHeader;
112109
var baggageHeader = context.TryGetBaggageHeader(_options);
113110
var transactionContext = hub.ContinueTrace(traceHeader, baggageHeader);
114111

src/Sentry.Azure.Functions.Worker/HttpRequestDataExtensions.cs

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -30,31 +30,6 @@ internal static class HttpRequestDataExtensions
3030
}
3131
}
3232

33-
public static W3CTraceHeader? TryGetW3CTraceHeader(this HttpRequestData context, IDiagnosticLogger? logger)
34-
{
35-
var traceHeaderValue = context.Headers.TryGetValues(W3CTraceHeader.HttpHeaderName, out var values)
36-
? values.FirstOrDefault()
37-
: null;
38-
39-
if (traceHeaderValue is null)
40-
{
41-
logger?.LogDebug("Did not receive a Sentry trace header.");
42-
return null;
43-
}
44-
45-
logger?.LogDebug("Received Sentry trace header '{0}'.", traceHeaderValue);
46-
47-
try
48-
{
49-
return W3CTraceHeader.Parse(traceHeaderValue);
50-
}
51-
catch (Exception ex)
52-
{
53-
logger?.LogError(ex, "Invalid Sentry trace header '{0}'.", traceHeaderValue);
54-
return null;
55-
}
56-
}
57-
5833
public static BaggageHeader? TryGetBaggageHeader(this HttpRequestData context, IDiagnosticLogger? logger)
5934
{
6035
var baggageValue = context.Headers.TryGetValues(BaggageHeader.HttpHeaderName, out var value)

src/Sentry.Azure.Functions.Worker/SentryFunctionsWorkerMiddleware.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,7 @@ private async Task<TransactionContext> StartOrContinueTraceAsync(FunctionContext
123123
TransactionNameCache.TryAdd(transactionNameKey, transactionName);
124124
}
125125

126-
// If both sentry-trace and traceparent headers are present, sentry-trace takes precedence.
127-
// See: https://github.com/getsentry/team-sdks/issues/41
128126
var traceHeader = requestData.TryGetSentryTraceHeader(_logger);
129-
traceHeader ??= requestData.TryGetW3CTraceHeader(_logger)?.SentryTraceHeader;
130127
var baggageHeader = requestData.TryGetBaggageHeader(_logger);
131128

132129
return SentrySdk.ContinueTrace(traceHeader, baggageHeader, transactionName, Operation);

src/Sentry/Internal/DebugStackTrace.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,10 @@ private IEnumerable<SentryStackFrame> CreateFrames(StackTrace stackTrace, bool i
261261
#elif __IOS__ || MACCATALYST
262262
_nativeDebugImages ??= Sentry.Cocoa.C.LoadDebugImages(_options.DiagnosticLogger);
263263
#else
264+
if (!SentryNative.IsAvailable)
265+
{
266+
_nativeDebugImages ??= new();
267+
}
264268
_nativeDebugImages ??= Sentry.Native.C.LoadDebugImages(_options.DiagnosticLogger);
265269
#endif
266270

src/Sentry/Platforms/Native/buildTransitive/Sentry.Native.targets

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
<!-- SentryNative.IsEnabled should result in compile-time constant for trimmed applications -->
1414
<!-- Effectively disabling native library -->
1515
<RuntimeHostConfigurationOption Include="Sentry.Native.IsEnabled"
16-
Condition="'$(SentryNative)' != 'false' and '$(SentryNative)' != 'disable'"
17-
Value="true"
16+
Condition="'$(SentryNative)' == 'false' or '$(SentryNative)' == 'disable'"
17+
Value="false"
1818
Trim="true" />
1919
</ItemGroup>
2020

0 commit comments

Comments
 (0)