Repository navigation
Fail clearly when loaded in Constrained Language Mode - #7
Merged
Merged
Conversation
On a machine locked to Constrained Language Mode, dot-sourcing the kit failed with "Cannot convert value to type PSTypeName. Only core types are supported in this language mode", which doesn't say what to do. It now checks the language mode first and throws a message naming the mode, why the kit needs FullLanguage, and what usually sets it. The README's Limits section says so, and mentions endpoint security flagging runtime Add-Type. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…wershell.exe $PSHOME\powershell.exe doesn't exist under PowerShell 7. Uses the same $selfExe as the PowerShell 7 CI change, so the two merge cleanly. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was wrong. On a machine locked to Constrained Language Mode (AppLocker or WDAC policy), dot-sourcing the kit failed with
Cannot convert value to type "System.Management.Automation.PSTypeName". Only core types are supported in this language mode.That doesn't tell you the kit can't run there, or why.What changed. Before any
Add-Type, the kit checks$ExecutionContext.SessionState.LanguageModeand, if it isn't FullLanguage, throws a message naming the mode, saying the kit needs FullLanguage to compile its C#, and what usually sets it. README "Limits" gets a line on this, plus a sentence on endpoint security products that flag runtimeAdd-Type.Testing. New harness assertion: a fresh process switched to ConstrainedLanguage dot-sources the kit and must get the new message. It fails against
main's kit (raw PSTypeName error) and passes here; 180 assertions pass.🤖 Generated with Claude Code