Skip to content

Recover .NET Framework 4.5 checks #40

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

Merged
merged 19 commits into from
Jul 2, 2024
Merged
Show file tree
Hide file tree
Changes from 13 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
46 changes: 34 additions & 12 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,48 @@
# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net

name: .NET
name: .NET Tests

on:
push:
branches: ["master"]
branches:
- main
pull_request:

jobs:
build:
test_windows:
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup .NET 8.0
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x

- name: Restore dependencies
run: dotnet restore

- name: Build solution
run: dotnet build ./Backtrace/Backtrace.csproj --no-restore --configuration Release

- name: Run tests
run: dotnet test Backtrace.Tests --verbosity normal

test_linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup .NET
- name: Checkout code
uses: actions/checkout@v3

- name: Setup .NET 8.0
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x
dotnet-version: 8.0.x

- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build .\Backtrace\Backtrace.csproj --no-restore
- name: Test

- name: Build solution
run: dotnet build ./Backtrace/Backtrace.csproj --no-restore --configuration Release

- name: Run tests
run: dotnet test Backtrace.Tests --verbosity normal
12 changes: 6 additions & 6 deletions Backtrace.Tests/Backtrace.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net48;net80</TargetFrameworks>
<TargetFrameworks>net45;net80</TargetFrameworks>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
<PackageReference Include="Moq" Version="4.10.1" />
<PackageReference Include="NUnit" Version="3.11.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.12.0" />
<PackageReference Include="RichardSzalay.MockHttp" Version="5.0.0" />
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
<PackageReference Include="Moq" Version="4.16.0" />
<PackageReference Include="RichardSzalay.MockHttp" Version="7.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Backtrace\Backtrace.csproj" />
Expand Down
4 changes: 2 additions & 2 deletions Backtrace.Tests/ClientTests/TestClientCredentials.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Backtrace.Tests.ClientTests
public class TestClientCredentials
{

#if NET35 || NET48
#if NET35 || NET45
[TestCase("EmptyCredentials")]
[Test(Author = "Konrad Dysput", Description = "Test empty values in configuration section")]
public void TestInvalidSectionName(string sectionName)
Expand Down Expand Up @@ -99,7 +99,7 @@ public void TestInvalidUrlArgument(string sectionName)
//if programmer pass invalid url should throw UriFormatException
//if programmer pass null or empty string as token should throw ArgumentNullException

#if NET35 || NET48
#if NET35 || NET45
Assert.Throws<UriFormatException>(() => new BacktraceClient(sectionName));
#endif
Assert.Throws<ArgumentException>(() => new BacktraceClient(new BacktraceCredentials("https://test.backtrace.io", string.Empty)));
Expand Down
7 changes: 2 additions & 5 deletions Backtrace/Backtrace.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<PackageId>Backtrace</PackageId>
<Title>Backtrace</Title>
<TargetFrameworks>netstandard2.0;net35;NET48</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net35;net45</TargetFrameworks>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<PackageTags>Backtrace Error Diagnostic Tools Debug Bug Bugs StackTrace</PackageTags>
<tags>Backtrace Error Diagnostic Tools Debug Bug Bugs StackTrace</tags>
Expand Down Expand Up @@ -31,13 +31,10 @@
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'NET48'">
<ItemGroup Condition="'$(TargetFramework)' == 'net45'">
<PackageReference Include="Microsoft.Diagnostics.Runtime">
<Version>0.9.170809.3</Version>
</PackageReference>
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'NET48'">
<Reference Include="System.Configuration" />
<Reference Include="System.Net.Http" />
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Backtrace/Model/BacktraceCredentials.cs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ internal bool IsValid(Uri uri, byte[] token)
return token != null && token.Length > 0 && uri.IsWellFormedOriginalString();
}

#if NET35 || NET48
#if NET35 || NET45
/// <summary>
/// Read Backtrace credentials from application configuration
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion Backtrace/Model/BacktraceStackFrame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public class BacktraceStackFrame

internal Assembly FrameAssembly { get; set; }

#if NET48
#if NET45
public BacktraceStackFrame(Microsoft.Diagnostics.Runtime.ClrStackFrame frame)
{
FunctionName = frame.Method.Name;
Expand Down
6 changes: 3 additions & 3 deletions Backtrace/Model/JsonData/ThreadData.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if NET48
#if NET45
using Microsoft.Diagnostics.Runtime;
#endif
using Backtrace.Extensions;
Expand Down Expand Up @@ -31,7 +31,7 @@ public class ThreadData
/// </summary>
internal ThreadData(Assembly callingAssembly, IEnumerable<BacktraceStackFrame> exceptionStack)
{
#if NET48
#if NET45
try
{
//use available in .NET 4.5 api to find stack trace of all available managed threads
Expand Down Expand Up @@ -97,7 +97,7 @@ private void ProcessThreads()
}
}

#if NET48
#if NET45
/// <summary>
/// Get all used threads in calling assembly. Function ignore current thread Id
/// </summary>
Expand Down
Loading