diff --git a/src/NuGet.Core/NuGet.Commands/RestoreCommand/RestoreCommand.cs b/src/NuGet.Core/NuGet.Commands/RestoreCommand/RestoreCommand.cs index 1108f6b3f3f..fa59c8df04a 100644 --- a/src/NuGet.Core/NuGet.Commands/RestoreCommand/RestoreCommand.cs +++ b/src/NuGet.Core/NuGet.Commands/RestoreCommand/RestoreCommand.cs @@ -56,6 +56,9 @@ private readonly Dictionary ExecuteAsync(CancellationToken token) telemetry.TelemetryEvent[IsLockFileEnabled] = _isLockFileEnabled; telemetry.TelemetryEvent[UseLegacyDependencyResolver] = _request.Project.RestoreMetadata.UseLegacyDependencyResolver; telemetry.TelemetryEvent[UsedLegacyDependencyResolver] = !_enableNewDependencyResolver; + telemetry.TelemetryEvent[TargetFrameworksCount] = _request.Project.RestoreMetadata.TargetFrameworks.Count; + telemetry.TelemetryEvent[RuntimeIdentifiersCount] = _request.Project.RuntimeGraph.Runtimes.Count; + telemetry.TelemetryEvent[TreatWarningsAsErrors] = _request.Project.RestoreMetadata.ProjectWideWarningProperties.AllWarningsAsErrors; _operationId = telemetry.OperationId; diff --git a/test/NuGet.Core.Tests/NuGet.Commands.Test/RestoreCommandTests/RestoreCommandTests.cs b/test/NuGet.Core.Tests/NuGet.Commands.Test/RestoreCommandTests/RestoreCommandTests.cs index e46172972ec..c109d8cbd2d 100644 --- a/test/NuGet.Core.Tests/NuGet.Commands.Test/RestoreCommandTests/RestoreCommandTests.cs +++ b/test/NuGet.Core.Tests/NuGet.Commands.Test/RestoreCommandTests/RestoreCommandTests.cs @@ -2895,6 +2895,9 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( ["Audit.Duration.Total"] = value => value.Should().BeOfType(), ["UseLegacyDependencyResolver"] = value => value.Should().BeOfType(), ["UsedLegacyDependencyResolver"] = value => value.Should().BeOfType(), + ["TargetFrameworksCount"] = value => value.Should().Be(1), + ["RuntimeIdentifiersCount"] = value => value.Should().Be(0), + ["TreatWarningsAsErrors"] = value => value.Should().Be(false), }; HashSet actualProperties = new(); @@ -2922,6 +2925,7 @@ public async Task ExecuteAsync_WithSinglePackage_WhenNoOping_PopulatesCorrectTel var projectName = "TestProject"; var projectPath = Path.Combine(pathContext.SolutionRoot, projectName); PackageSpec packageSpec = ProjectTestHelpers.GetPackageSpec(projectName, pathContext.SolutionRoot, "net472", "a"); + packageSpec.RestoreMetadata.ProjectWideWarningProperties.AllWarningsAsErrors = true; await SimpleTestPackageUtility.CreateFolderFeedV3Async( pathContext.PackageSource, @@ -2966,7 +2970,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( var projectInformationEvent = telemetryEvents.Single(e => e.Name.Equals("ProjectRestoreInformation")); - projectInformationEvent.Count.Should().Be(25); + projectInformationEvent.Count.Should().Be(28); projectInformationEvent["RestoreSuccess"].Should().Be(true); projectInformationEvent["NoOpResult"].Should().Be(true); projectInformationEvent["IsCentralVersionManagementEnabled"].Should().Be(false); @@ -2992,6 +2996,9 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( projectInformationEvent["UseLegacyDependencyResolver"].Should().BeOfType(); projectInformationEvent["UsedLegacyDependencyResolver"].Should().BeOfType(); projectInformationEvent["Audit.Enabled"].Should().BeOfType(); + projectInformationEvent["TargetFrameworksCount"].Should().Be(1); + projectInformationEvent["RuntimeIdentifiersCount"].Should().Be(0); + projectInformationEvent["TreatWarningsAsErrors"].Should().Be(true); } [Fact] @@ -3049,7 +3056,7 @@ await SimpleTestPackageUtility.CreateFolderFeedV3Async( var projectInformationEvent = telemetryEvents.Single(e => e.Name.Equals("ProjectRestoreInformation")); - projectInformationEvent.Count.Should().Be(31); + projectInformationEvent.Count.Should().Be(34); projectInformationEvent["RestoreSuccess"].Should().Be(true); projectInformationEvent["NoOpResult"].Should().Be(false); projectInformationEvent["TotalUniquePackagesCount"].Should().Be(2);