Skip to content

Commit

Permalink
Merge pull request #156 from bugsnag/release/3.0.1
Browse files Browse the repository at this point in the history
Release 3.0.1
  • Loading branch information
yousif-bugsnag committed Mar 24, 2022
2 parents f7b7aeb + 4c4ed0f commit 55d4028
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 8 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
Changelog
=========

## 3.0.1 (2022-03-24)

### Bug fixes

* Ensure RemoveProjectRoots works for assemblies that are run on a OS that differs from their build OS.
| [sgtfrankieboy](https://github.com/sgtfrankieboy)
| [#154](https://github.com/bugsnag/bugsnag-dotnet/pull/154)

## 3.0.0 (2022-01-31)

### Breaking Changes
Expand Down
2 changes: 0 additions & 2 deletions Directory.build.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<Project>
<PropertyGroup>
<OutputPath>$(BaseOutputPath)</OutputPath>
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)Bugsnag.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>
</PropertyGroup>
</Project>
21 changes: 18 additions & 3 deletions src/Bugsnag/Middleware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,26 @@ public static class InternalMiddleware
{
var projectRoots = report.Configuration.ProjectRoots.Select(prefix => {
// if the file prefix is missing a final directory seperator then we should
// add one first
if (prefix[prefix.Length - 1] != System.IO.Path.DirectorySeparatorChar)
// add one first.
var finalChar = prefix[prefix.Length - 1];
// Check if a prefix is a Unix-based path, if it is we add a `/`.
// Otherwise its a Windows-based path and we add `\` instead, if necessary.
if (prefix[0] == '/')
{
if (finalChar != '/')
{
prefix = $"{prefix}/";
}
}
else if (finalChar != '\\')
{
prefix = $"{prefix}{System.IO.Path.DirectorySeparatorChar}";
// DirectorySeparatorChar is not being used because its `/` on Unix
// systems and will break the check when running assemblies build
// on Windows but are run on Linux.
prefix = $"{prefix}\\";
}
return prefix;
}).ToArray();
Expand Down
5 changes: 2 additions & 3 deletions src/Directory.build.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
<Project>

<Import Project="..\Directory.Build.props"/>

<PropertyGroup>
<Authors>snmaynard kattrali martin308</Authors>
<Version></Version>
Expand All @@ -15,5 +12,7 @@
<LangVersion>7.1</LangVersion>
<WarningsAsErrors />
<NoWarn>1591</NoWarn>
<AssemblyOriginatorKeyFile>$(MSBuildStartupDirectory)\Bugsnag.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>
</PropertyGroup>
</Project>
6 changes: 6 additions & 0 deletions tests/Bugsnag.Tests/MiddlewareTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,14 @@ public void ProjectRootStrippingTests(string[] projectRoots, string fileName, st

public static IEnumerable<object[]> ProjectRootTestData()
{
// Tests for Windows-based paths
yield return new object[] { new string[] { @"C:\app" }, @"C:\app\Class.cs", "Class.cs" };
yield return new object[] { new string[] { @"C:\app\" }, @"C:\app\Class.cs", "Class.cs" };

// Tests for Unix-based paths
yield return new object[] { new string[] { @"/app" }, @"/app/Class.cs", "Class.cs" };
yield return new object[] { new string[] { @"/app/" }, @"/app/Class.cs", "Class.cs" };

// for this scenario we should only strip the file path once, here we
// have a setup where the first prefix will then also cause the second
// prefix to match. This should only strip the first prefix
Expand Down
1 change: 1 addition & 0 deletions tests/Directory.build.props
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<Project>
<Import Project="..\Directory.Build.props"/>
<PropertyGroup>
<SignAssembly>false</SignAssembly>
</PropertyGroup>
Expand Down

0 comments on commit 55d4028

Please sign in to comment.