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
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

## Unreleased

### Mobile support changes

.NET 6 on mobile is out of support since May 2023. With .NET 8 coming,
it won't be possible to build .NET 6 Mobile specific targets.
For that reason, we're moving the mobile specific TFMs from `net6.0-platform` to `net7.0-platform`.
Mobile apps still on .NET 6 will pull the `Sentry` .NET 6, which offers the .NET-only features,
without native/platform specific bindings and SDKs. See [this ticket for more details](https://github.com/getsentry/sentry-dotnet/issues/2623).

- Drop .NET 6 Mobile in favor of .NET 7 ([#2624](https://github.com/getsentry/sentry-dotnet/pull/2604))

### Features

- Sentry tracing middleware now gets configured automatically ([#2602](https://github.com/getsentry/sentry-dotnet/pull/2602))
Expand All @@ -11,6 +21,7 @@
- Bump CLI from v2.20.6 to v2.20.7 ([#2604](https://github.com/getsentry/sentry-dotnet/pull/2604))
- [changelog](https://github.com/getsentry/sentry-cli/blob/master/CHANGELOG.md#2207)
- [diff](https://github.com/getsentry/sentry-cli/compare/2.20.6...2.20.7)

## 3.39.1

### Fixes
Expand Down
2 changes: 1 addition & 1 deletion src/Sentry.Bindings.Android/Sentry.Bindings.Android.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0-android</TargetFramework>
<TargetFramework>net7.0-android</TargetFramework>
<!-- BG8605 and BG8606 happen because there's a missing androidx.lifecycle dependency, but we don't need it here. (The native Android Sentry SDK will use it if it exists.) -->
<NoWarn>$(NoWarn);BG8605;BG8606</NoWarn>
<SentryAndroidSdkVersion>6.29.0</SentryAndroidSdkVersion>
Expand Down
6 changes: 3 additions & 3 deletions src/Sentry.Bindings.Cocoa/Sentry.Bindings.Cocoa.csproj
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks Condition="'$(NO_IOS)' == '' And '$(NO_MACCATALYST)' == ''">net6.0-ios;net6.0-maccatalyst</TargetFrameworks>
<TargetFrameworks Condition="'$(NO_IOS)' == '' And '$(NO_MACCATALYST)' == 'true'">net6.0-ios</TargetFrameworks>
<TargetFrameworks Condition="'$(NO_IOS)' == 'true' And '$(NO_MACCATALYST)' == ''">net6.0-maccatalyst</TargetFrameworks>
<TargetFrameworks Condition="'$(NO_IOS)' == '' And '$(NO_MACCATALYST)' == ''">net7.0-ios;net7.0-maccatalyst</TargetFrameworks>
<TargetFrameworks Condition="'$(NO_IOS)' == '' And '$(NO_MACCATALYST)' == 'true'">net7.0-ios</TargetFrameworks>
<TargetFrameworks Condition="'$(NO_IOS)' == 'true' And '$(NO_MACCATALYST)' == ''">net7.0-maccatalyst</TargetFrameworks>
<IsBindingProject>true</IsBindingProject>
<MtouchNoSymbolStrip>true</MtouchNoSymbolStrip>
<Description>.NET Bindings for the Sentry Cocoa SDK</Description>
Expand Down
10 changes: 5 additions & 5 deletions src/Sentry.Maui/Sentry.Maui.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
Target other platforms so we can include platform-specific code, and bundle native SDKs.
-->
<TargetFrameworks>net6.0</TargetFrameworks>
<TargetFrameworks Condition="'$(NO_ANDROID)' == ''">$(TargetFrameworks);net6.0-android</TargetFrameworks>
<TargetFrameworks Condition="'$(NO_IOS)' == '' And $([MSBuild]::IsOSPlatform('OSX'))">$(TargetFrameworks);net6.0-ios</TargetFrameworks>
<TargetFrameworks Condition="'$(NO_MACCATALYST)' == '' And $([MSBuild]::IsOSPlatform('OSX'))">$(TargetFrameworks);net6.0-maccatalyst</TargetFrameworks>
<TargetFrameworks Condition="'$(NO_WINDOWS)' == '' And !$([MSBuild]::IsOSPlatform('Linux'))">$(TargetFrameworks);net6.0-windows10.0.19041.0</TargetFrameworks>
<TargetFrameworks Condition="'$(NO_ANDROID)' == ''">$(TargetFrameworks);net7.0-android</TargetFrameworks>
<TargetFrameworks Condition="'$(NO_IOS)' == '' And $([MSBuild]::IsOSPlatform('OSX'))">$(TargetFrameworks);net7.0-ios</TargetFrameworks>
<TargetFrameworks Condition="'$(NO_MACCATALYST)' == '' And $([MSBuild]::IsOSPlatform('OSX'))">$(TargetFrameworks);net7.0-maccatalyst</TargetFrameworks>
<TargetFrameworks Condition="'$(NO_WINDOWS)' == '' And !$([MSBuild]::IsOSPlatform('Linux'))">$(TargetFrameworks);net7.0-windows10.0.19041.0</TargetFrameworks>

<!-- Target Tizen only if the Tizen SDK workload pack is installed. -->
<TargetFrameworks Condition="'$(NO_TIZEN)' == '' And Exists('$(MSBuildBinPath)\..\..\packs\Samsung.Tizen.Sdk')">$(TargetFrameworks);net6.0-tizen</TargetFrameworks>
<TargetFrameworks Condition="'$(NO_TIZEN)' == '' And Exists('$(MSBuildBinPath)\..\..\packs\Samsung.Tizen.Sdk')">$(TargetFrameworks);net7.0-tizen</TargetFrameworks>

<!--
This flag allows us to target Windows-specific code when building on OSX, so we can build and pack all platforms on a single machine.
Expand Down
6 changes: 4 additions & 2 deletions src/Sentry/Internal/Extensions/CollectionsExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,11 @@ public static void TryCopyTo<TKey, TValue>(this IDictionary<TKey, TValue> from,
}
}

#if !NET8_0_OR_GREATER
Copy link
Member Author

@bruno-garcia bruno-garcia Sep 16, 2023

Choose a reason for hiding this comment

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

Technically not needed yet, will be needed when adding .NET 8: https://github.com/getsentry/sentry-dotnet/pull/2617/files#diff-ebf7bc6beaaf9dacfb725d68b7126baccbe823abd28dda757213831c04639774 and as I copied this over from the other PR, here it is.

public static Dictionary<TKey, TValue> ToDictionary<TKey, TValue>(
this IEnumerable<KeyValuePair<TKey, TValue>> source) where TKey : notnull =>
source.ToDictionary(kvp => kvp.Key, kvp => kvp.Value);
#endif

public static IEnumerable<KeyValuePair<TKey, TValue>> WhereNotNullValue<TKey, TValue>(
this IEnumerable<KeyValuePair<TKey, TValue?>> source) where TKey : notnull
Expand All @@ -44,17 +46,17 @@ public static IEnumerable<KeyValuePair<TKey, TValue>> WhereNotNullValue<TKey, TV
}
}
}

public static IEnumerable<KeyValuePair<TKey, TValue>> Append<TKey, TValue>(
this IEnumerable<KeyValuePair<TKey, TValue>> source, TKey key, TValue value) =>
source.Append(new KeyValuePair<TKey, TValue>(key, value));

public static IReadOnlyList<T> AsReadOnly<T>(this IList<T> list) =>
list as IReadOnlyList<T> ?? new ReadOnlyCollection<T>(list);

#if !NET7_0_OR_GREATER
public static IReadOnlyDictionary<TKey, TValue> AsReadOnly<TKey, TValue>(this IDictionary<TKey, TValue> dictionary)
where TKey : notnull =>
new ReadOnlyDictionary<TKey, TValue>(dictionary);
#endif

public static IEnumerable<T> ExceptNulls<T>(this IEnumerable<T?> source) =>
source.Where(x => x != null).Select(x => x!);
Expand Down
12 changes: 9 additions & 3 deletions src/Sentry/Internal/Http/DefaultSentryHttpClientFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,16 @@ public HttpClient Create(SentryOptions options)
HttpMessageHandler handler = options.CreateHttpMessageHandler?.Invoke() ?? new HttpClientHandler();
if (handler is HttpClientHandler httpClientHandler)
{
if (options.HttpProxy != null)
if (options.HttpProxy is not null)
{
httpClientHandler.Proxy = options.HttpProxy;
options.LogInfo("Using Proxy: {0}", options.HttpProxy);
// [CA1416] This call site is reachable on: 'ios' 10.0 and later, 'maccatalyst' 10.0 and later. 'HttpClientHandler.Proxy' is unsupported on: 'ios' all versions, 'maccatalyst' all versions.
#if NET6_0_OR_GREATER
if (!OperatingSystem.IsIOS() && !OperatingSystem.IsMacCatalyst())
#endif
{
httpClientHandler.Proxy = options.HttpProxy;
options.LogInfo("Using Proxy: {0}", options.HttpProxy);
}
}

// If the platform supports automatic decompression
Expand Down
7 changes: 7 additions & 0 deletions src/Sentry/Platforms/Android/SentrySdk.cs
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,9 @@ private static void AndroidEnvironment_UnhandledExceptionRaiser(object? _, Raise
return null;
}

#pragma warning disable CS0618 // Type or member is obsolete
Copy link
Collaborator

Choose a reason for hiding this comment

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

What will be the trigger for when we remove these? When the offending members actually get removed from the dotnet framework?

Copy link
Member Author

Choose a reason for hiding this comment

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

it's binding to an native API that's deprecated

var packageInfo = AppContext.PackageManager?.GetPackageInfo(packageName, PackageInfoFlags.Permissions);
#pragma warning restore CS0618 // Type or member is obsolete
return packageInfo == null ? null : $"{packageName}@{packageInfo.VersionName}+{packageInfo.GetVersionCode()}";
}

Expand All @@ -234,7 +236,9 @@ private static void AndroidEnvironment_UnhandledExceptionRaiser(object? _, Raise
return null;
}

#pragma warning disable CS0618 // Type or member is obsolete
var packageInfo = AppContext.PackageManager?.GetPackageInfo(packageName, PackageInfoFlags.Permissions);
#pragma warning restore CS0618 // Type or member is obsolete
return packageInfo?.GetVersionCode();
}

Expand All @@ -251,7 +255,10 @@ private static void AndroidEnvironment_UnhandledExceptionRaiser(object? _, Raise

#pragma warning disable CS0618
// obsolete on Android >= P (28)
#pragma warning disable CA1422
// 'PackageInfo.VersionCode' is obsoleted on: 'Android' 28.0 and later.
return packageInfo.VersionCode;
#pragma warning restore CA1422
#pragma warning restore CS0618
}
}
6 changes: 3 additions & 3 deletions src/Sentry/Sentry.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@

<PropertyGroup Condition="'$(SolutionName)' != 'Sentry.Unity'">
<TargetFrameworks>net6.0;net5.0;netcoreapp3.0;netstandard2.1;netstandard2.0;net461</TargetFrameworks>
<TargetFrameworks Condition="'$(NO_ANDROID)' == ''">$(TargetFrameworks);net6.0-android</TargetFrameworks>
<TargetFrameworks Condition="'$(NO_IOS)' == '' And $([MSBuild]::IsOSPlatform('OSX'))">$(TargetFrameworks);net6.0-ios</TargetFrameworks>
<TargetFrameworks Condition="'$(NO_MACCATALYST)' == '' And $([MSBuild]::IsOSPlatform('OSX'))">$(TargetFrameworks);net6.0-maccatalyst</TargetFrameworks>
<TargetFrameworks Condition="'$(NO_ANDROID)' == ''">$(TargetFrameworks);net7.0-android</TargetFrameworks>
<TargetFrameworks Condition="'$(NO_IOS)' == '' And $([MSBuild]::IsOSPlatform('OSX'))">$(TargetFrameworks);net7.0-ios</TargetFrameworks>
<TargetFrameworks Condition="'$(NO_MACCATALYST)' == '' And $([MSBuild]::IsOSPlatform('OSX'))">$(TargetFrameworks);net7.0-maccatalyst</TargetFrameworks>
</PropertyGroup>

<PropertyGroup Condition="'$(SolutionName)' == 'Sentry.Unity'">
Expand Down