diff --git a/.assets/bugsnag.png b/.assets/bugsnag.png new file mode 100644 index 0000000..66a0715 Binary files /dev/null and b/.assets/bugsnag.png differ diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json new file mode 100644 index 0000000..7bd5f9f --- /dev/null +++ b/.config/dotnet-tools.json @@ -0,0 +1,12 @@ +{ + "version": 1, + "isRoot": true, + "tools": { + "cake.tool": { + "version": "2.2.0", + "commands": [ + "dotnet-cake" + ] + } + } +} \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 229fc0c..cbc5185 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,12 @@ Changelog ========= +## 3.1.0 (2022-06-15) + +### Enhancements + +The `Bugsnag` and `Bugsnag.AspNet.Core` packages now officially support .NET Core 3.x, .NET 5 and .NET 6. + ## 3.0.1 (2022-03-24) ### Bug fixes diff --git a/appveyor.yml b/appveyor.yml index a08d1c3..de05e29 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,8 +1,8 @@ -image: Visual Studio 2017 +image: Visual Studio 2022 install: - set PATH=C:\Ruby25-x64\bin;%PATH% build_script: - - ps: .\build.ps1 -Target Appveyor + - ps: .\build.ps1 --target Appveyor after_build: - ps: 7z a build\bugsnag.zip build\Release\**\Bugsnag*.dll build\Release\**\Bugsnag*.pdb test: off diff --git a/build.cake b/build.cake index 2d3b824..2b55c07 100644 --- a/build.cake +++ b/build.cake @@ -1,6 +1,3 @@ -#tool "nuget:?package=xunit.runner.console" -#addin nuget:?package=Cake.SemVer -#addin nuget:?package=semver&version=2.0.4 var solution = File("./Bugsnag.sln"); var target = Argument("target", "Default"); @@ -28,21 +25,27 @@ Task("Build") .SetConfiguration(configuration)); }); -Task("Test") - .IsDependentOn("Build") - .Does(() => { - var testAssemblies = GetFiles($"{buildDir}/**/*.Tests.dll"); - XUnit2(testAssemblies, - new XUnit2Settings { - ArgumentCustomization = args => { - if (AppVeyor.IsRunningOnAppVeyor) - { - args.Append("-appveyor"); - } - return args; + Task("Test") + .IsDependentOn("Build") + .Does(() => { + var testAssemblies = GetFiles($"{buildDir}/**/*.Tests.dll"); + var settings = new DotNetTestSettings + { + Configuration = configuration, + ArgumentCustomization = args => { + if (AppVeyor.IsRunningOnAppVeyor) + { + args.Append("-appveyor"); } - }); - }); + return args; + } + }; + + foreach(var file in testAssemblies) + { + DotNetTest(file.FullPath, "MSTest.MapInconclusiveToFailed=true", settings); + } + }); Task("Pack") .IsDependentOn("Test") @@ -89,7 +92,7 @@ Task("MazeRunner") .IsDependentOn("Pack") .Does(() => { StartProcess("cmd", "/c bundle install"); - var mazeRunner = StartProcess("cmd", $"/c \"set BUGSNAG_VERSION={version} && bundle exec bugsnag-maze-runner\""); + var mazeRunner = StartProcess("cmd", $"/c \"set BUGSNAG_VERSION={version} && bundle exec bugsnag-maze-runner --verbose\""); if (mazeRunner != 0) { throw new Exception("maze-runner failed"); } diff --git a/build.ps1 b/build.ps1 index 265bd12..23b231c 100644 --- a/build.ps1 +++ b/build.ps1 @@ -1,234 +1,11 @@ -########################################################################## -# This is the Cake bootstrapper script for PowerShell. -# This file was downloaded from https://github.com/cake-build/resources -# Feel free to change this file to fit your needs. -########################################################################## +Set-Location -LiteralPath $PSScriptRoot -<# +$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE = '1' +$env:DOTNET_CLI_TELEMETRY_OPTOUT = '1' +$env:DOTNET_NOLOGO = '1' -.SYNOPSIS -This is a Powershell script to bootstrap a Cake build. +dotnet tool restore +if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } -.DESCRIPTION -This Powershell script will download NuGet if missing, restore NuGet tools (including Cake) -and execute your Cake build script with the parameters you provide. - -.PARAMETER Script -The build script to execute. -.PARAMETER Target -The build script target to run. -.PARAMETER Configuration -The build configuration to use. -.PARAMETER Verbosity -Specifies the amount of information to be displayed. -.PARAMETER ShowDescription -Shows description about tasks. -.PARAMETER DryRun -Performs a dry run. -.PARAMETER Experimental -Uses the nightly builds of the Roslyn script engine. -.PARAMETER Mono -Uses the Mono Compiler rather than the Roslyn script engine. -.PARAMETER SkipToolPackageRestore -Skips restoring of packages. -.PARAMETER ScriptArgs -Remaining arguments are added here. - -.LINK -https://cakebuild.net - -#> - -[CmdletBinding()] -Param( - [string]$Script = "build.cake", - [string]$Target, - [string]$Configuration, - [ValidateSet("Quiet", "Minimal", "Normal", "Verbose", "Diagnostic")] - [string]$Verbosity, - [switch]$ShowDescription, - [Alias("WhatIf", "Noop")] - [switch]$DryRun, - [switch]$Experimental, - [switch]$Mono, - [switch]$SkipToolPackageRestore, - [Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)] - [string[]]$ScriptArgs -) - -[Reflection.Assembly]::LoadWithPartialName("System.Security") | Out-Null -function MD5HashFile([string] $filePath) -{ - if ([string]::IsNullOrEmpty($filePath) -or !(Test-Path $filePath -PathType Leaf)) - { - return $null - } - - [System.IO.Stream] $file = $null; - [System.Security.Cryptography.MD5] $md5 = $null; - try - { - $md5 = [System.Security.Cryptography.MD5]::Create() - $file = [System.IO.File]::OpenRead($filePath) - return [System.BitConverter]::ToString($md5.ComputeHash($file)) - } - finally - { - if ($file -ne $null) - { - $file.Dispose() - } - } -} - -function GetProxyEnabledWebClient -{ - $wc = New-Object System.Net.WebClient - $proxy = [System.Net.WebRequest]::GetSystemWebProxy() - $proxy.Credentials = [System.Net.CredentialCache]::DefaultCredentials - $wc.Proxy = $proxy - return $wc -} - -Write-Host "Preparing to run build script..." - -if(!$PSScriptRoot){ - $PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent -} - -$TOOLS_DIR = Join-Path $PSScriptRoot "tools" -$ADDINS_DIR = Join-Path $TOOLS_DIR "Addins" -$MODULES_DIR = Join-Path $TOOLS_DIR "Modules" -$NUGET_EXE = Join-Path $TOOLS_DIR "nuget.exe" -$CAKE_EXE = Join-Path $TOOLS_DIR "Cake/Cake.exe" -$NUGET_URL = "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe" -$PACKAGES_CONFIG = Join-Path $TOOLS_DIR "packages.config" -$PACKAGES_CONFIG_MD5 = Join-Path $TOOLS_DIR "packages.config.md5sum" -$ADDINS_PACKAGES_CONFIG = Join-Path $ADDINS_DIR "packages.config" -$MODULES_PACKAGES_CONFIG = Join-Path $MODULES_DIR "packages.config" - -# Make sure tools folder exists -if ((Test-Path $PSScriptRoot) -and !(Test-Path $TOOLS_DIR)) { - Write-Verbose -Message "Creating tools directory..." - New-Item -Path $TOOLS_DIR -Type directory | out-null -} - -# Make sure that packages.config exist. -if (!(Test-Path $PACKAGES_CONFIG)) { - Write-Verbose -Message "Downloading packages.config..." - try { - $wc = GetProxyEnabledWebClient - $wc.DownloadFile("https://cakebuild.net/download/bootstrapper/packages", $PACKAGES_CONFIG) } catch { - Throw "Could not download packages.config." - } -} - -# Try find NuGet.exe in path if not exists -if (!(Test-Path $NUGET_EXE)) { - Write-Verbose -Message "Trying to find nuget.exe in PATH..." - $existingPaths = $Env:Path -Split ';' | Where-Object { (![string]::IsNullOrEmpty($_)) -and (Test-Path $_ -PathType Container) } - $NUGET_EXE_IN_PATH = Get-ChildItem -Path $existingPaths -Filter "nuget.exe" | Select -First 1 - if ($NUGET_EXE_IN_PATH -ne $null -and (Test-Path $NUGET_EXE_IN_PATH.FullName)) { - Write-Verbose -Message "Found in PATH at $($NUGET_EXE_IN_PATH.FullName)." - $NUGET_EXE = $NUGET_EXE_IN_PATH.FullName - } -} - -# Try download NuGet.exe if not exists -if (!(Test-Path $NUGET_EXE)) { - Write-Verbose -Message "Downloading NuGet.exe..." - try { - $wc = GetProxyEnabledWebClient - $wc.DownloadFile($NUGET_URL, $NUGET_EXE) - } catch { - Throw "Could not download NuGet.exe." - } -} - -# Save nuget.exe path to environment to be available to child processed -$ENV:NUGET_EXE = $NUGET_EXE - -# Restore tools from NuGet? -if(-Not $SkipToolPackageRestore.IsPresent) { - Push-Location - Set-Location $TOOLS_DIR - - # Check for changes in packages.config and remove installed tools if true. - [string] $md5Hash = MD5HashFile($PACKAGES_CONFIG) - if((!(Test-Path $PACKAGES_CONFIG_MD5)) -Or - ($md5Hash -ne (Get-Content $PACKAGES_CONFIG_MD5 ))) { - Write-Verbose -Message "Missing or changed package.config hash..." - Remove-Item * -Recurse -Exclude packages.config,nuget.exe - } - - Write-Verbose -Message "Restoring tools from NuGet..." - $NuGetOutput = Invoke-Expression "&`"$NUGET_EXE`" install -ExcludeVersion -OutputDirectory `"$TOOLS_DIR`"" - - if ($LASTEXITCODE -ne 0) { - Throw "An error occured while restoring NuGet tools." - } - else - { - $md5Hash | Out-File $PACKAGES_CONFIG_MD5 -Encoding "ASCII" - } - Write-Verbose -Message ($NuGetOutput | out-string) - - Pop-Location -} - -# Restore addins from NuGet -if (Test-Path $ADDINS_PACKAGES_CONFIG) { - Push-Location - Set-Location $ADDINS_DIR - - Write-Verbose -Message "Restoring addins from NuGet..." - $NuGetOutput = Invoke-Expression "&`"$NUGET_EXE`" install -ExcludeVersion -OutputDirectory `"$ADDINS_DIR`"" - - if ($LASTEXITCODE -ne 0) { - Throw "An error occured while restoring NuGet addins." - } - - Write-Verbose -Message ($NuGetOutput | out-string) - - Pop-Location -} - -# Restore modules from NuGet -if (Test-Path $MODULES_PACKAGES_CONFIG) { - Push-Location - Set-Location $MODULES_DIR - - Write-Verbose -Message "Restoring modules from NuGet..." - $NuGetOutput = Invoke-Expression "&`"$NUGET_EXE`" install -ExcludeVersion -OutputDirectory `"$MODULES_DIR`"" - - if ($LASTEXITCODE -ne 0) { - Throw "An error occured while restoring NuGet modules." - } - - Write-Verbose -Message ($NuGetOutput | out-string) - - Pop-Location -} - -# Make sure that Cake has been installed. -if (!(Test-Path $CAKE_EXE)) { - Throw "Could not find Cake.exe at $CAKE_EXE" -} - - - -# Build Cake arguments -$cakeArguments = @("$Script"); -if ($Target) { $cakeArguments += "-target=$Target" } -if ($Configuration) { $cakeArguments += "-configuration=$Configuration" } -if ($Verbosity) { $cakeArguments += "-verbosity=$Verbosity" } -if ($ShowDescription) { $cakeArguments += "-showdescription" } -if ($DryRun) { $cakeArguments += "-dryrun" } -if ($Experimental) { $cakeArguments += "-experimental" } -if ($Mono) { $cakeArguments += "-mono" } -$cakeArguments += $ScriptArgs - -# Start Cake -Write-Host "Running build script..." -&$CAKE_EXE $cakeArguments -exit $LASTEXITCODE +dotnet cake @args +if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } diff --git a/features/steps/website_steps.rb b/features/steps/website_steps.rb index 5277239..661fe35 100644 --- a/features/steps/website_steps.rb +++ b/features/steps/website_steps.rb @@ -7,8 +7,8 @@ When("I run the console app {string} with {string}") do |name, args| path = File.join(Dir.pwd, "features", "fixtures", name) nuget_package_path = File.join(Dir.pwd, "build", "packages") - run_command("dotnet nuget locals all --clear") - run_command("dotnet add #{path} package -v #{ENV['BUGSNAG_VERSION']} bugsnag") + run_command("dotnet add #{path} package bugsnag --version #{ENV['BUGSNAG_VERSION']} --no-restore") + run_command("dotnet restore #{path} --source #{nuget_package_path} --no-cache") run_command(@script_env || {}, "dotnet run -p #{path} -- #{args}") end diff --git a/src/Bugsnag/Payload/StackTraceLine.cs b/src/Bugsnag/Payload/StackTraceLine.cs index 486b6b9..f5e3a34 100644 --- a/src/Bugsnag/Payload/StackTraceLine.cs +++ b/src/Bugsnag/Payload/StackTraceLine.cs @@ -28,7 +28,7 @@ public IEnumerator GetEnumerator() var stackFrames = new System.Diagnostics.StackTrace(_originalException, true).GetFrames(); #if !NETSTANDARD1_3 - if (stackFrames == null) + if (stackFrames == null || stackFrames.Length == 0) { // this usually means that the exception has not been thrown so we need // to try and create a stack trace at the point that the notify call diff --git a/src/Directory.build.props b/src/Directory.build.props index 89f0816..b166658 100644 --- a/src/Directory.build.props +++ b/src/Directory.build.props @@ -4,9 +4,9 @@ © 2018 Bugsnag Inc. bugsnag crash exception-handling exception-reporting exception-handler error-monitoring error-reporting error-handling unhandled-exceptions debug exceptions error errors bug bugs crash-reporting crash-reporting-tool error-log diagnostic - https://raw.githubusercontent.com/bugsnag/bugsnag-dotnet/master/LICENSE.txt + MIT https://github.com/bugsnag/bugsnag-dotnet - https://s3.amazonaws.com/bugsnag.com/images/square-logo-small.png + bugsnag.png true true 7.1 @@ -15,4 +15,7 @@ $(MSBuildStartupDirectory)\Bugsnag.snk true + + + diff --git a/tests/Bugsnag.AspNet.Core.Tests/Bugsnag.AspNet.Core.Tests.csproj b/tests/Bugsnag.AspNet.Core.Tests/Bugsnag.AspNet.Core.Tests.csproj index 37a4b7a..780c1ae 100644 --- a/tests/Bugsnag.AspNet.Core.Tests/Bugsnag.AspNet.Core.Tests.csproj +++ b/tests/Bugsnag.AspNet.Core.Tests/Bugsnag.AspNet.Core.Tests.csproj @@ -1,18 +1,19 @@ - net461 + net461;netcoreapp3.1;net5.0;net6.0 win10-x64 false true 7.1 + false - - - + + + diff --git a/tests/Bugsnag.AspNet.Tests/Bugsnag.AspNet.Tests.csproj b/tests/Bugsnag.AspNet.Tests/Bugsnag.AspNet.Tests.csproj index 7c1b1f0..ecfe72a 100644 --- a/tests/Bugsnag.AspNet.Tests/Bugsnag.AspNet.Tests.csproj +++ b/tests/Bugsnag.AspNet.Tests/Bugsnag.AspNet.Tests.csproj @@ -11,9 +11,9 @@ - - - + + + diff --git a/tests/Bugsnag.AspNet.WebApi.Tests/Bugsnag.AspNet.WebApi.Tests.csproj b/tests/Bugsnag.AspNet.WebApi.Tests/Bugsnag.AspNet.WebApi.Tests.csproj index 2caa5af..02b7b5c 100644 --- a/tests/Bugsnag.AspNet.WebApi.Tests/Bugsnag.AspNet.WebApi.Tests.csproj +++ b/tests/Bugsnag.AspNet.WebApi.Tests/Bugsnag.AspNet.WebApi.Tests.csproj @@ -9,9 +9,9 @@ - - - + + + diff --git a/tests/Bugsnag.ConfigurationSection.Tests/Bugsnag.ConfigurationSection.Tests.csproj b/tests/Bugsnag.ConfigurationSection.Tests/Bugsnag.ConfigurationSection.Tests.csproj index b6ac920..4891e6a 100644 --- a/tests/Bugsnag.ConfigurationSection.Tests/Bugsnag.ConfigurationSection.Tests.csproj +++ b/tests/Bugsnag.ConfigurationSection.Tests/Bugsnag.ConfigurationSection.Tests.csproj @@ -11,9 +11,9 @@ - - - + + + diff --git a/tests/Bugsnag.Tests.Server/Bugsnag.Tests.Server.csproj b/tests/Bugsnag.Tests.Server/Bugsnag.Tests.Server.csproj index 45895c3..6149a17 100644 --- a/tests/Bugsnag.Tests.Server/Bugsnag.Tests.Server.csproj +++ b/tests/Bugsnag.Tests.Server/Bugsnag.Tests.Server.csproj @@ -1,6 +1,6 @@ - net461 + netstandard2.0 win10-x64 false true diff --git a/tests/Bugsnag.Tests/Bugsnag.Tests.csproj b/tests/Bugsnag.Tests/Bugsnag.Tests.csproj index e9d3a23..abdbd97 100644 --- a/tests/Bugsnag.Tests/Bugsnag.Tests.csproj +++ b/tests/Bugsnag.Tests/Bugsnag.Tests.csproj @@ -1,16 +1,17 @@ - net461 + net461;netcoreapp3.1;net5.0;net6.0 win10-x64 false true 7.1 + false - - - + + + diff --git a/tools/packages.config b/tools/packages.config deleted file mode 100644 index e52a2c7..0000000 --- a/tools/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - -