Skip to content
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

Log ETW for SDK resolution again #9393

Merged
merged 4 commits into from
Nov 30, 2023
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
6 changes: 3 additions & 3 deletions src/Build/BackEnd/Client/MSBuildClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ public MSBuildClientExitResult Execute(CancellationToken cancellationToken)

ReadPacketsLoop(cancellationToken);

MSBuildEventSource.Log.MSBuildServerBuildStop(descriptiveCommandLine, _numConsoleWritePackets, _sizeOfConsoleWritePackets, _exitResult.MSBuildClientExitType.ToString(), _exitResult.MSBuildAppExitTypeString);
rainersigwald marked this conversation as resolved.
Show resolved Hide resolved
MSBuildEventSource.Log.MSBuildServerBuildStop(descriptiveCommandLine, _numConsoleWritePackets, _sizeOfConsoleWritePackets, _exitResult.MSBuildClientExitType.ToString(), _exitResult.MSBuildAppExitTypeString ?? string.Empty);
CommunicationsUtilities.Trace("Build finished.");
}

Expand Down Expand Up @@ -437,7 +437,7 @@ private bool TrySendPacket(Func<INodePacket> packetResolver)
}

/// <summary>
/// Launches MSBuild server.
/// Launches MSBuild server.
/// </summary>
/// <returns> Whether MSBuild server was started successfully.</returns>
private bool TryLaunchServer()
Expand Down Expand Up @@ -511,7 +511,7 @@ private ServerNodeBuildCommand GetServerNodeBuildCommand()
envVars[pair.Key] = pair.Value;
}

// We remove env variable used to invoke MSBuild server as that might be equal to 1, so we do not get an infinite recursion here.
// We remove env variable used to invoke MSBuild server as that might be equal to 1, so we do not get an infinite recursion here.
envVars.Remove(Traits.UseMSBuildServerEnvVarName);

