Skip to content
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
1 change: 1 addition & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
<PackageVersion Include="Microsoft.DotNet.SignCheck" Version="$(ArcadeSdkVersion)" />
<PackageVersion Include="Microsoft.DotNet.XUnitExtensions" Version="$(MicrosoftDotNetXUnitExtensionsVersion)" />
<PackageVersion Include="Microsoft.Extensions.DependencyModel" Version="$(MicrosoftExtensionsDependencyModelPackageVersion)" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="$(MicrosoftExtensionsDependencyInjectionAbstractionsPackageVersion)" />
<PackageVersion Include="Microsoft.Extensions.FileProviders.Abstractions" Version="$(MicrosoftExtensionsFileProvidersAbstractionsPackageVersion)" />
<PackageVersion Include="Microsoft.Extensions.FileSystemGlobbing" Version="$(MicrosoftExtensionsFileSystemGlobbingPackageVersion)" />
<PackageVersion Include="Microsoft.Extensions.Logging" Version="$(MicrosoftExtensionsLoggingVersion)" />
Expand Down
1 change: 1 addition & 0 deletions eng/Version.Details.props
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ This file should be imported by eng/Versions.props
<MicrosoftDotnetWpfProjectTemplatesPackageVersion>10.0.0-rtm.25523.111</MicrosoftDotnetWpfProjectTemplatesPackageVersion>
<MicrosoftExtensionsConfigurationIniPackageVersion>10.0.1</MicrosoftExtensionsConfigurationIniPackageVersion>
<MicrosoftExtensionsDependencyModelPackageVersion>10.0.1</MicrosoftExtensionsDependencyModelPackageVersion>
<MicrosoftExtensionsDependencyInjectionAbstractionsPackageVersion>10.0.1</MicrosoftExtensionsDependencyInjectionAbstractionsPackageVersion>
<MicrosoftExtensionsFileProvidersAbstractionsPackageVersion>10.0.1</MicrosoftExtensionsFileProvidersAbstractionsPackageVersion>
<MicrosoftExtensionsFileProvidersEmbeddedPackageVersion>10.0.1</MicrosoftExtensionsFileProvidersEmbeddedPackageVersion>
<MicrosoftExtensionsFileSystemGlobbingPackageVersion>10.0.1</MicrosoftExtensionsFileSystemGlobbingPackageVersion>
Expand Down
5 changes: 5 additions & 0 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,11 @@
<Sha>fad253f51b461736dfd3cd9c15977bb7493becef</Sha>
</Dependency>
<!-- Dependency required for flowing correct package version in source-build, using PVP flow. -->
<Dependency Name="Microsoft.Extensions.DependencyInjection.Abstractions" Version="10.0.1">
<Uri>https://dev.azure.com/dnceng/internal/_git/dotnet-dotnet</Uri>
<Sha>fad253f51b461736dfd3cd9c15977bb7493becef</Sha>
</Dependency>
<!-- Dependency required for flowing correct package version in source-build, using PVP flow. -->
<Dependency Name="Microsoft.Extensions.Logging.Console" Version="10.0.1">
<Uri>https://dev.azure.com/dnceng/internal/_git/dotnet-dotnet</Uri>
<Sha>fad253f51b461736dfd3cd9c15977bb7493becef</Sha>
Expand Down
3 changes: 2 additions & 1 deletion eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
<MicrosoftBclAsyncInterfacesToolsetPackageVersion>9.0.0</MicrosoftBclAsyncInterfacesToolsetPackageVersion>
<MicrosoftDeploymentDotNetReleasesToolsetPackageVersion>2.0.0-preview.1.24427.4</MicrosoftDeploymentDotNetReleasesToolsetPackageVersion>
<MicrosoftExtensionsLoggingAbstractionsToolsetPackageVersion>9.0.0</MicrosoftExtensionsLoggingAbstractionsToolsetPackageVersion>
<MicrosoftExtensionsDependencyInjectionAbstractionsToolsetPackageVersion>9.0.0</MicrosoftExtensionsDependencyInjectionAbstractionsToolsetPackageVersion>
<SystemBuffersToolsetPackageVersion>4.5.1</SystemBuffersToolsetPackageVersion>
<SystemCollectionsImmutableToolsetPackageVersion>9.0.0</SystemCollectionsImmutableToolsetPackageVersion>
<SystemMemoryToolsetPackageVersion>4.5.5</SystemMemoryToolsetPackageVersion>
Expand Down Expand Up @@ -142,7 +143,7 @@
</PropertyGroup>
<PropertyGroup Label="Workload manifest package versions">
<MauiFeatureBand>10.0.100</MauiFeatureBand>

<!--
Updates to any of these versions will require the updating of that package version in the
source-build-reference-packages repo as a text-only package.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
<PackageReference Include="System.Text.Json" VersionOverride="$(SystemTextJsonToolsetPackageVersion)" />
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" VersionOverride="$(MicrosoftBclAsyncInterfacesToolsetPackageVersion)" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" VersionOverride="$(MicrosoftExtensionsLoggingAbstractionsToolsetPackageVersion)" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" VersionOverride="$(MicrosoftExtensionsDependencyInjectionAbstractionsToolsetPackageVersion)" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp'">
Expand Down
3 changes: 1 addition & 2 deletions src/BuiltInTools/Watch/Build/FileItem.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.


