@@ -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