Skip to content

Commit

Permalink
Search for config loader assembly in bin subfolder. Fixes rollbar#636
Browse files Browse the repository at this point in the history
  • Loading branch information
jacob-ewald committed Feb 8, 2023
1 parent e9c26fe commit d8efcce
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Rollbar/Common/RuntimeEnvironmentUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ public static string GetSdkRuntimeLocationPath()

if (path != null)
{
if (Directory.Exists(Path.Combine(path, "bin")))
{
return Path.Combine(path, "bin");
}

return path;
}
#endif
Expand Down
22 changes: 22 additions & 0 deletions UnitTest.Rollbar/Common/RuntimeEnvironmentUtilityFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
Expand Down Expand Up @@ -40,5 +41,26 @@ public void TestGetSdkRuntimeLocationPath()
Assert.IsFalse(string.IsNullOrWhiteSpace(path));
}

[TestMethod]
public void TestGetSdkRuntimeLocationPathWithBinSubfolder()
{
var expectedPath = Path.Combine(AppContext.BaseDirectory, "bin");
try
{
Directory.CreateDirectory(expectedPath);

var path = RuntimeEnvironmentUtility.GetSdkRuntimeLocationPath();
Assert.IsNotNull(path);
Assert.IsFalse(string.IsNullOrWhiteSpace(path));
Assert.IsTrue(path.EndsWith("bin"));
}
finally
{
if (Directory.Exists(expectedPath))
{
Directory.Delete(expectedPath);
}
}
}
}
}

0 comments on commit d8efcce

Please sign in to comment.