Skip to content

Commit eecf490

Browse files
Copilotbergmeister
andauthored
Guard background AST API for CoreCLR
Co-authored-by: bergmeister <9250262+bergmeister@users.noreply.github.com>
1 parent 2d122fd commit eecf490

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

‎Rules/AvoidAlias.cs‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,9 @@ private ScriptBlockExpressionAst GetDscResourceBody(CommandAst cmdAst)
318318
if (!(cmdAst.Parent is PipelineAst commandPipeline)
319319
|| commandPipeline.PipelineElements.Count != 1
320320
|| commandPipeline.PipelineElements[0] != cmdAst
321+
#if CORECLR
321322
|| commandPipeline.Background
323+
#endif
322324
|| !(commandPipeline.Parent is NamedBlockAst || commandPipeline.Parent is StatementBlockAst))
323325
{
324326
return null;
@@ -347,7 +349,9 @@ private ScriptBlockExpressionAst GetDscResourceBody(CommandAst cmdAst)
347349
if (index >= 0 && index + 1 < statements.Count
348350
&& statements[index + 1] is PipelineAst bodyPipeline
349351
&& bodyPipeline.PipelineElements.Count == 1
352+
#if CORECLR
350353
&& !bodyPipeline.Background
354+
#endif
351355
&& bodyPipeline.PipelineElements[0] is CommandExpressionAst bodyExpression)
352356
{
353357
if (HasStatementSeparator(cmdAst, bodyPipeline)

0 commit comments

Comments
 (0)