Skip to content

DAR: Allow caller to control VSASSERT path #1489

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 1 commit into from
Feb 12, 2025
Merged
Changes from all 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
22 changes: 20 additions & 2 deletions test/DebugAdapterRunner/DebugAdapterRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;

Expand Down Expand Up @@ -163,8 +164,25 @@ private void StartDebugAdapter(

if (redirectVSAssert)
{
_assertionFileName = Path.Combine(Path.GetTempPath(), string.Format(CultureInfo.InvariantCulture, "vsassert.{0}.txt", Guid.NewGuid()));
startInfo.Environment["VSASSERT"] = _assertionFileName;
string vsassertPath = null;

// First see if the caller already specified the assertion path
if (additionalEnvironmentVariables != null)
{
vsassertPath = additionalEnvironmentVariables
.Where(pair => pair.Key.Equals("VSASSERT", StringComparison.OrdinalIgnoreCase))
.Select(pair => pair.Value)
.FirstOrDefault();
}

if (string.IsNullOrEmpty(vsassertPath))
{
// If the caller didn't specify a path, create a temporary one
vsassertPath = Path.Combine(Path.GetTempPath(), string.Format(CultureInfo.InvariantCulture, "vsassert.{0}.txt", Guid.NewGuid()));
startInfo.Environment["VSASSERT"] = vsassertPath;
}

_assertionFileName = vsassertPath;
}

if (additionalEnvironmentVariables != null)
Expand Down
Loading