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

Avoid bug during FUTDC validation after solution build completes #9161

Merged
merged 1 commit into from
Jul 13, 2023
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 @@ -722,11 +722,9 @@ private bool CheckBuiltFromInputFiles(Log log, in TimestampCache timestampCache,
return true;
}

private bool CheckCopyToOutputDirectoryItems(Log log, UpToDateCheckImplicitConfiguredInput state, IEnumerable<(string Path, ImmutableArray<CopyItem> CopyItems)> copyItemsByProject, ConfiguredFileSystemOperationAggregator fileSystemAggregator, bool? isBuildAccelerationEnabled, CancellationToken token)
private bool CheckCopyToOutputDirectoryItems(Log log, UpToDateCheckImplicitConfiguredInput state, IEnumerable<(string Path, ImmutableArray<CopyItem> CopyItems)> copyItemsByProject, ConfiguredFileSystemOperationAggregator fileSystemAggregator, bool? isBuildAccelerationEnabled, SolutionBuildContext solutionBuildContext, CancellationToken token)
{
ITimestampCache? timestampCache = _solutionBuildContextProvider.CurrentSolutionBuildContext?.CopyItemTimestamps;

Assumes.NotNull(timestampCache);
ITimestampCache timestampCache = solutionBuildContext.CopyItemTimestamps;

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

Expand Down Expand Up @@ -973,10 +971,12 @@ private async Task<bool> IsUpToDateInternalAsync(
//
// 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)
SolutionBuildContext? solutionBuildContext = _solutionBuildContextProvider.CurrentSolutionBuildContext;
if (solutionBuildContext is null)
{
_solutionBuildEventListener.NotifySolutionBuildStarting();
Assumes.NotNull(_solutionBuildContextProvider.CurrentSolutionBuildContext);
solutionBuildContext = _solutionBuildContextProvider.CurrentSolutionBuildContext;
Copy link
Member

Choose a reason for hiding this comment

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

Can we be confident at this point that the CurrentSolutionBuildContext is not cleared? Or do we need to have a null check here as well?

Copy link
Member

Choose a reason for hiding this comment

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

Never mind..null check is below.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sorry I missed your comment when merging from my phone.

Yes the check is below, which is earlier in time. The methods are written backwards here. One days we'll refactor this system to be easier to follow.

Assumes.NotNull(solutionBuildContext);
}

globalProperties.TryGetValue(FastUpToDateCheckIgnoresKindsGlobalPropertyName, out string? ignoreKindsString);
Expand Down Expand Up @@ -1083,7 +1083,7 @@ private async Task<bool> IsUpToDateInternalAsync(
!CheckInputsAndOutputs(logger, lastSuccessfulBuildStartTimeUtc, timestampCache, implicitState, ignoreKinds, token) ||
!CheckBuiltFromInputFiles(logger, timestampCache, implicitState, token) ||
!CheckMarkers(logger, timestampCache, implicitState, isBuildAccelerationEnabled, fileSystemOperations) ||
!CheckCopyToOutputDirectoryItems(logger, implicitState, copyInfo.ItemsByProject, configuredFileSystemOperations, isBuildAccelerationEnabled, token))
!CheckCopyToOutputDirectoryItems(logger, implicitState, copyInfo.ItemsByProject, configuredFileSystemOperations, isBuildAccelerationEnabled, solutionBuildContext, token))
{
return (false, checkedConfigurations);
}
Expand Down