Skip to content

Commit 1402c5c

Browse files
committed
1
1 parent 365ff1f commit 1402c5c

File tree

3 files changed

+3
-96
lines changed

3 files changed

+3
-96
lines changed

src/BuiltInTools/dotnet-watch/Build/MsBuildFileSetFactory.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,9 @@ private IReadOnlyList<string> GetMSBuildArguments(string watchListFilePath)
154154
"/t:" + TargetName
155155
};
156156

157+
#if !DEBUG
157158
if (environmentOptions.TestFlags.HasFlag(TestFlags.RunningAsTest))
159+
#endif
158160
{
159161
arguments.Add($"/bl:{Path.Combine(environmentOptions.TestOutput, "DotnetWatch.GenerateWatchList.binlog")}");
160162
}
@@ -213,9 +215,7 @@ private static string FindTargetsFile()
213215

214216
try
215217
{
216-
var graph = new ProjectGraph([entryPoint], ProjectCollection.GlobalProjectCollection, projectInstanceFactory: null, cancellationToken);
217-
reporter.Verbose($"Project graph loaded ({graph.ProjectNodes.Count} nodes)");
218-
return graph;
218+
return new ProjectGraph([entryPoint], ProjectCollection.GlobalProjectCollection, projectInstanceFactory: null, cancellationToken);
219219
}
220220
catch (Exception e)
221221
{

src/BuiltInTools/dotnet-watch/HotReload/HotReloadDotNetWatcher.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,6 @@ async Task<ImmutableList<ChangedFile>> CaptureChangedFilesSnapshot(ImmutableDict
444444

445445
// TODO: consider re-evaluating only affected projects instead of the whole graph.
446446
evaluationResult = await EvaluateRootProjectAsync(iterationCancellationToken);
447-
Debug.Assert(evaluationResult.ProjectGraph != null);
448447

449448
// additional directories may have been added:
450449
evaluationResult.WatchFiles(fileWatcher);

test/dotnet-watch.Tests/HotReload/RuntimeProcessLauncherTests.cs

Lines changed: 0 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -636,96 +636,4 @@ public async Task IgnoredChange(bool isExisting, bool isIncluded, DirectoryKind
636636
throw new InvalidOperationException();
637637
}
638638
}
639-
640-
[PlatformSpecificFact(TestPlatforms.Windows)] // https://github.com/dotnet/sdk/issues/49307
641-
public async Task ProjectChange_AddProjectReference()
642-
{
643-
var testAsset = TestAssets.CopyTestAsset("WatchAppWithProjectDeps")
644-
.WithSource()
645-
.WithProjectChanges(project =>
646-
{
647-
foreach (var r in project.Root!.Descendants().Where(e => e.Name.LocalName == "ProjectReference").ToArray())
648-
{
649-
r.Remove();
650-
}
651-
});
652-
653-
var appProjDir = Path.Combine(testAsset.Path, "AppWithDeps");
654-
var appProjFile = Path.Combine(appProjDir, "App.WithDeps.csproj");
655-
var appFile = Path.Combine(appProjDir, "Program.cs");
656-
657-
UpdateSourceFile(appFile, code => code.Replace("Lib.Print();", "// Lib.Print();"));
658-
659-
await using var w = StartWatcher(testAsset, ["--no-exit"], appProjDir, appProjDir);
660-
661-
var waitingForChanges = w.Reporter.RegisterSemaphore(MessageDescriptor.WaitingForChanges);
662-
var reEvaluationCompleted = w.Reporter.RegisterSemaphore(MessageDescriptor.ReEvaluationCompleted);
663-
664-
var hasUpdate = new SemaphoreSlim(initialCount: 0);
665-
w.Reporter.OnProcessOutput += line =>
666-
{
667-
if (line.Content.Contains("<Lib>"))
668-
{
669-
hasUpdate.Release();
670-
}
671-
};
672-
673-
Log("Waiting for changes...");
674-
await waitingForChanges.WaitAsync(w.ShutdownSource.Token);
675-
676-
UpdateSourceFile(appProjFile, src => src.Replace("""
677-
<ItemGroup />
678-
""", """
679-
<ItemGroup>
680-
<ProjectReference Include="..\Dependency\Dependency.csproj" />
681-
</ItemGroup>
682-
"""));
683-
684-
UpdateSourceFile(appFile, code => code.Replace("// Lib.Print();", "Lib.Print();"));
685-
686-
Log("Waiting for re-evaluation completed...");
687-
await reEvaluationCompleted.WaitAsync(w.ShutdownSource.Token);
688-
689-
Log("Waiting for output '<Lib>'...");
690-
await hasUpdate.WaitAsync(w.ShutdownSource.Token);
691-
}
692-
693-
[PlatformSpecificFact(TestPlatforms.Windows)] // https://github.com/dotnet/sdk/issues/49307
694-
public async Task ProjectChange_AddPackageReference()
695-
{
696-
var testAsset = TestAssets.CopyTestAsset("WatchHotReloadApp")
697-
.WithSource();
698-
699-
var projFilePath = Path.Combine(testAsset.Path, "WatchHotReloadApp.csproj");
700-
var programFilePath = Path.Combine(testAsset.Path, "Program.cs");
701-
702-
await using var w = StartWatcher(testAsset, ["--no-exit"], testAsset.Path, testAsset.Path);
703-
704-
var waitingForChanges = w.Reporter.RegisterSemaphore(MessageDescriptor.WaitingForChanges);
705-
var reEvaluationCompleted = w.Reporter.RegisterSemaphore(MessageDescriptor.ReEvaluationCompleted);
706-
707-
var hasUpdate = new SemaphoreSlim(initialCount: 0);
708-
w.Reporter.OnProcessOutput += line =>
709-
{
710-
if (line.Content.Contains("JToken"))
711-
{
712-
hasUpdate.Release();
713-
}
714-
};
715-
716-
Log("Waiting for changes...");
717-
await waitingForChanges.WaitAsync(w.ShutdownSource.Token);
718-
719-
UpdateSourceFile(projFilePath, source => source.Replace("<!-- items placeholder -->", """
720-
<PackageReference Include="Newtonsoft.Json" Version="13.0.3"/>
721-
"""));
722-
723-
UpdateSourceFile(programFilePath, source => source.Replace("Console.WriteLine(\".\");", "Console.WriteLine(typeof(Newtonsoft.Json.Linq.JToken));"));
724-
725-
Log("Waiting for re-evaluation completed...");
726-
await reEvaluationCompleted.WaitAsync(w.ShutdownSource.Token);
727-
728-
Log("Waiting for output 'JToken'...");
729-
await hasUpdate.WaitAsync(w.ShutdownSource.Token);
730-
}
731639
}

0 commit comments

Comments
 (0)