-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Closed
Labels
Issue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aResolution-No ActivityIssue has had no activity for 6 months or moreIssue has had no activity for 6 months or moreWG-Enginecore PowerShell engine, interpreter, and runtimecore PowerShell engine, interpreter, and runtime
Description
In Windows PowerShell, using assembly System.Windows.Forms is the parse-time equivalent of Add-Type -AssemblyName System.Windows.Forms; that is, System.Windows.Forms.dll is being looked for in the GAC.
While Add-Type -AssemblyName System.Windows.Forms in PowerShell Core works analogously by looking for the DLL among the ones that ship with PowerShell, using assembly System.Windows.Forms doesn't work:
- Not specifying the
.dllextension is not supported at all.- In WinPS the absence of
.dllseemingly served as the signal to look in the GAC.
- In WinPS the absence of
- With
.dll, but without a full path, the assembly is looked for in / relative to the script's location.
Is this a regression bug or were there design changes?
Note: Even a functioning using assembly statement is not enough if a script tries to subclass types from that assembly (trying to use such types as the base class of a PS custom class definition). However, this is a separate issue - see #3641 (comment).
Steps to reproduce
# WINDOWS ONLY
# Note: This works in WinPS
{ iex 'using assembly System.Windows.Forms' } | Should -Not -ThrowExpected behavior
The test should pass.
Actual behavior
The test fails:
Cannot load assembly 'System.Windows.Forms'
Environment data
PowerShell Core 7.0.0-rc.2
mkht and WEX-RMishlerronascentes
Metadata
Metadata
Assignees
Labels
Issue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aResolution-No ActivityIssue has had no activity for 6 months or moreIssue has had no activity for 6 months or moreWG-Enginecore PowerShell engine, interpreter, and runtimecore PowerShell engine, interpreter, and runtime