Skip to content

Commit

Permalink
Fix some things found in review
Browse files Browse the repository at this point in the history
  • Loading branch information
Pilchie committed Dec 19, 2018
1 parent aeb863b commit 8f281b1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ internal class ConfiguredProjectImplicitActivationTracking : OnceInitializedOnce
private readonly IProjectAsynchronousTasksService _tasksService;
private readonly IActiveConfigurationGroupService _activeConfigurationGroupService;
private readonly ITargetBlock<IProjectVersionedValue<IConfigurationGroup<ProjectConfiguration>>> _targetBlock;
private TaskCompletionSource<object> _isImplicitlyActiveSource = new TaskCompletionSource<object>();
private TaskCompletionSource<object?> _isImplicitlyActiveSource = new TaskCompletionSource<object?>();
private IDisposable? _subscription;

[ImportingConstructor]
Expand Down Expand Up @@ -121,9 +121,7 @@ private Task OnActiveConfigurationsChanged(IProjectVersionedValue<IConfiguration

private Task OnImplicitlyActivated()
{
#pragma warning disable CS8625 // Workaround https://github.com/dotnet/roslyn/issues/31865
_isImplicitlyActiveSource.TrySetResult(null);
#pragma warning restore CS8625

IEnumerable<Task> tasks = ImplicitlyActiveServices.Select(c => c.Value.ActivateAsync());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,13 +321,10 @@ protected static void MergeExistingInMemoryProfiles(LaunchSettingsData newSnapsh
// Does it already have one with this name?
if (newSnapshot.Profiles.FirstOrDefault(p => LaunchProfile.IsSameProfileName(p.Name, profile.Name)) == null)
{
System.Diagnostics.Debug.Assert(newSnapshot.Profiles != null, $"{nameof(Enumerable.FirstOrDefault)} should have thrown");

// Create a new one from the existing in-memory profile and insert it in the same location, or the end if it
// is beyond the end of the list
if (newSnapshot.Profiles == null)
{
newSnapshot.Profiles = new List<LaunchProfileData>(1);
}

if (i > newSnapshot.Profiles.Count)
{
newSnapshot.Profiles.Add(LaunchProfileData.FromILaunchProfile(profile));
Expand Down Expand Up @@ -695,7 +692,7 @@ private void LaunchSettingsFile_Changed(object sender, FileSystemEventArgs e)
}
// Updates need to be sequenced
return sequentialTaskQueue.ExecuteTask((() => UpdateProfilesAsync(null)));
return sequentialTaskQueue.ExecuteTask(() => UpdateProfilesAsync(null));
}).Task;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ internal class UnconfiguredProjectTasksService : IUnconfiguredProjectTasksServic
private readonly IProjectAsynchronousTasksService _tasksService;
private readonly IProjectThreadingService _threadingService;
private readonly ILoadedInHostListener _loadedInHostListener;
private readonly TaskCompletionSource<object> _projectLoadedInHost = new TaskCompletionSource<object>();
private readonly TaskCompletionSource<object> _prioritizedProjectLoadedInHost = new TaskCompletionSource<object>();
private readonly TaskCompletionSource<object?> _projectLoadedInHost = new TaskCompletionSource<object?>();
private readonly TaskCompletionSource<object?> _prioritizedProjectLoadedInHost = new TaskCompletionSource<object?>();
private readonly JoinableTaskQueue _prioritizedTaskQueue;

[ImportingConstructor]
Expand Down Expand Up @@ -95,12 +95,12 @@ public Task PrioritizedProjectLoadedInHostAsync(Func<Task> action)

public void OnProjectLoadedInHost()
{
_projectLoadedInHost.SetResult(null!);
_projectLoadedInHost.SetResult(null);
}

public void OnPrioritizedProjectLoadedInHost()
{
_prioritizedProjectLoadedInHost.SetResult(null!);
_prioritizedProjectLoadedInHost.SetResult(null);

_threadingService.ExecuteSynchronously(() => _prioritizedTaskQueue.DrainAsync());
}
Expand Down

0 comments on commit 8f281b1

Please sign in to comment.