Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions src/System.Management.Automation/engine/parser/Parser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2984,8 +2984,8 @@ private StatementAst ConfigurationStatementRule(IEnumerable<AttributeAst> custom
Runspaces.Runspace.DefaultRunspace = localRunspace;
}

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

// Configuration is not supported on ARM64
if (PsUtils.IsRunningOnProcessorArchitectureARM())
{
ReportError(
configurationToken.Extent,
nameof(ParserStrings.ConfigurationNotAllowedOnArm64),
ParserStrings.ConfigurationNotAllowedOnArm64,
configurationToken.Kind.Text());
return null;
}

// Configuration is not supported on WinPE
if (Utils.IsWinPEHost())
{
Expand Down
3 changes: 3 additions & 0 deletions src/System.Management.Automation/resources/ParserStrings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1370,4 +1370,7 @@ ModuleVersion : Version of module to import. If used, ModuleName must represent
<data name="WDACGetSteppablePipelineLogMessage" xml:space="preserve">
<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>
</data>
<data name="ConfigurationNotAllowedOnArm64" xml:space="preserve">
<value>Configuration keyword is not supported on ARM64 processors.</value>
</data>
</root>