Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net5 #583

Merged
merged 3 commits into from
Nov 10, 2020
Merged

net5 #583

Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ environment:
global:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: "1" # Used by the dotnet SDK prior to v3.0
DOTNET_CLI_TELEMETRY_OPTOUT: "1"
PREVIEW_DOTNET: "5.0.100-preview.8.20417.9"
PREVIEW_DOTNET: "5.0.100"
branches:
only:
- main
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
- name: Setup .NET SDK (v5.0)
uses: actions/[email protected]
with:
dotnet-version: '5.0.100-preview.8.20417.9'
dotnet-version: '5.0.100'

- name: Run build script
run: ${{ matrix.build_script }}
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ matrix:
script:
- curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --version 2.1.507
- curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --version 3.1.200
- curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --version 5.0.100-preview.8.20417.9
- curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --version 5.0.100
- export PATH=$PATH:~/.dotnet
- dotnet --info
- ./build.sh
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFrameworks>net5.0;netcoreapp3.1</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Grpc.AspNetCore.Server" Version="2.33.1"/>
<PackageReference Include="Grpc.Net.Client" Version="2.33.1"/>
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="3.1.9"/>
<PackageReference Include="Microsoft.AspNetCore.Diagnostics" Version="2.2.0"/>
<PackageReference Include="Microsoft.AspNetCore" Version="2.1.2"/>
<PackageReference Include="Grpc.Tools" Version="2.33.1" PrivateAssets="All"/>
</ItemGroup>

Expand Down
6 changes: 3 additions & 3 deletions test/Sentry.AspNetCore.Tests/Sentry.AspNetCore.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</PropertyGroup>

<PropertyGroup>
<TargetFrameworks>netcoreapp3.1;netcoreapp2.1</TargetFrameworks>
<TargetFrameworks>net5.0;netcoreapp3.1;netcoreapp2.1</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand All @@ -16,8 +16,8 @@

<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp2.1' OR '$(TargetFramework)' == 'net461'">
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="2.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore" Version="2.1.2" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics" Version="2.1.1" />
<PackageReference Include="Microsoft.AspNetCore" Version="2.1.7" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ public void LogLevel_HigherLevel_IsEnabled()
Assert.False(sut.IsEnabled(SentryLevel.Info));
}

// .NET Core 3 has turned FormattedLogValues into an internal readonly struct
// .NET Core 3 (and hence .NET 5) has turned FormattedLogValues into an internal readonly struct
// and now we can't match that with NSubstitute
#if !NETCOREAPP3_1
#if NETCOREAPP2_1 || NET461
[Fact]
public void Log_PassedThrough()
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netcoreapp3.1;netcoreapp2.1;net461</TargetFrameworks>
<TargetFrameworks>net5.0;netcoreapp3.1;netcoreapp2.1;net461</TargetFrameworks>
</PropertyGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp2.1' OR '$(TargetFramework)' == 'net461'">
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.1.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="2.1.1" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.1'">
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="3.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="3.1.10" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net5.0'">
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="5.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion test/Sentry.Log4Net.Tests/Sentry.Log4Net.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netcoreapp3.1;netcoreapp2.1;net461</TargetFrameworks>
<TargetFrameworks>net5.0;netcoreapp3.1;netcoreapp2.1;net461</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion test/Sentry.NLog.Tests/Sentry.NLog.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netcoreapp3.1;netcoreapp2.1;net461</TargetFrameworks>
<TargetFrameworks>net5.0;netcoreapp3.1;netcoreapp2.1;net461</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion test/Sentry.Serilog.Tests/Sentry.Serilog.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netcoreapp3.1;netcoreapp2.1;net461</TargetFrameworks>
<TargetFrameworks>net5.0;netcoreapp3.1;netcoreapp2.1;net461</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand Down
17 changes: 15 additions & 2 deletions test/Sentry.Testing/HttpClientExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,22 @@ public static async Task<HttpRequestMessage> CloneAsync(this HttpRequestMessage
var clone = new HttpRequestMessage(source.Method, source.RequestUri) {Version = source.Version};

// Properties
foreach (var prop in source.Properties)
foreach (var prop in source.
#if NET5_0
Options
#else
Properties
#endif
)
{
clone.Properties.Add(prop);
clone.
#if NET5_0
// No idea what I'm doing here but since this is test code:
Options.Set(new HttpRequestOptionsKey<string>(prop.Key), prop.Value.ToString());
#else
Properties.Add(prop);
#endif

bruno-garcia marked this conversation as resolved.
Show resolved Hide resolved
}

// Headers
Expand Down
6 changes: 5 additions & 1 deletion test/Sentry.Testing/Sentry.Testing.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netcoreapp3.1;netcoreapp2.1;net461</TargetFrameworks>
<TargetFrameworks>net5.0;netcoreapp3.1;netcoreapp2.1;net461</TargetFrameworks>
<IsTestProject>false</IsTestProject>
</PropertyGroup>

Expand All @@ -16,4 +16,8 @@
<ItemGroup Condition="$(TargetFramework) == 'netcoreapp3.1'">
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="3.1.0" />
</ItemGroup>

<ItemGroup Condition="$(TargetFramework) == 'net5.0'">
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="5.0.0" />
</ItemGroup>
</Project>
4 changes: 4 additions & 0 deletions test/Sentry.Tests/Internals/Http/HttpTransportTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,17 @@ public async Task SendEnvelopeAsync_CancellationToken_PassedToClient()
new SentryEvent(eventId: SentryResponses.ResponseId)
);

#if NET5_0
await Assert.ThrowsAsync<TaskCanceledException>(() => httpTransport.SendEnvelopeAsync(envelope, token).AsTask());
#else
// Act
await httpTransport.SendEnvelopeAsync(envelope, token);

// Assert
await httpHandler
.Received(1)
.VerifiableSendAsync(Arg.Any<HttpRequestMessage>(), Arg.Is<CancellationToken>(c => c.IsCancellationRequested));
#endif
}

[Fact]
Expand Down
4 changes: 2 additions & 2 deletions test/Sentry.Tests/Sentry.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netcoreapp3.1;netcoreapp2.1;net461</TargetFrameworks>
<TargetFrameworks>net5.0;netcoreapp3.1;netcoreapp2.1;net461</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="../../src/Sentry/Sentry.csproj" />
<ProjectReference Include="../Sentry.Testing/Sentry.Testing.csproj" />
</ItemGroup>

<PropertyGroup Condition="$(TargetFramework.StartsWith('netcoreapp'))">
<PropertyGroup Condition="$(TargetFramework.StartsWith('netcoreapp')) OR $(TargetFramework.StartsWith('net5'))">
Copy link
Contributor

Choose a reason for hiding this comment

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

<DefineConstants>NETCOREAPP;$(AdditionalConstants)</DefineConstants>
</PropertyGroup>

Expand Down