Skip to content

Commit 598ab4f

Browse files
authored
ref: multi-target netcore 3.0 (#308)
1 parent 2402423 commit 598ab4f

23 files changed

+95
-41
lines changed

.appveyor.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
version: "{build}"
2-
image: Visual Studio 2017
2+
image: Visual Studio 2019
33
environment:
44
global:
5-
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: "1"
5+
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: "1" # Used by the dotnet SDK prior to v3.0
66
DOTNET_CLI_TELEMETRY_OPTOUT: "1"
77
test: off
88
branches:

.travis.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,26 @@
11
language: csharp
22
env:
33
global:
4-
- DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
4+
- DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 # Used by the dotnet SDK prior to v3.0
55
- DOTNET_CLI_TELEMETRY_OPTOUT=1
6-
dotnet: 2.2.105
7-
mono: 5.12.0
6+
mono: 6.6.0
87
branches:
98
only:
109
- master
1110
- /^release\/.*$/
1211
matrix:
1312
include:
14-
- os: osx # osx_image: xcode8.3 Default Xcode 8.3.3 OS X 10.12 1.8.0_112-b16
15-
osx_image: xcode9.2
13+
- os: osx
14+
osx_image: xcode11.2
1615
- os: linux
1716
dist: bionic
1817
sudo: required
1918
group: edge
2019
script:
20+
- curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --version 2.1.507
21+
- curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --version 3.1.100
22+
- export PATH=$PATH:~/.dotnet
23+
- dotnet --info
2124
- ./build.sh
2225
after_success:
2326
- curl -s https://codecov.io/bash > codecov

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,9 +195,10 @@ The packages target **.NET Standard 2.0** and **.NET Framework 4.6.1**. That mea
195195

196196
Of those, we've tested (we run our unit/integration tests) against:
197197

198-
* .NET Framework 4.7.2 on Windows
199-
* Mono 5.12 macOS and Linux (Travis-CI)
200-
* .NET Core 2.1 Windows, macOS and Linux
198+
* .NET Framework 4.8 on Windows
199+
* Mono 6.6 on macOS and Linux
200+
* .NET Core 2.1 on Windows, macOS and Linux
201+
* .NET Core 3.1 on Windows, macOS and Linux
201202

202203
### Sentry Protocol
203204

global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"sdk": {
3-
"version": "2.2.105"
3+
"version": "3.1.100"
44
}
55
}

src/Sentry.AspNetCore/ApplicationBuilderExtensions.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
using System.Collections.Generic;
22
using System.ComponentModel;
33
using System.Linq;
4-
using Microsoft.AspNetCore.Hosting;
4+
#if NETSTANDARD2_0
5+
using IHostApplicationLifetime = Microsoft.AspNetCore.Hosting.IApplicationLifetime;
6+
#else
7+
using Microsoft.Extensions.Hosting;
8+
#endif
59
using Microsoft.Extensions.DependencyInjection;
610
using Microsoft.Extensions.Logging;
711
using Microsoft.Extensions.Options;
@@ -11,7 +15,6 @@
1115
using Sentry.Extensions.Logging;
1216
using Sentry.Infrastructure;
1317

14-
1518
// ReSharper disable once CheckNamespace -- Discoverability
1619
namespace Microsoft.AspNetCore.Builder
1720
{
@@ -55,7 +58,7 @@ public static IApplicationBuilder UseSentry(this IApplicationBuilder app)
5558
}
5659
}
5760

58-
var lifetime = app.ApplicationServices.GetService<IApplicationLifetime>();
61+
var lifetime = app.ApplicationServices.GetService<IHostApplicationLifetime>();
5962
lifetime?.ApplicationStopped.Register(SentrySdk.Close);
6063

6164
return app.UseMiddleware<SentryMiddleware>();

src/Sentry.AspNetCore/Sentry.AspNetCore.csproj

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

33
<PropertyGroup>
4-
<TargetFramework>netstandard2.0</TargetFramework>
4+
<TargetFrameworks>netcoreapp3.0;netstandard2.0</TargetFrameworks>
55
<PackageTags>$(PackageTags);AspNetCore;MVC</PackageTags>
66
<PackageId>Sentry.AspNetCore</PackageId>
77
<AssemblyName>Sentry.AspNetCore</AssemblyName>
@@ -13,12 +13,16 @@
1313
<ProjectReference Include="..\Sentry.Extensions.Logging\Sentry.Extensions.Logging.csproj" />
1414
</ItemGroup>
1515

