PS Studio issues with Get-InstalledLanguage

This forum can be browsed by the general public. Posting is limited to current SAPIEN license holders with active maintenance and does not offer a response time guarantee.
Forum rules
DO NOT POST LICENSE NUMBERS, ACTIVATION KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 1 year and 6 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
ian.bryan
Posts: 2
Last visit: Wed Oct 25, 2023 11:11 am

PS Studio issues with Get-InstalledLanguage

Post by ian.bryan »

ERROR: Get-InstalledLanguage : Cannot change thread mode after it is set. (Exception from HRESULT: 0x80010106 (RPC_E_CHANGED_MODE))

Powershell Studio 5.8.211.0

Has issues with anything from LanguagePackManagement
User avatar
brittneyr
Site Admin
Posts: 1672
Last visit: Tue Apr 16, 2024 11:49 am
Answers: 39
Been upvoted: 31 times

Re: PS Studio issues with Get-InstalledLanguage

Post by brittneyr »

I'm having a hard time reproducing this behavior:
SPS-GetInstalledLanguage.png
SPS-GetInstalledLanguage.png (70.33 KiB) Viewed 1507 times
Can you please provide a screenshot of the application with the error when you attempt to run your script?
Brittney
SAPIEN Technologies, Inc.
ian.bryan
Posts: 2
Last visit: Wed Oct 25, 2023 11:11 am

Re: PS Studio issues with Get-InstalledLanguage

Post by ian.bryan »

So its a form load from a button. I doubled the $languages because sometimes it just wouldnt load them, this has it check to see if its there, and just do it again. (not ideal). This module is brand new as of a month ago so I just assumed PS Studio was having integration issues with it.

$form1_Load={
#TODO: Initialize Form Controls here
$richtextbox1.AppendText("Currently Installed Language Packs")

$languages = Get-InstalledLanguage

if ($languages -eq $null)
{ $languages = Get-InstalledLanguage}

foreach ($l in $languages)
{
$richtextbox1.AppendText("`n$($l.languageid)")
}
$progressbaroverlay1.Visible = $false
}
Attachments
languages.JPG
languages.JPG (63.97 KiB) Viewed 1469 times
User avatar
brittneyr
Site Admin
Posts: 1672
Last visit: Tue Apr 16, 2024 11:49 am
Answers: 39
Been upvoted: 31 times

Re: PS Studio issues with Get-InstalledLanguage

Post by brittneyr »

The issue appears to only happen when using the LanguagePackManagement module with a GUI or WinForm. I've tested this in Visual Studio Code and ISE, but it results in the same error. Basic scripts appear to run fine. My guess is that this module has conflict with a GUI's thread.

While this may change in a update to the module, it might be a good idea to report this to Microsoft.
Brittney
SAPIEN Technologies, Inc.
This topic is 1 year and 6 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.