Skip to content

Commit fe38405

Browse files
authored
Separate DSC configuration parser check for ARM processor (PowerShell#21395)
1 parent 4bcc3f4 commit fe38405

2 files changed

Lines changed: 16 additions & 2 deletions

File tree

src/System.Management.Automation/engine/parser/Parser.cs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2984,8 +2984,8 @@ private StatementAst ConfigurationStatementRule(IEnumerable<AttributeAst> custom
29842984
Runspaces.Runspace.DefaultRunspace = localRunspace;
29852985
}
29862986

2987-
// Configuration is not supported on ARM or in ConstrainedLanguage
2988-
if (PsUtils.IsRunningOnProcessorArchitectureARM() || Runspace.DefaultRunspace?.ExecutionContext?.LanguageMode == PSLanguageMode.ConstrainedLanguage)
2987+
// Configuration is not supported in ConstrainedLanguage
2988+
if (Runspace.DefaultRunspace?.ExecutionContext?.LanguageMode == PSLanguageMode.ConstrainedLanguage)
29892989
{
29902990
if (SystemPolicy.GetSystemLockdownPolicy() != SystemEnforcementMode.Audit)
29912991
{
@@ -3004,6 +3004,17 @@ private StatementAst ConfigurationStatementRule(IEnumerable<AttributeAst> custom
30043004
dropIntoDebugger: true);
30053005
}
30063006

3007+
// Configuration is not supported on ARM64
3008+
if (PsUtils.IsRunningOnProcessorArchitectureARM())
3009+
{
3010+
ReportError(
3011+
configurationToken.Extent,
3012+
nameof(ParserStrings.ConfigurationNotAllowedOnArm64),
3013+
ParserStrings.ConfigurationNotAllowedOnArm64,
3014+
configurationToken.Kind.Text());
3015+
return null;
3016+
}
3017+
30073018
// Configuration is not supported on WinPE
30083019
if (Utils.IsWinPEHost())
30093020
{

src/System.Management.Automation/resources/ParserStrings.resx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1370,4 +1370,7 @@ ModuleVersion : Version of module to import. If used, ModuleName must represent
13701370
<data name="WDACGetSteppablePipelineLogMessage" xml:space="preserve">
13711371
<value>Creating a steppable pipeline from a script block may require evaluating some expressions within the script block. The expression evaluation will silently fail and return 'null' in Constrained Language mode, unless the expression represents a constant value.</value>
13721372
</data>
1373+
<data name="ConfigurationNotAllowedOnArm64" xml:space="preserve">
1374+
<value>Configuration keyword is not supported on ARM64 processors.</value>
1375+
</data>
13731376
</root>

0 commit comments

Comments
 (0)