@@ -82,7 +82,7 @@ public BuildManager_Tests(ITestOutputHelper output)
8282 EnableNodeReuse = false
8383 } ;
8484 _buildManager = new BuildManager ( ) ;
85- _projectCollection = new ProjectCollection ( globalProperties : null , _parameters . Loggers , ToolsetDefinitionLocations . Default ) ;
85+ _projectCollection = new ProjectCollection ( ) ;
8686
8787 _env = TestEnvironment . Create ( output ) ;
8888 _inProcEnvCheckTransientEnvironmentVariable = _env . SetEnvironmentVariable ( "MSBUILDINPROCENVCHECK" , "1" ) ;
@@ -137,8 +137,8 @@ public void SimpleBuild()
137137 _logger . AssertLogContains ( "[success]" ) ;
138138 Assert . Single ( _logger . ProjectStartedEvents ) ;
139139
140- ProjectEvaluationFinishedEventArgs evalFinishedEvent = _logger . EvaluationFinishedEvents [ 0 ] ;
141- Dictionary < string , string > properties = ExtractProjectStartedPropertyList ( evalFinishedEvent . Properties ) ;
140+ ProjectStartedEventArgs projectStartedEvent = _logger . ProjectStartedEvents [ 0 ] ;
141+ Dictionary < string , string > properties = ExtractProjectStartedPropertyList ( projectStartedEvent . Properties ) ;
142142
143143 Assert . True ( properties . TryGetValue ( "InitialProperty1" , out string propertyValue ) ) ;
144144 Assert . Equal ( "InitialProperty1" , propertyValue ) ;
@@ -254,8 +254,8 @@ public void SimpleGraphBuild()
254254 _logger . AssertLogContains ( "[success]" ) ;
255255 _logger . ProjectStartedEvents . Count . ShouldBe ( 1 ) ;
256256
257- ProjectEvaluationFinishedEventArgs evalFinishedEvent = _logger . EvaluationFinishedEvents [ 0 ] ;
258- Dictionary < string , string > properties = ExtractProjectStartedPropertyList ( evalFinishedEvent . Properties ) ;
257+ ProjectStartedEventArgs projectStartedEvent = _logger . ProjectStartedEvents [ 0 ] ;
258+ Dictionary < string , string > properties = ExtractProjectStartedPropertyList ( projectStartedEvent . Properties ) ;
259259
260260 properties . TryGetValue ( "InitialProperty1" , out string propertyValue ) . ShouldBeTrue ( ) ;
261261 propertyValue . ShouldBe ( "InitialProperty1" , StringCompareShould . IgnoreCase ) ;
@@ -571,8 +571,8 @@ public void InProcForwardPropertiesFromChild()
571571 _logger . AssertLogContains ( "[success]" ) ;
572572 Assert . Single ( _logger . ProjectStartedEvents ) ;
573573
574- ProjectEvaluationFinishedEventArgs evalFinishedEvent = _logger . EvaluationFinishedEvents [ 0 ] ;
575- Dictionary < string , string > properties = ExtractProjectStartedPropertyList ( evalFinishedEvent . Properties ) ;
574+ ProjectStartedEventArgs projectStartedEvent = _logger . ProjectStartedEvents [ 0 ] ;
575+ Dictionary < string , string > properties = ExtractProjectStartedPropertyList ( projectStartedEvent . Properties ) ;
576576
577577 Assert . True ( properties . TryGetValue ( "InitialProperty1" , out string propertyValue ) ) ;
578578 Assert . Equal ( "InitialProperty1" , propertyValue ) ;
@@ -611,8 +611,8 @@ public void InProcMsBuildForwardAllPropertiesFromChild()
611611 _logger . AssertLogContains ( "[success]" ) ;
612612 Assert . Single ( _logger . ProjectStartedEvents ) ;
613613
614- ProjectEvaluationFinishedEventArgs evalFinishedEvent = _logger . EvaluationFinishedEvents [ 0 ] ;
615- Dictionary < string , string > properties = ExtractProjectStartedPropertyList ( evalFinishedEvent . Properties ) ;
614+ ProjectStartedEventArgs projectStartedEvent = _logger . ProjectStartedEvents [ 0 ] ;
615+ Dictionary < string , string > properties = ExtractProjectStartedPropertyList ( projectStartedEvent . Properties ) ;
616616
617617 Assert . True ( properties . TryGetValue ( "InitialProperty1" , out string propertyValue ) ) ;
618618 Assert . Equal ( "InitialProperty1" , propertyValue ) ;
@@ -655,8 +655,8 @@ public void MsBuildForwardAllPropertiesFromChildLaunchChildNode()
655655 _logger . AssertLogContains ( "[success]" ) ;
656656 Assert . Single ( _logger . ProjectStartedEvents ) ;
657657
658- ProjectEvaluationFinishedEventArgs evalFinishedEvent = _logger . EvaluationFinishedEvents [ 0 ] ;
659- Dictionary < string , string > properties = ExtractProjectStartedPropertyList ( evalFinishedEvent . Properties ) ;
658+ ProjectStartedEventArgs projectStartedEvent = _logger . ProjectStartedEvents [ 0 ] ;
659+ Dictionary < string , string > properties = ExtractProjectStartedPropertyList ( projectStartedEvent . Properties ) ;
660660
661661 Assert . True ( properties . TryGetValue ( "InitialProperty1" , out string propertyValue ) ) ;
662662 Assert . Equal ( "InitialProperty1" , propertyValue ) ;
@@ -704,15 +704,7 @@ public void OutOfProcNodeForwardCertainproperties()
704704 var data = new BuildRequestData ( project . FullPath , new Dictionary < string , string > ( ) ,
705705 MSBuildDefaultToolsVersion , Array . Empty < string > ( ) , null ) ;
706706
707- // We need to recreate build parameters to ensure proper capturing of newly set environment variables
708- BuildParameters parameters = new BuildParameters
709- {
710- ShutdownInProcNodeOnBuildFinish = true ,
711- Loggers = new ILogger [ ] { _logger } ,
712- EnableNodeReuse = false
713- } ;
714-
715- BuildResult result = _buildManager . Build ( parameters , data ) ;
707+ BuildResult result = _buildManager . Build ( _parameters , data ) ;
716708 Assert . Equal ( BuildResultCode . Success , result . OverallResult ) ;
717709 _logger . AssertLogContains ( "[success]" ) ;
718710 Assert . Single ( _logger . ProjectStartedEvents ) ;
@@ -768,21 +760,11 @@ public void OutOfProcNodeForwardCertainpropertiesAlsoGetResultsFromCache()
768760 _env . SetEnvironmentVariable ( "MsBuildForwardPropertiesFromChild" , "InitialProperty3;IAMNOTREAL" ) ;
769761 _env . SetEnvironmentVariable ( "MSBUILDNOINPROCNODE" , "1" ) ;
770762
771- _env . SetEnvironmentVariable ( "MSBUILDLOGPROPERTIESANDITEMSAFTEREVALUATION" , "0" ) ;
772-
773763 var project = CreateProject ( contents , null , _projectCollection , false ) ;
774764 var data = new BuildRequestData ( project . FullPath , new Dictionary < string , string > ( ) ,
775765 MSBuildDefaultToolsVersion , Array . Empty < string > ( ) , null ) ;
776766
777- // We need to recreate build parameters to ensure proper capturing of newly set environment variables
778- BuildParameters parameters = new BuildParameters
779- {
780- ShutdownInProcNodeOnBuildFinish = true ,
781- Loggers = new ILogger [ ] { _logger } ,
782- EnableNodeReuse = false
783- } ;
784-
785- BuildResult result = _buildManager . Build ( parameters , data ) ;
767+ BuildResult result = _buildManager . Build ( _parameters , data ) ;
786768 Assert . Equal ( BuildResultCode . Success , result . OverallResult ) ;
787769 _logger . AssertLogContains ( "[success]" ) ;
788770 Assert . Equal ( 3 , _logger . ProjectStartedEvents . Count ) ;
@@ -803,8 +785,7 @@ public void OutOfProcNodeForwardCertainpropertiesAlsoGetResultsFromCache()
803785 Assert . Equal ( "InitialProperty3" , propertyValue ) ;
804786
805787 projectStartedEvent = _logger . ProjectStartedEvents [ 2 ] ;
806- properties = ExtractProjectStartedPropertyList ( projectStartedEvent . Properties ) ;
807- ( properties == null || properties . Count == 0 ) . ShouldBeTrue ( ) ;
788+ Assert . Null ( projectStartedEvent . Properties ) ;
808789 }
809790
810791 /// <summary>
@@ -841,7 +822,7 @@ public void ForwardNoPropertiesLaunchChildNode()
841822
842823 ProjectStartedEventArgs projectStartedEvent = _logger . ProjectStartedEvents [ 0 ] ;
843824 Dictionary < string , string > properties = ExtractProjectStartedPropertyList ( projectStartedEvent . Properties ) ;
844- ( properties == null || properties . Count == 0 ) . ShouldBeTrue ( ) ;
825+ Assert . Null ( properties ) ;
845826 }
846827
847828 /// <summary>
@@ -938,7 +919,7 @@ public void ForwardNoPropertiesLaunchChildNodeDefault()
938919
939920 ProjectStartedEventArgs projectStartedEvent = _logger . ProjectStartedEvents [ 0 ] ;
940921 Dictionary < string , string > properties = ExtractProjectStartedPropertyList ( projectStartedEvent . Properties ) ;
941- ( properties == null || properties . Count == 0 ) . ShouldBeTrue ( ) ;
922+ Assert . Null ( properties ) ;
942923 }
943924
944925 /// <summary>
@@ -3494,11 +3475,9 @@ private static string BuildAndCheckCache(BuildManager localBuildManager, IEnumer
34943475 /// </summary>
34953476 private static Dictionary < string , string > ExtractProjectStartedPropertyList ( IEnumerable properties )
34963477 {
3497- Dictionary < string , string > propertiesLookup = new Dictionary < string , string > ( StringComparer . OrdinalIgnoreCase ) ;
3498- Internal . Utilities . EnumerateProperties ( properties , propertiesLookup ,
3499- static ( dict , kvp ) => dict . Add ( kvp . Key , kvp . Value ) ) ;
3500-
3501- return propertiesLookup ;
3478+ // Gather a sorted list of all the properties.
3479+ return properties ? . Cast < DictionaryEntry > ( )
3480+ . ToDictionary ( prop => ( string ) prop . Key , prop => ( string ) prop . Value , StringComparer . OrdinalIgnoreCase ) ;
35023481 }
35033482
35043483 /// <summary>
0 commit comments