Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incomplete Allowed Types list #6884

Closed
iRon7 opened this issue Nov 12, 2020 · 7 comments
Closed

Incomplete Allowed Types list #6884

iRon7 opened this issue Nov 12, 2020 · 7 comments
Assignees
Labels
area-about Area - About_ topics area-core Area - Microsoft.PowerShell.Core module

Comments

@iRon7
Copy link
Contributor

iRon7 commented Nov 12, 2020

There is (at least) one type missing from the Allowed Types list under CONSTRAINED LANGUAGE (Constrained Language).
See also StackOverflow question and comments: Automatically retrieve Allowed Types for Constrained Language mode


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

@chasewilson chasewilson self-assigned this Nov 12, 2020
@chasewilson chasewilson added area-about Area - About_ topics area-core Area - Microsoft.PowerShell.Core module labels Nov 12, 2020
@chasewilson
Copy link
Contributor

Hi @iRon7 . Thanks for the feedback.

As far as I can tell, the list is accurate unless you can find specifics. The following is what I ran to test:

# Temporarily change the language mode for a session. 
$ExecutionContext.SessionState.LanguageMode = "ConstrainedLanguage"

$test = [System.Collections.Specialized.OrderedDictionary]::new()
InvalidOperation: Cannot create type. Only core types are supported in this language mode.

I'll be closing this for now but if you have more to add, I'll be keeping an eye on the issue and reopen if necessary.

@iRon7
Copy link
Contributor Author

iRon7 commented Nov 12, 2020

Hmm,
I think it might be a bug:

$ExecutionContext.SessionState.LanguageMode = "ConstrainedLanguage"
$Test = [Ordered]@{a=1}
$Test.PSTypeNames
System.Collections.Specialized.OrderedDictionary
System.Object

Or is the syntactic sugar construct [ordered] actually a safe type constructor and underlying .NET type constructor [System.Collections.Specialized.OrderedDictionary] not?
In that case, I still think it is a document issue...

@chasewilson
Copy link
Contributor

chasewilson commented Nov 12, 2020

What version are you working with.

For me, in version 7, I can't even create it. However, in V5 and 6, I can create it and access it but can't do anything method based...

Ordered is an alias for the type, they are are same. I'll do some digging.

EDIT: Retracting my statement about [ordered]. Will follow up.

@iRon7
Copy link
Contributor Author

iRon7 commented Nov 12, 2020

Name                           Value
----                           -----
PSVersion                      7.0.3
PSEdition                      Core
GitCommitId                    7.0.3
OS                             Microsoft Windows 10.0.19041
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

@chasewilson
Copy link
Contributor

So, according the the PowerShell team. This isn't expected behavior and the official positions for things like this is not to document them and they will be reviewing the behavior to see if there is a fix needed.

This is a good find and if there is more information coming my way, I'll make sure to pass it on to you.

Thanks again!

@iRon7
Copy link
Contributor Author

iRon7 commented Nov 12, 2020

Thanks, shall I create a formal issue at: https://github.com/PowerShell/PowerShell/issues ?

@chasewilson
Copy link
Contributor

It would'nt hurt and would give you a good avenue to add info or communicate with the devs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-about Area - About_ topics area-core Area - Microsoft.PowerShell.Core module
Projects
None yet
Development

No branches or pull requests

2 participants