namespace Microsoft.DotNet.Watch
{
internal readonly record struct FileItem
Expand Down
4 changes: 2 additions & 2 deletions src/BuiltInTools/Watch/Build/ProjectGraphFactory.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Licensed to the .NET Foundation under one or more agreements.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Collections.Immutable;
Expand Down Expand Up @@ -29,7 +29,7 @@ internal sealed class ProjectGraphFactory(ImmutableDictionary<string, string> gl
reuseProjectRootElementCache: true);

/// <summary>
/// Tries to create a project graph by running the build evaluation phase on the <see cref="rootProjectFile"/>.
/// Tries to create a project graph by running the build evaluation phase on the <paramref name="rootProjectFile"/>.
/// </summary>
public ProjectGraph? TryLoadProjectGraph(
string rootProjectFile,
Expand Down
3 changes: 1 addition & 2 deletions src/BuiltInTools/Watch/Build/ProjectNodeMap.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.


using Microsoft.Build.Graph;
using Microsoft.Extensions.Logging;

Expand Down
1 change: 0 additions & 1 deletion src/BuiltInTools/Watch/Context/DotNetWatchContext.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.


using Microsoft.Extensions.Logging;

namespace Microsoft.DotNet.Watch
Expand Down
2 changes: 1 addition & 1 deletion src/BuiltInTools/Watch/FileWatcher/FileWatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ private void Watch(IEnumerable<string> filePaths, bool containingDirectories, bo
from path in filePaths
group path by PathUtilities.EnsureTrailingSlash(PathUtilities.NormalizeDirectorySeparators(Path.GetDirectoryName(path)!))
into g
select (g.Key, containingDirectories ? [] : g.Select(path => Path.GetFileName(path)).ToImmutableHashSet(PathUtilities.OSSpecificPathComparer));
select (g.Key, containingDirectories ? [] : g.Select(Path.GetFileName).ToImmutableHashSet(PathUtilities.OSSpecificPathComparer));

foreach (var (directory, fileNames) in filesByDirectory)
{
Expand Down
7 changes: 2 additions & 5 deletions src/BuiltInTools/Watch/FileWatcher/PollingDirectoryWatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ internal sealed class PollingDirectoryWatcher : DirectoryWatcher
private Dictionary<string, DateTime> _snapshotBuilder = new(PathUtilities.OSSpecificPathComparer);
private readonly Dictionary<string, ChangeKind> _changesBuilder = new(PathUtilities.OSSpecificPathComparer);

private Thread _pollingThread;
private readonly Thread _pollingThread;
private bool _raiseEvents;

private volatile bool _disposed;
Expand Down Expand Up @@ -88,10 +88,7 @@ private void CaptureInitialSnapshot()
{
Debug.Assert(_currentSnapshot.Count == 0);

ForeachEntityInDirectory(_watchedDirectory, (filePath, writeTime) =>
{
_currentSnapshot.Add(filePath, writeTime);
});
ForeachEntityInDirectory(_watchedDirectory, _currentSnapshot.Add);
}

private void CheckForChangedFiles()
Expand Down
5 changes: 2 additions & 3 deletions src/BuiltInTools/Watch/HotReload/CompilationHandler.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Licensed to the .NET Foundation under one or more agreements.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Collections.Immutable;
Expand All @@ -23,7 +23,6 @@ internal sealed class CompilationHandler : IDisposable
/// Lock to synchronize:
/// <see cref="_runningProjects"/>
/// <see cref="_previousUpdates"/>
/// <see cref="_currentAggregateCapabilities"/>
/// </summary>
private readonly object _runningProjectsAndUpdatesGuard = new();

Expand Down Expand Up @@ -584,7 +583,7 @@ static MessageDescriptor GetMessageDescriptor(Diagnostic diagnostic, bool verbos
private static readonly string[] s_targets = [TargetNames.GenerateComputedBuildStaticWebAssets, TargetNames.ResolveReferencedProjectsStaticWebAssets];

private static bool HasScopedCssTargets(ProjectInstance projectInstance)
=> s_targets.All(t => projectInstance.Targets.ContainsKey(t));
=> s_targets.All(projectInstance.Targets.ContainsKey);

public async ValueTask HandleStaticAssetChangesAsync(
IReadOnlyList<ChangedFile> files,
Expand Down
8 changes: 4 additions & 4 deletions src/BuiltInTools/Watch/HotReload/HotReloadDotNetWatcher.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Licensed to the .NET Foundation under one or more agreements.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Collections.Immutable;
Expand Down Expand Up @@ -145,7 +145,7 @@ public async Task WatchAsync(CancellationToken shutdownCancellationToken)
}

// Cancel iteration as soon as the root process exits, so that we don't spent time loading solution, etc. when the process is already dead.
rootRunningProject.ProcessExitedCancellationToken.Register(() => iterationCancellationSource.Cancel());
rootRunningProject.ProcessExitedCancellationToken.Register(iterationCancellationSource.Cancel);

if (shutdownCancellationToken.IsCancellationRequested)
{
Expand Down Expand Up @@ -474,7 +474,7 @@ async Task<ImmutableArray<ChangedFile>> CaptureChangedFilesSnapshot(ImmutableArr

foreach (var file in changedFiles)
{
if (file.Item.ContainingProjectPaths.All(containingProjectPath => rebuiltProjectPaths.Contains(containingProjectPath)))
if (file.Item.ContainingProjectPaths.All(rebuiltProjectPaths.Contains))
{
newChangedFiles.Add(file);
}
Expand Down Expand Up @@ -736,7 +736,7 @@ private async ValueTask WaitForFileChangeBeforeRestarting(FileWatcher fileWatche
fileWatcher.WatchContainingDirectories([_context.RootProjectOptions.ProjectPath], includeSubdirectories: true);

_ = await fileWatcher.WaitForFileChangeAsync(
acceptChange: change => AcceptChange(change),
acceptChange: AcceptChange,
startedWatching: () => _context.Logger.Log(MessageDescriptor.WaitingForFileChangeBeforeRestarting),
cancellationToken);
}
Expand Down
1 change: 0 additions & 1 deletion src/BuiltInTools/Watch/HotReload/HotReloadEventSource.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.


using System.Diagnostics.Tracing;

namespace Microsoft.DotNet.Watch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
Disable CS9057 in source-only dev/ci builds. This is necessary because dotnet-watch distributes some ASP.NET Core
analyzers. These analyzers get built with a dependency on the live version of Microsoft.CodeAnalysis. In a dev/ci
build, the assembly version associated with Microsoft.CodeAnalysis in that case is 42.42.42.4242, set by Arcade in
dev/ci builds. So when building dotnet-watch with its analyzer dependencies, it will cause CS9057 because the
dev/ci builds. So when building dotnet-watch with its analyzer dependencies, it will cause CS9057 because the
analyzer assembly version is not the same as the compiler assembly version being used by the sdk that the project
is being built with. But this is fine because the analyzer is just being used here to distribute it with the tool.
-->
Expand Down
3 changes: 1 addition & 2 deletions src/BuiltInTools/Watch/Process/ProcessRunner.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.


using System.Diagnostics;
using Microsoft.Extensions.Logging;

Expand Down
5 changes: 2 additions & 3 deletions src/BuiltInTools/Watch/Process/ProcessSpec.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.


namespace Microsoft.DotNet.Watch
{
internal sealed class ProcessSpec
Expand All @@ -14,10 +13,10 @@ internal sealed class ProcessSpec
public Action<OutputLine>? OnOutput { get; set; }
public ProcessExitAction? OnExit { get; set; }
public CancellationToken CancelOutputCapture { get; set; }
public bool UseShellExecute { get; set; } = false;
public bool UseShellExecute { get; set; }

/// <summary>
/// True if the process is a user application, false if it is a helper process (e.g. dotnet build).</param>
/// True if the process is a user application, false if it is a helper process (e.g. dotnet build).
/// </summary>
public bool IsUserApplication { get; set; }

Expand Down
3 changes: 1 addition & 2 deletions src/BuiltInTools/Watch/Process/RunningProject.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.


using System.Collections.Immutable;
using System.Diagnostics;
using Microsoft.Build.Graph;
Expand Down
2 changes: 1 addition & 1 deletion src/BuiltInTools/Watch/Utilities/PathUtilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace Microsoft.DotNet.Watch;

internal static class PathUtilities
{
public static readonly IEqualityComparer<string> OSSpecificPathComparer = Path.DirectorySeparatorChar == '\\' ? StringComparer.OrdinalIgnoreCase : StringComparer.Ordinal;
public static readonly IEqualityComparer<string?> OSSpecificPathComparer = Path.DirectorySeparatorChar == '\\' ? StringComparer.OrdinalIgnoreCase : StringComparer.Ordinal;
public static readonly StringComparison OSSpecificPathComparison = Path.DirectorySeparatorChar == '\\' ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal;

public static string ExecutableExtension
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,8 @@ public static void FindLeadingDirectives(
if (CSharpDirective.Parse(context) is { } directive)
{
// If the directive is already present, report an error.
if (deduplicated.ContainsKey(directive))
if (deduplicated.TryGetValue(directive, out var existingDirective))
{
var existingDirective = deduplicated[directive];
var typeAndName = $"#:{existingDirective.GetType().Name.ToLowerInvariant()} {existingDirective.Name}";
reportError(sourceFile, directive.Info.Span, string.Format(FileBasedProgramsResources.DuplicateDirective, typeAndName));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ public static class LaunchSettings

public static IEnumerable<string> SupportedProfileTypes => s_providers.Keys;


public static string GetPropertiesLaunchSettingsPath(string directoryPath, string propertiesDirectoryName)
=> Path.Combine(directoryPath, propertiesDirectoryName, "launchSettings.json");

Expand Down
Loading