Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 0 additions & 1 deletion src/Cli/dotnet/Commands/Run/CommonRunHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ internal static class CommonRunHelpers
public static Dictionary<string, string> GetGlobalPropertiesFromArgs(MSBuildArgs msbuildArgs)
{
var globalProperties = msbuildArgs.GlobalProperties?.ToDictionary() ?? new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
globalProperties[Constants.EnableDefaultItems] = "false"; // Disable default item globbing to improve performance
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding some tests that would reproduce the issue which this is fixing.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will probably add a test upstream in dotnet/android, I don't know how you'd reproduce the problem without the Android workload:

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it should be fairly easy to repro in dotnet/sdk by adding <CallTarget Targets="Build" /> or something similar in a custom target that runs before/after ComputeRunArguments.

globalProperties[Constants.MSBuildExtensionsPath] = AppContext.BaseDirectory;
return globalProperties;
}
Expand Down
14 changes: 7 additions & 7 deletions src/Cli/dotnet/Commands/Run/RunCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -824,11 +824,11 @@ private void SendProjectBasedTelemetry(ProjectLaunchSettingsModel? launchSetting
{
Debug.Assert(ProjectFileFullPath != null);
var projectIdentifier = RunTelemetry.GetProjectBasedIdentifier(ProjectFileFullPath, GetRepositoryRoot(), Sha256Hasher.Hash);

// Get package and project reference counts for project-based apps
int packageReferenceCount = 0;
int projectReferenceCount = 0;

// Try to get project information for telemetry if we built the project
if (ShouldBuild)
{
Expand All @@ -837,10 +837,10 @@ private void SendProjectBasedTelemetry(ProjectLaunchSettingsModel? launchSetting
var globalProperties = MSBuildArgs.GlobalProperties?.ToDictionary() ?? new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
globalProperties[Constants.EnableDefaultItems] = "false";
globalProperties[Constants.MSBuildExtensionsPath] = AppContext.BaseDirectory;

using var collection = new ProjectCollection(globalProperties: globalProperties);
var project = collection.LoadProject(ProjectFileFullPath).CreateProjectInstance();

packageReferenceCount = RunTelemetry.CountPackageReferences(project);
projectReferenceCount = RunTelemetry.CountProjectReferences(project);
}
Expand Down Expand Up @@ -869,10 +869,10 @@ private void SendProjectBasedTelemetry(ProjectLaunchSettingsModel? launchSetting
{
try
{
var currentDir = ProjectFileFullPath != null
var currentDir = ProjectFileFullPath != null
? Path.GetDirectoryName(ProjectFileFullPath)
: Directory.GetCurrentDirectory();

while (currentDir != null)
{
if (Directory.Exists(Path.Combine(currentDir, ".git")))
Expand All @@ -886,7 +886,7 @@ private void SendProjectBasedTelemetry(ProjectLaunchSettingsModel? launchSetting
{
// Ignore errors when trying to find repo root
}

return null;
}
}
Loading