Skip to content

Commit 24cfe5b

Browse files
authored
Dropped netstandard2.0 for ASP.NET Core (#2807)
1 parent 5d20a0c commit 24cfe5b

18 files changed

+51
-68
lines changed

CHANGELOG.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,20 @@
22

33
## Unreleased - 4.x
44

5-
### API breaking Changes
6-
7-
- ISpanTracer has been renamed back again to ISpan, to make it easier to upgrade from v3.x to v4.x ([#2870](https://github.com/getsentry/sentry-dotnet/pull/2870))
8-
95
### Fixes
106

117
- Android native symbol upload ([#2876](https://github.com/getsentry/sentry-dotnet/pull/2876))
128

9+
### .NET target frameworks changes
10+
11+
**Dropped netstandard2.0 support for Sentry.AspNetCore** ([#2807](https://github.com/getsentry/sentry-dotnet/pull/2807))
12+
13+
### API breaking Changes
14+
15+
#### Changed APIs
16+
17+
- ISpanTracer has been renamed back again to ISpan, to make it easier to upgrade from v3.x to v4.x ([#2870](https://github.com/getsentry/sentry-dotnet/pull/2870))
18+
1319
## 4.0.0-beta.1
1420

1521
### Features

src/Sentry.AspNetCore/ApplicationBuilderExtensions.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
#if NETSTANDARD2_0
2-
using IHostApplicationLifetime = Microsoft.AspNetCore.Hosting.IApplicationLifetime;
3-
#else
41
using Microsoft.Extensions.Hosting;
5-
#endif
62
using Microsoft.Extensions.DependencyInjection;
73
using Microsoft.Extensions.Logging;
84
using Microsoft.Extensions.Options;

src/Sentry.AspNetCore/Extensions/HttpContextExtensions.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,14 @@
22
using Microsoft.AspNetCore.Routing;
33
using Sentry.Extensibility;
44

5-
#if !NETSTANDARD2_0
65
using Microsoft.AspNetCore.Http.Features;
7-
#endif
86

97
namespace Sentry.AspNetCore.Extensions;
108

119
internal static class HttpContextExtensions
1210
{
1311
internal static string? TryGetRouteTemplate(this HttpContext context)
1412
{
15-
#if !NETSTANDARD2_0 // endpoint routing is only supported after ASP.NET Core 3.0
1613
// Requires .UseRouting()/.UseEndpoints()
1714
var endpoint = context.Features.Get<IEndpointFeature?>()?.Endpoint as RouteEndpoint;
1815
var routePattern = endpoint?.RoutePattern.RawText;
@@ -23,7 +20,7 @@ internal static class HttpContextExtensions
2320
{
2421
return formattedRoute;
2522
}
26-
#endif
23+
2724
// Fallback for legacy .UseMvc().
2825
// Note: GetRouteData can return null on netstandard2
2926
return (context.GetRouteData() is { } routeData)

src/Sentry.AspNetCore/Sentry.AspNetCore.csproj

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net8.0;net6.0;netstandard2.0</TargetFrameworks>
4+
<TargetFrameworks>net8.0;net6.0</TargetFrameworks>
55
<PackageTags>$(PackageTags);AspNetCore;MVC</PackageTags>
66
<Description>Official ASP.NET Core integration for Sentry - Open-source error tracking that helps developers monitor and fix crashes in real time.</Description>
77
</PropertyGroup>
@@ -13,23 +13,6 @@
1313

1414
<ItemGroup>
1515
<ProjectReference Include="..\Sentry.Extensions.Logging\Sentry.Extensions.Logging.csproj" />
16-
</ItemGroup>
17-
18-
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
19-
<ProjectReference Include="..\Sentry.DiagnosticSource\Sentry.DiagnosticSource.csproj" />
20-
21-
<PackageReference Include="Microsoft.AspNetCore.Hosting" Version="2.1.0" />
22-
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.Abstractions" Version="2.1.0" />
23-
<PackageReference Include="Microsoft.AspNetCore.Routing.Abstractions" Version="2.1.0" />
24-
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="2.1.0" />
25-
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="2.1.0" />
26-
<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="4.5.0" />
27-
28-
<!-- this is needed because the version that is brought in transitively has a vulnerability warning -->
29-
<PackageReference Include="Microsoft.AspNetCore.Http" Version="2.1.22" />
30-
</ItemGroup>
31-
32-
<ItemGroup Condition="'$(TargetFramework)' != 'netstandard2.0'">
3316
<FrameworkReference Include="Microsoft.AspNetCore.App" />
3417
</ItemGroup>
3518

src/Sentry.AspNetCore/SentryAspNetCoreOptions.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,7 @@
33
using Microsoft.AspNetCore.Http;
44
using Sentry.Extensibility;
55
using Sentry.Extensions.Logging;
6-
7-
#if NETSTANDARD2_0
8-
using IWebHostEnvironment = Microsoft.AspNetCore.Hosting.IHostingEnvironment;
9-
#else
106
using Microsoft.Extensions.Hosting;
11-
#endif
127

138
namespace Sentry.AspNetCore;
149

src/Sentry.AspNetCore/SentryAspNetCoreOptionsSetup.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,7 @@
33
using Microsoft.Extensions.Options;
44
using Sentry.Extensions.Logging;
55

6-
#if NETSTANDARD2_0
7-
using IHostingEnvironment = Microsoft.AspNetCore.Hosting.IHostingEnvironment;
8-
#else
96
using IHostingEnvironment = Microsoft.AspNetCore.Hosting.IWebHostEnvironment;
10-
#endif
117

128
namespace Sentry.AspNetCore;
139

src/Sentry.AspNetCore/SentryMiddleware.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
using Microsoft.AspNetCore.Diagnostics;
2-
#if NETSTANDARD2_0
3-
using IHostingEnvironment = Microsoft.AspNetCore.Hosting.IHostingEnvironment;
4-
#else
52
using IHostingEnvironment = Microsoft.AspNetCore.Hosting.IWebHostEnvironment;
6-
#endif
73
using Microsoft.AspNetCore.Http;
84
using Microsoft.Extensions.Logging;
95
using Microsoft.Extensions.Options;

test/Sentry.AspNetCore.TestUtils/AspNetSentrySdkTestFixture.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#if NET6_0_OR_GREATER
12
using Microsoft.AspNetCore.Hosting;
23

34
namespace Sentry.AspNetCore.TestUtils;
@@ -24,3 +25,4 @@ protected override void ConfigureBuilder(WebHostBuilder builder)
2425
AfterConfigureBuilder?.Invoke(builder);
2526
}
2627
}
28+
#endif

test/Sentry.AspNetCore.TestUtils/Sentry.AspNetCore.TestUtils.csproj

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,27 @@
66
</PropertyGroup>
77

88
<ItemGroup>
9-
<ProjectReference Include="..\..\src\Sentry.AspNetCore\Sentry.AspNetCore.csproj" />
109
<ProjectReference Include="..\Sentry.Testing\Sentry.Testing.csproj" />
1110
</ItemGroup>
1211

13-
<!--
14-
ASP.NET Core on .NET Framework is supported by Microsoft indefinitely on version 2.1 only.
15-
Indeed, version 2.1 has newer nuget packages than version 2.2 (which is out of support).
16-
Thus, we will test on 2.1.*, not 2.*.
17-
See https://dotnet.microsoft.com/platform/support/policy/aspnet
18-
And https://github.com/dotnet/aspnetcore/issues/3753#issuecomment-438046364
12+
<ItemGroup Condition="$(TargetFramework) != 'net48'">
13+
<ProjectReference Include="..\..\src\Sentry.AspNetCore\Sentry.AspNetCore.csproj" />
14+
</ItemGroup>
1915

20-
Also, JetBrains Rider (via Checkmarx) may report the following security vulnerabilities:
21-
CVE-2019-0815
22-
CVE-2020-1045
23-
CVE-2020-1597
24-
These are safe to ignore for our tests. A real project would resolve them by installing
25-
an updated version of the ASP.NET Core runtime on their hosting server.
26-
See https://github.com/dotnet/aspnetcore/issues/15423
27-
-->
16+
<!--
17+
ASP.NET Core on .NET Framework is supported by Microsoft indefinitely on version 2.1 only.
18+
Indeed, version 2.1 has newer nuget packages than version 2.2 (which is out of support).
19+
Thus, we will test on 2.1.*, not 2.*.
20+
See https://dotnet.microsoft.com/platform/support/policy/aspnet
21+
And https://github.com/dotnet/aspnetcore/issues/3753#issuecomment-438046364
22+
Also, JetBrains Rider (via Checkmarx) may report the following security vulnerabilities:
23+
CVE-2019-0815
24+
CVE-2020-1045
25+
CVE-2020-1597
26+
These are safe to ignore for our tests. A real project would resolve them by installing
27+
an updated version of the ASP.NET Core runtime on their hosting server.
28+
See https://github.com/dotnet/aspnetcore/issues/15423
29+
-->
2830
<ItemGroup Condition="$(TargetFramework) == 'net48'">
2931
<PackageReference Include="Microsoft.AspNetCore" Version="2.1.7" />
3032
<PackageReference Include="Microsoft.AspNetCore.Hosting" Version="2.1.1" />

test/Sentry.AspNetCore.Tests/Sentry.AspNetCore.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net8.0;net7.0;net6.0;net48</TargetFrameworks>
4+
<TargetFrameworks>net8.0;net7.0;net6.0</TargetFrameworks>
55
</PropertyGroup>
66

77
<ItemGroup>

0 commit comments

Comments
 (0)