@@ -334,12 +334,12 @@ private void InitializePSScriptAnalyzer()
334334 EnumeratePSScriptAnalyzerRules ( ) ;
335335 }
336336
337- private async Task < IEnumerable < PSObject > > GetDiagnosticRecordsAsync < TSettings > (
337+ private async Task < PSObject [ ] > GetDiagnosticRecordsAsync < TSettings > (
338338 ScriptFile file ,
339339 string [ ] rules ,
340340 TSettings settings ) where TSettings : class
341341 {
342- IEnumerable < PSObject > diagnosticRecords = Enumerable . Empty < PSObject > ( ) ;
342+ var diagnosticRecords = new PSObject [ 0 ] ;
343343
344344 if ( this . scriptAnalyzerModuleInfo != null
345345 && ( typeof ( TSettings ) == typeof ( string )
@@ -375,14 +375,14 @@ private async Task<IEnumerable<PSObject>> GetDiagnosticRecordsAsync<TSettings>(
375375 return diagnosticRecords ;
376376 }
377377
378- private IEnumerable < PSObject > InvokePowerShell ( string command , IDictionary < string , object > paramArgMap )
378+ private PSObject [ ] InvokePowerShell ( string command , IDictionary < string , object > paramArgMap )
379379 {
380380 var task = InvokePowerShellAsync ( command , paramArgMap ) ;
381381 task . Wait ( ) ;
382382 return task . Result ;
383383 }
384384
385- private async Task < IEnumerable < PSObject > > InvokePowerShellAsync ( string command , IDictionary < string , object > paramArgMap )
385+ private async Task < PSObject [ ] > InvokePowerShellAsync ( string command , IDictionary < string , object > paramArgMap )
386386 {
387387 using ( var powerShell = System . Management . Automation . PowerShell . Create ( ) )
388388 {
@@ -396,10 +396,10 @@ private async Task<IEnumerable<PSObject>> InvokePowerShellAsync(string command,
396396 var result = await Task . Factory . FromAsync ( powerShell . BeginInvoke ( ) , powerShell . EndInvoke ) ;
397397 if ( result == null )
398398 {
399- return Enumerable . Empty < PSObject > ( ) ;
399+ return new PSObject [ 0 ] ;
400400 }
401401
402- return result ;
402+ return result . ToArray ( ) ; ;
403403 }
404404 }
405405
0 commit comments