Exclude -Comobject parameter of New-Object cmdlet on unsupported platforms#4922
Exclude -Comobject parameter of New-Object cmdlet on unsupported platforms#4922daxian-dbw merged 5 commits intoPowerShell:masterfrom
Conversation
c94c454 to
baf780f
Compare
There was a problem hiding this comment.
COM works on NanoServer as well, as long as it has a workable COM component
PS: the COM support was enabled when powershell core was still NanoServer powershell.
There was a problem hiding this comment.
I based on current tests. 😕
So should we exclude the parameter only on Unix?
There was a problem hiding this comment.
The COM components we use in our tests are not available in NanoServer and IoT.
Yes, we should exclude the parameter only for Unix plats.
There was a problem hiding this comment.
Does "Shell.Application" work on NanoServer and IoT? can I use this in a test?
There was a problem hiding this comment.
Shell itself is not available on NanoServer and IoT. You can use it as a test, but just follow the existing tests in test\powershell\engine\COM.
There was a problem hiding this comment.
Why shouldn't we targeting our test to NanoServer and IoT?
| } | ||
|
|
||
| #endif | ||
| #endregion Com |
There was a problem hiding this comment.
I think the entire "com" region here should be under the #if !UNIX.
50a3c63 to
84f7a6c
Compare
84f7a6c to
2af645b
Compare
There was a problem hiding this comment.
This will fail when running tests on NanoServer ... Maybe change it to check if New-Object has the parameter ComObject instead of creating the Shell.Application object?
$s = gcm New-Object
$s.Parameters.ContainsKey("ComObject")
True
Fix #4897.
New-Object -Comobject is not supported on
NotSupportedExceptionexception.First commit reformat test file.