{"action":"created","issue":{"url":"https://api.github.com/repos/Azure/azure-powershell/issues/3205","repository_url":"https://api.github.com/repos/Azure/azure-powershell","labels_url":"https://api.github.com/repos/Azure/azure-powershell/issues/3205/labels{/name}","comments_url":"https://api.github.com/repos/Azure/azure-powershell/issues/3205/comments","events_url":"https://api.github.com/repos/Azure/azure-powershell/issues/3205/events","html_url":"https://github.com/Azure/azure-powershell/issues/3205","id":189996501,"number":3205,"title":"Get-AzureStorageContainer stalls when called from event","user":{"login":"TrickyTic","id":23520145,"avatar_url":"https://avatars.githubusercontent.com/u/23520145?v=3","gravatar_id":"","url":"https://api.github.com/users/TrickyTic","html_url":"https://github.com/TrickyTic","followers_url":"https://api.github.com/users/TrickyTic/followers","following_url":"https://api.github.com/users/TrickyTic/following{/other_user}","gists_url":"https://api.github.com/users/TrickyTic/gists{/gist_id}","starred_url":"https://api.github.com/users/TrickyTic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TrickyTic/subscriptions","organizations_url":"https://api.github.com/users/TrickyTic/orgs","repos_url":"https://api.github.com/users/TrickyTic/repos","events_url":"https://api.github.com/users/TrickyTic/events{/privacy}","received_events_url":"https://api.github.com/users/TrickyTic/received_events","type":"User","site_admin":false},"labels":[{"id":148836221,"url":"https://api.github.com/repos/Azure/azure-powershell/labels/Storage","name":"Storage","color":"DDDDDD","default":false}],"state":"open","locked":false,"assignee":{"login":"blueww","id":6926193,"avatar_url":"https://avatars.githubusercontent.com/u/6926193?v=3","gravatar_id":"","url":"https://api.github.com/users/blueww","html_url":"https://github.com/blueww","followers_url":"https://api.github.com/users/blueww/followers","following_url":"https://api.github.com/users/blueww/following{/other_user}","gists_url":"https://api.github.com/users/blueww/gists{/gist_id}","starred_url":"https://api.github.com/users/blueww/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blueww/subscriptions","organizations_url":"https://api.github.com/users/blueww/orgs","repos_url":"https://api.github.com/users/blueww/repos","events_url":"https://api.github.com/users/blueww/events{/privacy}","received_events_url":"https://api.github.com/users/blueww/received_events","type":"User","site_admin":false},"assignees":[{"login":"blueww","id":6926193,"avatar_url":"https://avatars.githubusercontent.com/u/6926193?v=3","gravatar_id":"","url":"https://api.github.com/users/blueww","html_url":"https://github.com/blueww","followers_url":"https://api.github.com/users/blueww/followers","following_url":"https://api.github.com/users/blueww/following{/other_user}","gists_url":"https://api.github.com/users/blueww/gists{/gist_id}","starred_url":"https://api.github.com/users/blueww/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blueww/subscriptions","organizations_url":"https://api.github.com/users/blueww/orgs","repos_url":"https://api.github.com/users/blueww/repos","events_url":"https://api.github.com/users/blueww/events{/privacy}","received_events_url":"https://api.github.com/users/blueww/received_events","type":"User","site_admin":false}],"milestone":null,"comments":9,"created_at":"2016-11-17T09:56:35Z","updated_at":"2016-12-20T09:48:25Z","closed_at":null,"body":"### Cmdlet(s)\r\nGet-AzureStorageContainer\r\n\r\n### PowerShell Version\r\n4.0\r\n\r\n### Module Version\r\nAzure.Storage version 2.3.0\r\n\r\n### OS Version\r\n6.3.9600.16406\r\n\r\n### Description\r\nOutput stalls displaying task status when calling Get-AzureStorageContainer from a WPF GUI event.\r\n\r\n### Script/Steps for Reproduction\r\nExecute Get-StorageContainer from a WPF GUI event\r\n```powershell\r\n# vim: sw=4 ts=4 fdc=4 fdm=marker\r\n#\r\n\r\n# Create GUI object {{{\r\nIf ([threading.thread]::CurrentThread.GetApartmentState() -ne \"STA\") {\r\n\tWrite-Host -ForegroundColor \"RED\" \"You must run this script in Single Threaded Apartment mode (powershell.exe -STA).\"\r\n\tExit 1\r\n}\r\n\r\n[void][System.Reflection.Assembly]::LoadWithPartialName('PresentationFramework')\r\n\r\n[XML]$XAML='\r\n<Window\r\n xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\r\n xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\"\r\n Title=\"Test window\" Height=\"103\" Width=\"276\" WindowStartupLocation=\"CenterOwner\" Topmost=\"True\" ResizeMode=\"NoResize\" WindowStyle=\"ToolWindow\">\r\n <Grid>\r\n  <TextBlock x:Name=\"lblPrompt\" HorizontalAlignment=\"Left\" Margin=\"10,10,0,0\" TextWrapping=\"Wrap\" Text=\"Click button to run problem code as an event\" VerticalAlignment=\"Top\" Width=\"244\" Height=\"37\"/>\r\n  <Button x:Name=\"btnClick\" Content=\"ClickMe\" HorizontalAlignment=\"Left\" Margin=\"93,38,0,0\" VerticalAlignment=\"Top\" Width=\"75\" IsDefault=\"True\"/>\r\n </Grid>\r\n</Window>\r\n'\r\n$xmlReader=(New-Object System.Xml.XmlNodeReader ($XAML))\r\n$Window=[Windows.Markup.XamlReader]::Load($xmlReader)\r\n$btnClick=$Window.FindName(\"btnClick\")\r\n$btnClick.Add_Click({Test-ProblemCode \"button click event\"})\r\n# Create GUI object }}}\r\n\r\nWrite-Host \"`n`n`n`n`n`n\" # Move down console to avoid progress overlay\r\n$User=whoami /upn\r\nWhile($TRUE){\r\n\tTry{\r\n\t\t$Cred=Get-Credential -Message \"Enter credentials to connect to Azure\" -User $User\r\n\t\tIf([string]$Cred.Username -eq \"\"){\r\n\t\t\tWrite-Host -ForegroundColor YELLOW -BackgroundColor BLACK \"Cancelled at your request\"\r\n\t\t\tBreak\r\n\t\t}\r\n\t\tWrite-Host \"Attempting Azure login...\"\r\n\t\t$RV=Login-AzureRmAccount -Credential $Cred -ErrorAction Stop\r\n\t\tWrite-Host \"Azure login OK\"\r\n\t\tBreak\r\n\t} Catch {\r\n\t\tWrite-Host -ForegroundColor RED -BackgroundColor BLACK (\"Failed to login to Azure with account '{0}', try again or cancel to exit\" -f $Cred.Username)\r\n\t\t$User=$Cred.Username\r\n\t}\r\n}\r\nIf([string]$Cred.Username -eq \"\"){ exit 1 }\r\n\r\n# Get-AzureStorageContainer test code \r\nFunction Test-ProblemCode($s)\r\n{\r\n\tWrite-Host (\"`nTesting problem code from {0}...\" -f $s)\r\n\t# Iterate subscriptions\r\n\tGet-AzureRmSubscription | Foreach-Object {\r\n\t\tWrite-Host (\" - Subscription: {0}\" -f $_.SubscriptionID)\r\n\t\t$RV=Select-AzureRMSubscription -SubscriptionID $_.SubscriptionID\r\n\t\t# Iterate Storage Accounts\r\n\t\tGet-AzureRmStorageAccount | Select-Object -First 2 -Wait | Foreach-Object {\r\n\t\t\tWrite-Host (\" - - Storage account '{0}', resource group '{1}'\" -f $_.StorageAccountName,$_.ResourceGroupName)\r\n\t\t\t# Iterate containers *** At this point the process pipeline stalls ***\r\n\t\t\t$_ | Get-AzureStorageContainer | Select-Object -First 2 -Wait | Foreach-Object {\r\n\t\t\t\tWrite-Host (\" - - - Container '{0}'\" -f $_.Name)\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n# Initial test from main\r\nTest-ProblemCode \"main script\"\r\nWrite-Host -ForegroundColor GREEN \"`nNow click the button in the window to run the same code in an event\"\r\n# Now test from event\r\n$Window.ShowDialog() | Out-Null\r\n```\r\n![get-azurestoragecontainer_stalled](https://cloud.githubusercontent.com/assets/23520145/20384465/dc507cde-acab-11e6-95d0-e77dfd917af4.png)\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/Azure/azure-powershell/issues/comments/268200102","html_url":"https://github.com/Azure/azure-powershell/issues/3205#issuecomment-268200102","issue_url":"https://api.github.com/repos/Azure/azure-powershell/issues/3205","id":268200102,"user":{"login":"keeshuizer","id":24562945,"avatar_url":"https://avatars.githubusercontent.com/u/24562945?v=3","gravatar_id":"","url":"https://api.github.com/users/keeshuizer","html_url":"https://github.com/keeshuizer","followers_url":"https://api.github.com/users/keeshuizer/followers","following_url":"https://api.github.com/users/keeshuizer/following{/other_user}","gists_url":"https://api.github.com/users/keeshuizer/gists{/gist_id}","starred_url":"https://api.github.com/users/keeshuizer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/keeshuizer/subscriptions","organizations_url":"https://api.github.com/users/keeshuizer/orgs","repos_url":"https://api.github.com/users/keeshuizer/repos","events_url":"https://api.github.com/users/keeshuizer/events{/privacy}","received_events_url":"https://api.github.com/users/keeshuizer/received_events","type":"User","site_admin":false},"created_at":"2016-12-20T09:48:25Z","updated_at":"2016-12-20T09:48:25Z","body":"After continuing with my script I seem to have run in the same (kind of) problem as with the cmdlets mentioned earlier.\r\n\r\nThis time I created a function that just powers on a VM:\r\n\r\nFunction StartTestenv {\r\n     Start-AzureRmVM -ResourceGroupName $RG -Name $VM\r\n    }\r\n\r\nthis function is started when pressing a button in my gui, the starting of the VM is being done as I can see it being started in the Azure portal, but the Start-Azure-RmVM command never seems to finish. \r\nWhenever i run this start command from a powershell console the command finishes a couple of seconds after i run the command.\r\n"}}
{"actor":{"display_login":"keeshuizer"}}