16-
<ItemGroup>
16+
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
1717
<PackageReference Include="Microsoft.AspNetCore.Hosting" Version="2.1.0" />
1818
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.Abstractions" Version="2.1.0" />
1919
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="2.1.0" />
2020
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="2.1.0" />
2121
<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="4.5.0" />
2222
</ItemGroup>
2323

24+
<ItemGroup Condition="'$(TargetFramework)' != 'netstandard2.0'">
25+
<FrameworkReference Include="Microsoft.AspNetCore.App" />
26+
</ItemGroup>
27+
2428
</Project>

src/Sentry.AspNetCore/SentryAspNetCoreOptionsSetup.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
using System;
2-
using Microsoft.AspNetCore.Hosting;
32
using Microsoft.Extensions.Logging.Configuration;
43
using Microsoft.Extensions.Options;
54
using Sentry.Extensions.Logging;
65
using Sentry.Internal;
6+
#if NETSTANDARD2_0
7+
using IHostingEnvironment = Microsoft.AspNetCore.Hosting.IHostingEnvironment;
8+
#else
9+
using IHostingEnvironment = Microsoft.AspNetCore.Hosting.IWebHostEnvironment;
10+
#endif
711

812
namespace Sentry.AspNetCore
913
{

src/Sentry.AspNetCore/SentryMiddleware.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33
using System.Runtime.ExceptionServices;
44
using System.Threading.Tasks;
55
using Microsoft.AspNetCore.Diagnostics;
6-
using Microsoft.AspNetCore.Hosting;
6+
#if NETSTANDARD2_0
7+
using IHostingEnvironment = Microsoft.AspNetCore.Hosting.IHostingEnvironment;
8+
#else
9+
using IHostingEnvironment = Microsoft.AspNetCore.Hosting.IWebHostEnvironment;
10+
#endif
711
using Microsoft.AspNetCore.Http;
812
using Microsoft.Extensions.Logging;
913
using Microsoft.Extensions.Options;

src/Sentry.Extensions.Logging/Sentry.Extensions.Logging.csproj

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

33
<PropertyGroup>
4-
<TargetFramework>netstandard2.0</TargetFramework>
4+
<TargetFrameworks>netcoreapp3.0;netstandard2.0</TargetFrameworks>
55
<PackageTags>$(PackageTags);Logging;Microsoft.Extensions.Logging</PackageTags>
66
<PackageId>Sentry.Extensions.Logging</PackageId>
77
<AssemblyName>Sentry.Extensions.Logging</AssemblyName>
@@ -13,8 +13,12 @@
1313
<ProjectReference Include="../../src/Sentry/Sentry.csproj" />
1414
</ItemGroup>
1515

16-
<ItemGroup>
16+
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
1717
<PackageReference Include="Microsoft.Extensions.Logging.Configuration" Version="2.1.0" />
1818
</ItemGroup>
1919

20+
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.0'">
21+
<PackageReference Include="Microsoft.Extensions.Logging.Configuration" Version="3.0.0" />
22+
</ItemGroup>
23+
2024
</Project>

src/Sentry/Internal/AppDomainAdapter.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,13 @@ private AppDomainAdapter()
1818
AppDomain.CurrentDomain.UnhandledException += OnUnhandledException;
1919
AppDomain.CurrentDomain.ProcessExit += OnProcessExit;
2020
}
21-
21+
2222
public event UnhandledExceptionEventHandler UnhandledException;
2323

2424
public event EventHandler ProcessExit;
2525

2626
private void OnProcessExit(object sender, EventArgs e) => ProcessExit?.Invoke(sender, e);
2727

28-
private void OnUnhandledException(object sender, UnhandledExceptionEventArgs e)
29-
=> UnhandledException?.Invoke(this, e);
28+
private void OnUnhandledException(object sender, UnhandledExceptionEventArgs e) => UnhandledException?.Invoke(this, e);
3029
}
3130
}

0 commit comments

Comments
 (0)