@@ -918,12 +918,11 @@ private IEnumerable<PSResourceInfo> SearchByNames(ServerApiCall currentServer, R
918918
919919 responses = response . GetAwaiter ( ) . GetResult ( ) ;
920920
921+ Utils . WriteOutConcurrentQueue ( _cmdletPassedIn , errorMsgs , warningMsgs , debugMsgs , verboseMsgs ) ;
921922 }
922923 else {
923924 responses = currentServer . FindVersion ( pkgName , _nugetVersion . ToNormalizedString ( ) , _type , out errRecord ) ;
924925 }
925-
926-
927926 }
928927 else
929928 {
@@ -1182,7 +1181,8 @@ internal void FindDependencyPackagesHelper(ServerApiCall currentServer, Response
11821181 ConcurrentQueue < string > verboseMsgs = new ConcurrentQueue < string > ( ) ;
11831182 ConcurrentQueue < string > debugMsgs = new ConcurrentQueue < string > ( ) ;
11841183 ConcurrentQueue < string > warningMsgs = new ConcurrentQueue < string > ( ) ;
1185-
1184+ debugMsgs . Enqueue ( "In FindHelper::FindDependencyPackagesHelper()" ) ;
1185+
11861186 if ( currentPkg . Dependencies . Length > 0 )
11871187 {
11881188 // If finding more than 5 packages, do so concurrently
@@ -1207,27 +1207,7 @@ internal void FindDependencyPackagesHelper(ServerApiCall currentServer, Response
12071207 }
12081208 }
12091209
1210- // Write out all log messages collected from Parallel.ForEach
1211- while ( debugMsgs . TryDequeue ( out string logMsg ) )
1212- {
1213- _cmdletPassedIn . WriteDebug ( logMsg ) ;
1214- }
1215-
1216- while ( verboseMsgs . TryDequeue ( out string verboseMsg ) )
1217- {
1218- _cmdletPassedIn . WriteVerbose ( verboseMsg ) ;
1219- }
1220-
1221- while ( warningMsgs . TryDequeue ( out string warningMsg ) )
1222- {
1223- _cmdletPassedIn . WriteWarning ( warningMsg ) ;
1224- }
1225-
1226- // Write out all errors collected from Parallel.ForEach
1227- while ( errorMsgs . TryDequeue ( out ErrorRecord error ) )
1228- {
1229- _cmdletPassedIn . WriteError ( error ) ;
1230- }
1210+ Utils . WriteOutConcurrentQueue ( _cmdletPassedIn , errorMsgs , warningMsgs , debugMsgs , verboseMsgs ) ;
12311211 }
12321212 }
12331213
@@ -1244,6 +1224,7 @@ private void FindDependencyPackageVersion(
12441224 ConcurrentQueue < string > verboseMsgs )
12451225 {
12461226 PSResourceInfo depPkg = null ;
1227+ debugMsgs . Enqueue ( "In FindHelper::FindDependencyPackageVersion()" ) ;
12471228
12481229 if ( dep . VersionRange . Equals ( VersionRange . All ) || ! dep . VersionRange . HasUpperBound )
12491230 {
@@ -1311,12 +1292,13 @@ private PSResourceInfo FindDependencyWithSpecificVersion(
13111292 ErrorRecord errRecord = null ;
13121293 FindResults responses = null ;
13131294 Task < FindResults > response = null ;
1295+ debugMsgs . Enqueue ( "In FindHelper::FindDependencyWithSpecificVersion()" ) ;
13141296
13151297 if ( currentServer . Repository . ApiVersion == PSRepositoryInfo . APIVersion . V2 )
13161298 {
13171299 // See if the network call we're making is already cached, if not, call FindNameAsync() and cache results
13181300 string key = $ "{ dep . Name } |{ dep . VersionRange . MaxVersion . ToString ( ) } |{ _type } ";
1319- verboseMsgs . Enqueue ( "Checking if network call is cached." ) ;
1301+ debugMsgs . Enqueue ( "Checking if network call is cached." ) ;
13201302 response = _cachedNetworkCalls . GetOrAdd ( key , _ => currentServer . FindVersionAsync ( dep . Name , dep . VersionRange . MaxVersion . ToString ( ) , _type , errorMsgs , warningMsgs , debugMsgs , verboseMsgs ) ) ;
13211303
13221304 responses = response . GetAwaiter ( ) . GetResult ( ) ;
@@ -1353,14 +1335,14 @@ private PSResourceInfo FindDependencyWithSpecificVersion(
13531335 TryAddToKnownLatestPkgVersion ( depPkg ) ;
13541336
13551337 string pkgVersion = FormatPkgVersionString ( depPkg ) ;
1356- verboseMsgs . Enqueue ( $ "Found dependency '{ depPkg . Name } ' version '{ pkgVersion } '") ;
1338+ debugMsgs . Enqueue ( $ "Found dependency '{ depPkg . Name } ' version '{ pkgVersion } '") ;
13571339 string key = $ "{ depPkg . Name } { pkgVersion } ";
13581340 if ( ! depPkgsFound . ContainsKey ( key ) )
13591341 {
13601342 // Add pkg to collection of packages found then find dependencies
13611343 // depPkgsFound creates a new instance of depPkgsFound each time FindDependencyPackages() is called.
13621344 // This will eventually return the PSResourceInfo object to the main cmdlet class.
1363- verboseMsgs . Enqueue ( $ "Adding'{ key } ' to list of dependency packages found") ;
1345+ debugMsgs . Enqueue ( $ "Adding'{ key } ' to list of dependency packages found") ;
13641346 depPkgsFound . TryAdd ( key , depPkg ) ;
13651347 FindDependencyPackagesHelper ( currentServer , currentResponseUtil , depPkg , repository ) ;
13661348 }
@@ -1386,12 +1368,13 @@ private PSResourceInfo FindDependencyWithLowerBound(
13861368 FindResults responses = null ;
13871369 ErrorRecord errRecord = null ;
13881370 Task < FindResults > response = null ;
1389-
1371+ debugMsgs . Enqueue ( "In FindHelper::FindDependencyWithLowerBound()" ) ;
1372+
13901373 if ( currentServer . Repository . ApiVersion == PSRepositoryInfo . APIVersion . V2 )
13911374 {
13921375 // See if the network call we're making is already cached, if not, call FindNameAsync() and cache results
13931376 string key = $ "{ dep . Name } |*|{ _type } ";
1394- verboseMsgs . Enqueue ( "Checking if network call is cached." ) ;
1377+ debugMsgs . Enqueue ( "Checking if network call is cached." ) ;
13951378 response = _cachedNetworkCalls . GetOrAdd ( key , _ => currentServer . FindNameAsync ( dep . Name , includePrerelease : true , _type , errorMsgs , warningMsgs , debugMsgs , verboseMsgs ) ) ;
13961379
13971380 responses = response . GetAwaiter ( ) . GetResult ( ) ;
@@ -1427,14 +1410,14 @@ private PSResourceInfo FindDependencyWithLowerBound(
14271410 TryAddToKnownLatestPkgVersion ( depPkg ) ;
14281411
14291412 string pkgVersion = FormatPkgVersionString ( depPkg ) ;
1430- verboseMsgs . Enqueue ( $ "Found dependency '{ depPkg . Name } ' version '{ pkgVersion } '") ;
1413+ debugMsgs . Enqueue ( $ "Found dependency '{ depPkg . Name } ' version '{ pkgVersion } '") ;
14311414 string key = $ "{ depPkg . Name } { pkgVersion } ";
14321415 if ( ! depPkgsFound . ContainsKey ( key ) )
14331416 {
14341417 // Add pkg to collection of packages found then find dependencies
14351418 // depPkgsFound creates a new instance of depPkgsFound each time FindDependencyPackages() is called.
14361419 // This will eventually return the PSResourceInfo object to the main cmdlet class.
1437- verboseMsgs . Enqueue ( $ "Adding'{ key } ' to list of dependency packages found") ;
1420+ debugMsgs . Enqueue ( $ "Adding'{ key } ' to list of dependency packages found") ;
14381421 depPkgsFound . TryAdd ( key , depPkg ) ;
14391422 FindDependencyPackagesHelper ( currentServer , currentResponseUtil , depPkg , repository ) ;
14401423 }
@@ -1462,12 +1445,13 @@ private PSResourceInfo FindDependencyWithUpperBound(
14621445 Task < FindResults > response = null ;
14631446
14641447 ConcurrentDictionary < string , Task < FindResults > > cachedNetworkCalls = new ConcurrentDictionary < string , Task < FindResults > > ( ) ;
1448+ debugMsgs . Enqueue ( "In FindHelper::FindDependencyWithUpperBound()" ) ;
14651449
14661450 if ( currentServer . Repository . ApiVersion == PSRepositoryInfo . APIVersion . V2 )
14671451 {
14681452 // See if the network call we're making is already caced, if not, call FindNameAsync() and cache results
14691453 string key = $ "{ dep . Name } |{ dep . VersionRange . MaxVersion . ToString ( ) } |{ _type } ";
1470- verboseMsgs . Enqueue ( "Checking if network call is cached." ) ;
1454+ debugMsgs . Enqueue ( "Checking if network call is cached." ) ;
14711455 response = cachedNetworkCalls . GetOrAdd ( key , _ => currentServer . FindVersionGlobbingAsync ( dep . Name , dep . VersionRange , includePrerelease : true , ResourceType . None , getOnlyLatest : true , errorMsgs , warningMsgs , debugMsgs , verboseMsgs ) ) ;
14721456
14731457 responses = response . GetAwaiter ( ) . GetResult ( ) ;
@@ -1505,14 +1489,14 @@ private PSResourceInfo FindDependencyWithUpperBound(
15051489 TryAddToKnownLatestPkgVersion ( depPkg ) ;
15061490
15071491 string pkgVersion = FormatPkgVersionString ( depPkg ) ;
1508- verboseMsgs . Enqueue ( $ "Found dependency '{ depPkg . Name } ' version '{ pkgVersion } '") ;
1492+ debugMsgs . Enqueue ( $ "Found dependency '{ depPkg . Name } ' version '{ pkgVersion } '") ;
15091493 string key = $ "{ depPkg . Name } { pkgVersion } ";
15101494 if ( ! depPkgsFound . ContainsKey ( key ) )
15111495 {
15121496 // Add pkg to collection of packages found then find dependencies
15131497 // depPkgsFound creates a new instance of depPkgsFound each time FindDependencyPackages() is called.
15141498 // This will eventually return the PSResourceInfo object to the main cmdlet class.
1515- verboseMsgs . Enqueue ( $ "Adding'{ key } ' to list of dependency packages found") ;
1499+ debugMsgs . Enqueue ( $ "Adding'{ key } ' to list of dependency packages found") ;
15161500 depPkgsFound . TryAdd ( key , depPkg ) ;
15171501 FindDependencyPackagesHelper ( currentServer , currentResponseUtil , depPkg , repository ) ;
15181502 }
0 commit comments