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

Fix FUTD check of copy items when building for debug #9130

Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -726,12 +726,7 @@ private bool CheckCopyToOutputDirectoryItems(Log log, UpToDateCheckImplicitConfi
{
ITimestampCache? timestampCache = _solutionBuildContextProvider.CurrentSolutionBuildContext?.CopyItemTimestamps;

if (timestampCache is null)
{
// This might be null during validation runs which can start after the last project build.
// If it is, we will just skip checking the copy items.
return true;
}
Assumes.NotNull(timestampCache);

string outputFullPath = Path.Combine(state.MSBuildProjectDirectory, state.OutputRelativeOrFullPath);

Expand Down Expand Up @@ -965,6 +960,25 @@ private async Task<bool> IsUpToDateInternalAsync(
// Short-lived cache of timestamp by path
var timestampCache = new TimestampCache(_fileSystem);

// Ensure we have a context object for the current solution build.
//
// Ordinarily, this is created when the SBM calls ISolutionBuildEventListener.NotifySolutionBuildStarting,
// and cleared again later when the SBM calls ISolutionBuildEventListener.NotifySolutionBuildCompleted.
//
// However there are two cases where it may be null here:
//
// 1. When performing a validation run that continues after the solution build completed, or
// 2. When the build occurs in response to debugging (e.g. F5) in which case the SBM calls the
// FUTDC *before* it invokes any solution build events.
//
// In either case, we construct an event here lazily so that we can correctly test for the
// existence of copy items in CheckCopyToOutputDirectoryItems.
if (_solutionBuildContextProvider.CurrentSolutionBuildContext is null)
{
_solutionBuildEventListener.NotifySolutionBuildStarting();
smitpatel marked this conversation as resolved.
Show resolved Hide resolved
Assumes.NotNull(_solutionBuildContextProvider.CurrentSolutionBuildContext);
}

globalProperties.TryGetValue(FastUpToDateCheckIgnoresKindsGlobalPropertyName, out string? ignoreKindsString);

(LogLevel requestedLogLevel, Guid projectGuid) = await (
Expand Down