mirror of
https://github.com/aphrody-labs/PowerShell.git
synced 2026-10-14 05:39:11 +00:00
Fix generating OutputType when running in Constrained Language Mode (#21605)
This commit is contained in:
1 parent
0fee36393f
commit
467538ff9b
1 file changed
+9
-1
@@ -1565,7 +1565,15 @@ namespace System.Management.Automation.Language
|
||||
|
||||
if (args[0] is Type)
|
||||
{
|
||||
result = new OutputTypeAttribute(LanguagePrimitives.ConvertTo<Type[]>(args));
|
||||
// We avoid `ConvertTo<Type[]>(args)` here as CLM would throw due to `Type[]`
|
||||
// being a "non-core" type. NOTE: This doesn't apply to `string[]`.
|
||||
Type[] types = new Type[args.Length];
|
||||
for (int i = 0; i < args.Length; i++)
|
||||
{
|
||||
types[i] = LanguagePrimitives.ConvertTo<Type>(args[i]);
|
||||
}
|
||||
|
||||
result = new OutputTypeAttribute(types);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user