Skip to content

New dotnet test experience should produce binlog for the evaluation done to calculate TestModules #47494

Closed
@Youssef1313

Description

@Youssef1313

See the TODO comments in MSBuildUtility in #47493

Activity

added this to the 10.0.1xx milestone on Mar 12, 2025
added theissue type on Mar 12, 2025
ghost added
untriagedRequest triage from a team member
on Mar 12, 2025
Youssef1313

Youssef1313 commented on Mar 14, 2025

@Youssef1313
MemberAuthor

From #47493 (comment):

We should consider reusing/extracting the logic that run has for doing this same task:

static FacadeLogger? DetermineBinlogger(string[] restoreArgs)
{
List<BinaryLogger> binaryLoggers = new();
foreach (var blArg in restoreArgs.Where(arg => arg.StartsWith("-bl", StringComparison.OrdinalIgnoreCase)))
{
if (blArg.Contains(':'))
{
// split and forward args
var split = blArg.Split(':', 2);
var filename = split[1];
if (filename.EndsWith(".binlog"))
{
filename = filename.Substring(0, filename.Length - ".binlog".Length);
filename = filename + "-dotnet-run" + ".binlog";
}
binaryLoggers.Add(new BinaryLogger { Parameters = filename });
}
else
{
// the same name will be used for the build and run-restore-exec steps, so we need to make sure they don't conflict
var filename = "msbuild-dotnet-run" + ".binlog";
binaryLoggers.Add(new BinaryLogger { Parameters = filename });
}
}
// this binaryLogger needs to be used for both evaluation and execution, so we need to only call it with a single IEventSource across
// both of those phases.
// We need a custom logger to handle this, because the MSBuild API for evaluation and execution calls logger Initialize and Shutdown methods, so will not allow us to do this.
if (binaryLoggers.Count > 0)
{
var fakeLogger = ConfigureDispatcher(binaryLoggers);
return fakeLogger;
}
return null;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions

    New dotnet test experience should produce binlog for the evaluation done to calculate TestModules · Issue #47494 · dotnet/sdk