@@ -334,12 +334,12 @@ private void InitializePSScriptAnalyzer()
334
334
EnumeratePSScriptAnalyzerRules ( ) ;
335
335
}
336
336
337
- private async Task < IEnumerable < PSObject > > GetDiagnosticRecordsAsync < TSettings > (
337
+ private async Task < PSObject [ ] > GetDiagnosticRecordsAsync < TSettings > (
338
338
ScriptFile file ,
339
339
string [ ] rules ,
340
340
TSettings settings ) where TSettings : class
341
341
{
342
- IEnumerable < PSObject > diagnosticRecords = Enumerable . Empty < PSObject > ( ) ;
342
+ var diagnosticRecords = new PSObject [ 0 ] ;
343
343
344
344
if ( this . scriptAnalyzerModuleInfo != null
345
345
&& ( typeof ( TSettings ) == typeof ( string )
@@ -375,14 +375,14 @@ private async Task<IEnumerable<PSObject>> GetDiagnosticRecordsAsync<TSettings>(
375
375
return diagnosticRecords ;
376
376
}
377
377
378
- private IEnumerable < PSObject > InvokePowerShell ( string command , IDictionary < string , object > paramArgMap )
378
+ private PSObject [ ] InvokePowerShell ( string command , IDictionary < string , object > paramArgMap )
379
379
{
380
380
var task = InvokePowerShellAsync ( command , paramArgMap ) ;
381
381
task . Wait ( ) ;
382
382
return task . Result ;
383
383
}
384
384
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 )
386
386
{
387
387
using ( var powerShell = System . Management . Automation . PowerShell . Create ( ) )
388
388
{
@@ -396,10 +396,10 @@ private async Task<IEnumerable<PSObject>> InvokePowerShellAsync(string command,
396
396
var result = await Task . Factory . FromAsync ( powerShell . BeginInvoke ( ) , powerShell . EndInvoke ) ;
397
397
if ( result == null )
398
398
{
399
- return Enumerable . Empty < PSObject > ( ) ;
399
+ return new PSObject [ 0 ] ;
400
400
}
401
401
402
- return result ;
402
+ return result . ToArray ( ) ; ;
403
403
}
404
404
}
405
405
0 commit comments