@@ -1278,14 +1278,41 @@ private PSResourceInfo FindDependencyWithSpecificVersion(
12781278 PSResourceInfo depPkg = null ;
12791279 ErrorRecord errRecord = null ;
12801280 FindResults responses = null ;
1281- Task < FindResults > response = null ;
12821281 debugMsgs . Enqueue ( "In FindHelper::FindDependencyWithSpecificVersion()" ) ;
12831282
1284-
1283+ ConcurrentQueue < ErrorRecord > operationErrorMsgs = new ConcurrentQueue < ErrorRecord > ( ) ;
1284+ ConcurrentQueue < string > operationWarningMsgs = new ConcurrentQueue < string > ( ) ;
1285+ ConcurrentQueue < string > operationDebugMsgs = new ConcurrentQueue < string > ( ) ;
1286+ ConcurrentQueue < string > operationVerboseMsgs = new ConcurrentQueue < string > ( ) ;
1287+
12851288 // Call FindVersionAsync() for dependency with specific version.
12861289 string key = $ "{ dep . Name } |{ dep . VersionRange . MaxVersion . ToString ( ) } |{ _type } ";
1287- responses = currentServer . FindVersionAsync ( dep . Name , dep . VersionRange . MaxVersion . ToString ( ) , _type , errorMsgs , warningMsgs , debugMsgs , verboseMsgs ) . GetAwaiter ( ) . GetResult ( ) ;
1288- errorMsgs . TryPeek ( out errRecord ) ;
1290+ responses = currentServer . FindVersionAsync ( dep . Name , dep . VersionRange . MaxVersion . ToString ( ) , _type , operationErrorMsgs , operationWarningMsgs , operationDebugMsgs , operationVerboseMsgs ) . GetAwaiter ( ) . GetResult ( ) ;
1291+
1292+ while ( operationErrorMsgs . TryDequeue ( out ErrorRecord queuedError ) )
1293+ {
1294+ if ( errRecord == null )
1295+ {
1296+ errRecord = queuedError ;
1297+ }
1298+
1299+ errorMsgs . Enqueue ( queuedError ) ;
1300+ }
1301+
1302+ while ( operationWarningMsgs . TryDequeue ( out string queuedWarning ) )
1303+ {
1304+ warningMsgs . Enqueue ( queuedWarning ) ;
1305+ }
1306+
1307+ while ( operationDebugMsgs . TryDequeue ( out string queuedDebug ) )
1308+ {
1309+ debugMsgs . Enqueue ( queuedDebug ) ;
1310+ }
1311+
1312+ while ( operationVerboseMsgs . TryDequeue ( out string queuedVerbose ) )
1313+ {
1314+ verboseMsgs . Enqueue ( queuedVerbose ) ;
1315+ }
12891316
12901317 // Error handling and Convert to PSResource object
12911318 if ( errRecord != null )
0 commit comments