SnV
December 17, 2020, 4:29pm
1
System.InvalidOperationException: The calling thread must be STA, because many UI components require this.
at System.Windows.Input.InputManager…ctor()
at System.Windows.Input.InputManager.GetCurrentInputManagerImpl()
at Devolutions.RemoteDesktopManager.Business.Options.Option.get_PromptDataSourceOnStartUp()
at RemoteDesktopManager.PowerShellModule.BaseCommand.BeginProcessing()
None of my tables are loading, anymore and they where in the old version.
Code I am using bellow:
New-UDStyle -Style $GlobalStyle -Content{
$Cache:ClientData= “”
New-UDCard -Title “Add a password to an existing client” -Content {
Update-Vaults
New-UDForm -Content {
$Cache:ClientData= “”
New-UDSelect -id “REP_Select_client” -Label “Select a client” -option {
New-UDSelectOption -name “Select a client” -Value “Select a client”
foreach ($Devolutions_RDMvault in $Cache:Devolutions_RDMvaults)
{
New-UDSelectOption -name $Devolutions_RDMvault.name -Value $Devolutions_RDMvault.name
}
}
“Start Date”
New-UDDatePicker -ID “FromDate” -Label “From Date” -value (get-date).AddMonths(-1)
“End Date”
New-UDDatePicker -ID “ToDate” -Label “To Date”
“Start Time”
New-UDTimePicker -ID “FromTime” -Label “From Time” -value (get-date -Date “1970-01-01 09:00:00”)
“End Time”
New-UDTimePicker -ID “ToTime” -label “To Time” -value (get-date -Date “1970-01-01 11:55:00PM”)
}-onvalidate {
$FormContent = $Body | ConvertFrom-Json
if ($FormContent.REP_Select_client -eq “Select a client”)
{
New-UDFormValidationResult -ValidationError “Please Select a client”
}else {
New-UDFormValidationResult -Valid
}
}-onsubmit {
$FormContent = $Body | ConvertFrom-Json
$FromDateTime = (get-date -date ((get-date -date $FormContent.FromDate).ToShortDateString()+" “+ (get-date -date $FormContent.FromTime).ToShortTimeString())).ToString(“yyyy-MM-dd HH:mm:ss”)
$ToDateTime = (get-date -date ((get-date -date $FormContent.ToDate).ToShortDateString()+” "+ (get-date -date $FormContent.ToTime).ToShortTimeString())).ToString(“yyyy-MM-dd HH:mm:ss”)
$vaultID = (Cache:Devolutions_RDMvaults| where { _.name -like (Get-UDElement -id “REP_Select_client”)[“value”]}).id
$Cache:ClientData= Invoke-Sqlcmd -ServerInstance “SERVER” -Database “DB NAME” -Query “SELECT * FROM ConnectionLog WHERE (MessageType = 4 or MessageType = 43) and RepositoryID = ‘$vaultID’ AND CreationDate < ‘$ToDateTime’ and CreationDate >= ‘$FromDateTime’ ORDER BY CreationDate DESC”
Sync-UDElement -id “Report_Table”
}
}
New-UDCard -Title “Results” -Content {
New-UDDynamic -ID “Report_Table” -content {
if ($Cache:ClientData-ne “”)
{
$ReportColumns = @(
New-UDTableColumn -Property LoggedUserName -Title “User name”
New-UDTableColumn -Property Message -Title “Message”
New-UDTableColumn -Property ConnectionName -Title “Connection Name”
New-UDTableColumn -Property ConnectionTypeName -Title “Connection Type”
New-UDTableColumn -Property StartDateTimeUTC -Title “Start Time”
New-UDTableColumn -Property EndDateTimeUTC -Title “End Time”
)
$Cache:ClientData= $Cache:ClientData | select LoggedUserName,Message,ConnectionName,ConnectionTypeName,StartDateTimeUTC,EndDateTimeUTC
New-UDTable -filter -Data $Cache:ClientData -columns $ReportColumns -PageSizeOptions @(5,10,20,50,100,$Cache:ClientData.count) -Export
$Cache:ClientData= “”
}
}
}
}
SnV
December 17, 2020, 4:33pm
2
On a diffrent page with a table I now get this error:
Minified React error #152 ; visit https://reactjs.org/docs/error-decoder.html?invariant=152&args[]=Cell for the full message or use the non-minified dev environment for full errors and additional helpful warnings.
Code on this page:
$UDScriptRoot = $PSScriptRoot
Add-PSSnapin citrix*
$AdminAddress = “XXXX”
Function Get-CitrixSessions {
$cache:citrixsessions = Get-BrokerSession -AdminAddress AdminAddress | select UserFullName,SessionState,LaunchedViaPublishedName,SessionKey | ForEach-Object {
[PSCustomObject]@{
UserName = .UserFullName
SessionState = _.SessionState | out-string
App = .LaunchedViaPublishedName
SessionKey = $_.SessionKey
}
}
}
New-UDDashboard -theme (. “$UDScriptRoot\Theme\Theme.ps1”) -Title “EdgeCloud Citrix Session Terminator” -Content {
. “$UDScriptRoot\Theme\Style.ps1”
New-UDStyle -Style $GlobalStyle -Content{
New-UDCard -Title “Sessions” -Content {
Get-CitrixSessions
New-UDDynamic -Id ‘CitrixSessions’ -Content {
$citrixsessionsColumns = @(
New-UDTableColumn -Property UserName -Title “User name”
New-UDTableColumn -Property SessionState -Title “Session State”
New-UDTableColumn -Property App -Title “Application”
New-UDTableColumn -Filter $false -Property Dessert -Title Edit -Render {
$Item = Body | ConvertFrom-Json
New-UDButton -Id "btn ($Item.SessionKey)" -Text “End Session” -OnClick {
Get-BrokerSession -AdminAddress $AdminAddress -SessionKey $Item.SessionKey | stop-BrokerSession
Show-UDModal -Content {
New-UDTypography -Text "Waiting for session to end: "
New-UDProgress -Circular -Color Red
New-UDDynamic -id “WaitForSessionEnd” -content {
Do{
$issessionlive = if (Get-BrokerSession -AdminAddress AdminAddress | where { _.sessionkey -eq $item.SessionKey}) {$true}else{false}
} while ($issessionlive -eq $true)
Hide-UDModal
Get-CitrixSessions
Sync-UDElement -id ‘CitrixSessions’
}
} -Persistent
}
}
)
New-UDTable -filter -Data $cache:citrixsessions -columns $citrixsessionsColumns
} -autorefresh -AutoRefreshInterval 120
}
}
}
SnV
December 18, 2020, 3:03pm
3
[12-17-20 11:06:29 PM] An error occurred: Cannot add a member with the name “rendereddessert” because a member with that name already exists. To overwrite the member anyway, add the Force parameter to your command.
Endpoint: CitrixSessions
Session: f9bb262a-4fe3-49d8-9de7-16892930b465
File:
Endpoint Start Line: 6
Endpoint End Line: 31
Stack Trace: at New-UDTable, C:\Program Files (x86)\Universal\UniversalDashboard\Frameworks\v3\UniversalDashboard.MaterialUI.psm1: line 4058
at , : line 26
Also this error on the page when it loads:
Minified React error #152 ; visit https://reactjs.org/docs/error-decoder.html?invariant=152&args[]=Cell for the full message or use the non-minified dev environment for full errors and additional helpful warnings.
This is the error for the second code snippet above
SnV
December 18, 2020, 4:44pm
4
System.InvalidOperationException: The calling thread must be STA, because many UI components require this.
at System.Windows.Input.InputManager…ctor()
at System.Windows.Input.InputManager.GetCurrentInputManagerImpl()
at Devolutions.RemoteDesktopManager.Business.Options.Option.get_PromptDataSourceOnStartUp()
at RemoteDesktopManager.PowerShellModule.BaseCommand.BeginProcessing()
None of my tables are loading, anymore and they where in the old version.
Code I am using bellow:
New-UDStyle -Style $GlobalStyle -Content{
$Cache:ClientData= “”
New-UDCard -Title “Add a password to an existing client” -Content {
Update-Vaults
New-UDForm -Content {
$Cache:ClientData= “”
New-UDSelect -id “REP_Select_client” -Label “Select a client” -option {
New-UDSelectOption -name “Select a client” -Value “Select a client”
foreach ($Devolutions_RDMvault in $Cache:Devolutions_RDMvaults)
{
New-UDSelectOption -name $Devolutions_RDMvault.name -Value $Devolutions_RDMvault.name
}
}
“Start Date”
New-UDDatePicker -ID “FromDate” -Label “From Date” -value (get-date).AddMonths(-1)
“End Date”
New-UDDatePicker -ID “ToDate” -Label “To Date”
“Start Time”
New-UDTimePicker -ID “FromTime” -Label “From Time” -value (get-date -Date “1970-01-01 09:00:00”)
“End Time”
New-UDTimePicker -ID “ToTime” -label “To Time” -value (get-date -Date “1970-01-01 11:55:00PM”)
}-onvalidate {
$FormContent = $Body | ConvertFrom-Json
if ($FormContent.REP_Select_client -eq “Select a client”)
{
New-UDFormValidationResult -ValidationError “Please Select a client”
}else {
New-UDFormValidationResult -Valid
}
}-onsubmit {
$FormContent = $Body | ConvertFrom-Json
$FromDateTime = (get-date -date ((get-date -date $FormContent.FromDate).ToShortDateString()+" “+ (get-date -date $FormContent.FromTime).ToShortTimeString())).ToString(“yyyy-MM-dd HH:mm:ss”)
$ToDateTime = (get-date -date ((get-date -date $FormContent.ToDate).ToShortDateString()+” "+ (get-date -date $FormContent.ToTime).ToShortTimeString())).ToString(“yyyy-MM-dd HH:mm:ss”)
$vaultID = (Cache:Devolutions_RDMvaults| where { _.name -like (Get-UDElement -id “REP_Select_client”)[“value”]}).id
$Cache:ClientData= Invoke-Sqlcmd -ServerInstance “SERVER” -Database “DB NAME” -Query “SELECT * FROM ConnectionLog WHERE (MessageType = 4 or MessageType = 43) and RepositoryID = ‘$vaultID’ AND CreationDate < ‘$ToDateTime’ and CreationDate >= ‘$FromDateTime’ ORDER BY CreationDate DESC”
Sync-UDElement -id “Report_Table”
}
}
New-UDCard -Title “Results” -Content {
New-UDDynamic -ID “Report_Table” -content {
if ($Cache:ClientData-ne “”)
{
$ReportColumns = @(
New-UDTableColumn -Property LoggedUserName -Title “User name”
New-UDTableColumn -Property Message -Title “Message”
New-UDTableColumn -Property ConnectionName -Title “Connection Name”
New-UDTableColumn -Property ConnectionTypeName -Title “Connection Type”
New-UDTableColumn -Property StartDateTimeUTC -Title “Start Time”
New-UDTableColumn -Property EndDateTimeUTC -Title “End Time”
)
$Cache:ClientData= $Cache:ClientData | select LoggedUserName,Message,ConnectionName,ConnectionTypeName,StartDateTimeUTC,EndDateTimeUTC
New-UDTable -filter -Data $Cache:ClientData -columns $ReportColumns -PageSizeOptions @(5,10,20,50,100,$Cache:ClientData.count) -Export
$Cache:ClientData= “”
}
}
}
}
Looking into this further, it seems to be something to do with the invoke-SQLcmd command. While this used to work in older versions and works in native powershell when running under the PUD it does not seem to complete. Any ideas on this or how to trouble shoot? All the logs show is the table is empty. The PUD is running as a service account that has access to the SQL server and I have checked that within powershell outside of PUD.
Thanks
adam
December 18, 2020, 5:59pm
5
Something is trying to open a Windows Form (Devolutions module?):
SnV:
System.InvalidOperationException: The calling thread must be STA, because many UI components require this.
at System.Windows.Input.InputManager…ctor()
at System.Windows.Input.InputManager.GetCurrentInputManagerImpl()
at Devolutions.RemoteDesktopManager.Business.Options.Option.get_PromptDataSourceOnStartUp()
at RemoteDesktopManager.PowerShellModule.BaseCommand.BeginProcessing()
I don’t see anything in your code that would cause that to happen but would certainly prevent anything from being returned by the table commands.
This error is something that we need to look into as it seems like it’s trying to render this column twice.
An error occurred: Cannot add a member with the name “rendereddessert” because a member with that name already exists. To overwrite the member anyway, add the Force parameter to your command.
You should be able to work around this my actually modifying the line it’s complaining about:
C:\Program Files (x86)\Universal\UniversalDashboard\Frameworks\v3\UniversalDashboard.MaterialUI.psm1: line 4058
Add the -Force
parameter to Add-Member
on that line.
Additionally, you can always use the older framework version to avoid the error. I realize that’s not a great solution but should get you back up and running in the meantime.
SnV
December 19, 2020, 3:53am
6
Hey Adam,
I did roll the frame work back but I get the same issue ill try the force.
neo
December 21, 2020, 10:59am
7
I am also seing this issue (while rendering a New-UdGrid) on PSU1.5.7 UD3.2.4 and UD 3.2.3 (I skipped 3.2.2) but it works on 3.2.1 still…
SnV
December 21, 2020, 3:39pm
8
This upgrade has caused all my pages to break
Especially around tables.
SnV
December 21, 2020, 3:39pm
9
the -force has not fixed anything either.
SnV
December 23, 2020, 3:32pm
10
Any more suggestions? Im stuck with all my pages broken
SnV
December 23, 2020, 4:42pm
11
Rolling back to 3.2.0 has worked.
For one of the pages at least
SnV
December 23, 2020, 5:05pm
12
Ok so rolling back to 3.2.0 worked and got my pages back up and running. Not sure why the later version broke it but I still have the issue with exporting table data here. When you export it only exports what is shown in the table no the entire thing.
do you use -IncludeInExport on the columns you wanna exported and do you select the option to export all the data?