diff --git a/CHANGELOG.md b/CHANGELOG.md
index f40b72c..229fc0c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -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
diff --git a/Directory.build.props b/Directory.build.props
index 7ab7fcf..70fb10b 100644
--- a/Directory.build.props
+++ b/Directory.build.props
@@ -1,7 +1,5 @@
$(BaseOutputPath)
- $(MSBuildThisFileDirectory)Bugsnag.snk
- true
diff --git a/src/Bugsnag/Middleware.cs b/src/Bugsnag/Middleware.cs
index ca20cad..76511b4 100644
--- a/src/Bugsnag/Middleware.cs
+++ b/src/Bugsnag/Middleware.cs
@@ -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();
diff --git a/src/Directory.build.props b/src/Directory.build.props
index 4f70f1f..89f0816 100644
--- a/src/Directory.build.props
+++ b/src/Directory.build.props
@@ -1,7 +1,4 @@
-
-
-
snmaynard kattrali martin308
@@ -15,5 +12,7 @@
7.11591
+ $(MSBuildStartupDirectory)\Bugsnag.snk
+ true
diff --git a/tests/Bugsnag.Tests/MiddlewareTests.cs b/tests/Bugsnag.Tests/MiddlewareTests.cs
index bd875d5..3dbfca8 100644
--- a/tests/Bugsnag.Tests/MiddlewareTests.cs
+++ b/tests/Bugsnag.Tests/MiddlewareTests.cs
@@ -58,8 +58,14 @@ public void ProjectRootStrippingTests(string[] projectRoots, string fileName, st
public static IEnumerable