Debug.Assert(KnownTelemetry.PartialBuildTelemetry == null || KnownTelemetry.PartialBuildTelemetry.StartAt.HasValue, "BuildTelemetry.StartAt was not initialized!");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ private async Task<CacheResult> GetCacheResultAsync(BuildRequestData buildReques

ErrorUtilities.VerifyThrow(plugin.Instance != null, "Plugin '{0}' instance is null", plugin.Name);

MSBuildEventSource.Log.ProjectCacheGetCacheResultStart(plugin.Name, buildRequest.ProjectFullPath, targetNames);
MSBuildEventSource.Log.ProjectCacheGetCacheResultStart(plugin.Name, buildRequest.ProjectFullPath, targetNames ?? MSBuildConstants.DefaultTargetsMarker);
cacheResult = await plugin.Instance!.GetCacheResultAsync(buildRequest, pluginLogger, cancellationToken);

if (pluginLogger.HasLoggedErrors || cacheResult.ResultType == CacheResultType.None)
Expand All @@ -548,7 +548,7 @@ private async Task<CacheResult> GetCacheResultAsync(BuildRequestData buildReques
if (MSBuildEventSource.Log.IsEnabled())
{
string cacheResultType = cacheResult?.ResultType.ToString() ?? nameof(CacheResultType.None);
MSBuildEventSource.Log.ProjectCacheGetCacheResultStop(plugin.Name, buildRequest.ProjectFullPath, targetNames, cacheResultType);
MSBuildEventSource.Log.ProjectCacheGetCacheResultStop(plugin.Name, buildRequest.ProjectFullPath, targetNames ?? "<default>", cacheResultType);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public override SdkResult ResolveSdk(int submissionId, SdkReference sdk, Logging

bool wasResultCached = true;

MSBuildEventSource.Log.CachedSdkResolverServiceResolveSdkStart(sdk.Name, solutionPath, projectPath);
MSBuildEventSource.Log.CachedSdkResolverServiceResolveSdkStart(sdk.Name, solutionPath ?? string.Empty, projectPath ?? string.Empty);
rainersigwald marked this conversation as resolved.
Show resolved Hide resolved

if (Traits.Instance.EscapeHatches.DisableSdkResolutionCache)
{
Expand Down Expand Up @@ -79,7 +79,7 @@ public override SdkResult ResolveSdk(int submissionId, SdkReference sdk, Logging
loggingContext.LogWarning(null, new BuildEventFileInfo(sdkReferenceLocation), "ReferencingMultipleVersionsOfTheSameSdk", sdk.Name, result.Version, result.ElementLocation, sdk.Version);
}

MSBuildEventSource.Log.CachedSdkResolverServiceResolveSdkStop(sdk.Name, solutionPath, projectPath, result.Success, wasResultCached);
MSBuildEventSource.Log.CachedSdkResolverServiceResolveSdkStop(sdk.Name, solutionPath ?? string.Empty, projectPath ?? string.Empty, result.Success, wasResultCached);

return result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ private List<SdkResolver> GetResolvers(IList<SdkResolverManifest> resolversManif
MSBuildEventSource.Log.SdkResolverServiceLoadResolversStart();
newResolvers = _sdkResolverLoader.LoadResolversFromManifest(resolverManifest, loggingContext, sdkReferenceLocation);
_manifestToResolvers[resolverManifest] = newResolvers;
MSBuildEventSource.Log.SdkResolverServiceLoadResolversStop(resolverManifest.DisplayName, newResolvers.Count);
MSBuildEventSource.Log.SdkResolverServiceLoadResolversStop(resolverManifest.DisplayName ?? string.Empty, newResolvers.Count);
Forgind marked this conversation as resolved.
Show resolved Hide resolved
}
}
}
Expand Down Expand Up @@ -340,7 +340,7 @@ private bool TryResolveSdkUsingSpecifiedResolvers(
}
finally
{
MSBuildEventSource.Log.SdkResolverResolveSdkStop(sdkResolver.Name, sdk.Name, solutionPath, projectPath, result?.Path, result?.Success ?? false);
MSBuildEventSource.Log.SdkResolverResolveSdkStop(sdkResolver.Name, sdk.Name, solutionPath ?? string.Empty, projectPath ?? string.Empty, result?.Path ?? string.Empty, result?.Success ?? false);
}

SetResolverState(submissionId, sdkResolver, context.State);
Expand Down Expand Up @@ -481,7 +481,7 @@ private void RegisterResolversManifests(LoggingContext loggingContext, ElementLo
SdkResolverManifest sdkDefaultResolversManifest = new SdkResolverManifest(DisplayName: "DefaultResolversManifest", Path: null, ResolvableSdkRegex: null);
allResolversManifests.Add(sdkDefaultResolversManifest);
_manifestToResolvers[sdkDefaultResolversManifest] = defaultResolvers;
MSBuildEventSource.Log.SdkResolverServiceLoadResolversStop(sdkDefaultResolversManifest.DisplayName, defaultResolvers.Count);
MSBuildEventSource.Log.SdkResolverServiceLoadResolversStop(sdkDefaultResolversManifest.DisplayName ?? string.Empty, defaultResolvers.Count);
}

MSBuildEventSource.Log.SdkResolverServiceFindResolversManifestsStop(allResolversManifests.Count);
Expand Down
4 changes: 2 additions & 2 deletions src/Build/Evaluation/LazyItemEvaluator.IncludeOperation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ protected override ImmutableArray<I> SelectItems(OrderedItemDataCollection.Build
string[] includeSplitFilesEscaped;
if (MSBuildEventSource.Log.IsEnabled())
{
MSBuildEventSource.Log.ExpandGlobStart(_rootDirectory, glob, string.Join(", ", excludePatternsForGlobs));
MSBuildEventSource.Log.ExpandGlobStart(_rootDirectory ?? string.Empty, glob, string.Join(", ", excludePatternsForGlobs));
Forgind marked this conversation as resolved.
Show resolved Hide resolved
}

using (_lazyEvaluator._evaluationProfiler.TrackGlob(_rootDirectory, glob, excludePatternsForGlobs))
Expand All @@ -121,7 +121,7 @@ protected override ImmutableArray<I> SelectItems(OrderedItemDataCollection.Build

if (MSBuildEventSource.Log.IsEnabled())
{
MSBuildEventSource.Log.ExpandGlobStop(_rootDirectory, glob, string.Join(", ", excludePatternsForGlobs));
MSBuildEventSource.Log.ExpandGlobStop(_rootDirectory ?? string.Empty, glob, string.Join(", ", excludePatternsForGlobs));
}

foreach (string includeSplitFileEscaped in includeSplitFilesEscaped)
Expand Down
4 changes: 1 addition & 3 deletions src/Framework/MSBuildEventSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

using System.Diagnostics.Tracing;

#nullable disable

namespace Microsoft.Build.Eventing
{
/// <summary>
Expand Down Expand Up @@ -242,7 +240,7 @@ public void RarOverallStart()
WriteEvent(27);
}

[Event(28, Keywords = Keywords.All | Keywords.PerformanceLog)]
[Event(28, Keywords = Keywords.All | Keywords.PerformanceLog, Version = 1)]
rokonec marked this conversation as resolved.
Show resolved Hide resolved
public void RarOverallStop(int assembliesCount, int assemblyFilesCount, int resolvedFilesCount, int resolvedDependencyFilesCount, int copyLocalFilesCount, bool findDependencies)
{
WriteEvent(28, assembliesCount, assemblyFilesCount, resolvedFilesCount, resolvedDependencyFilesCount, copyLocalFilesCount, findDependencies);
Expand Down