File tree Expand file tree Collapse file tree
Microsoft.TestPlatform.CrossPlatEngine/Client/Parallel
Microsoft.TestPlatform.ObjectModel/Navigation Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -70,30 +70,25 @@ public ParallelRunDataAggregator(string runSettingsXml)
7070
7171 public string RunSettings { get ; }
7272
73- // Note: This method is called once at the end of the test run to aggregate results.
74- // It is NOT called in parallel, so thread-safety optimizations here would be misleading.
7573 public ITestRunStatistics GetAggregatedRunStats ( )
7674 {
7775 var testOutcomeMap = new Dictionary < TestOutcome , long > ( ) ;
7876 long totalTests = 0 ;
79- lock ( _dataUpdateSyncObject )
77+ if ( _testRunStatsList . Count > 0 )
8078 {
81- if ( _testRunStatsList . Count > 0 )
79+ foreach ( var runStats in _testRunStatsList )
8280 {
83- foreach ( var runStats in _testRunStatsList )
81+ // TODO: we get nullref here if the stats are empty.
82+ foreach ( var kvp in runStats . Stats ! )
8483 {
85- // TODO: we get nullref here if the stats are empty.
86- foreach ( var kvp in runStats . Stats ! )
84+ if ( ! testOutcomeMap . TryGetValue ( kvp . Key , out long currentCount ) )
8785 {
88- if ( ! testOutcomeMap . TryGetValue ( kvp . Key , out long currentCount ) )
89- {
90- currentCount = 0 ;
91- }
92-
93- testOutcomeMap [ kvp . Key ] = currentCount + kvp . Value ;
86+ currentCount = 0 ;
9487 }
95- totalTests += runStats . ExecutedTests ;
88+
89+ testOutcomeMap [ kvp . Key ] = currentCount + kvp . Value ;
9690 }
91+ totalTests += runStats . ExecutedTests ;
9792 }
9893 }
9994
Original file line number Diff line number Diff line change @@ -379,13 +379,14 @@ private void PopulateCacheForTypeAndMethodSymbols()
379379
380380 IDiaEnumSymbols ? enumSymbols = null ;
381381 IDiaSymbol ? methodSymbol ;
382- Dictionary < string , IDiaSymbol > ? methodSymbolsForType ;
382+ Dictionary < string , IDiaSymbol > methodSymbolsForType ;
383383
384384 try
385385 {
386386 typeSymbol . GetName ( out string symbolName ) ;
387- if ( _methodSymbols . TryGetValue ( symbolName , out methodSymbolsForType ) )
387+ if ( _methodSymbols . TryGetValue ( symbolName , out var existingMethodSymbols ) )
388388 {
389+ methodSymbolsForType = existingMethodSymbols ;
389390 if ( methodSymbolsForType . TryGetValue ( methodName , out var cachedMethodSymbol ) )
390391 {
391392 return cachedMethodSymbol ;
You can’t perform that action at this time.
0 commit comments