Skip to content

Handle UI Freezes when IMGR is called from WPF #439

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

Merged
merged 14 commits into from
Nov 25, 2020

Conversation

georgend
Copy link
Contributor

@georgend georgend commented Oct 22, 2020

Use asynccommandruntime to handle async calls.
Fix double formatted resource strings.

Testing
Client was using the script references in issue #390
Local testing using client script shows the freezes no longer occur.

Fixes #436
Fixes #390

@georgend georgend self-assigned this Oct 22, 2020
@georgend georgend added the Bug label Oct 22, 2020
@georgend georgend linked an issue Oct 22, 2020 that may be closed by this pull request
@georgend georgend added this to the 1.1.0 milestone Oct 22, 2020
@georgend georgend marked this pull request as ready for review October 22, 2020 11:17
@georgend georgend requested a review from peombwa October 27, 2020 13:31
peombwa
peombwa previously approved these changes Oct 28, 2020
@peombwa peombwa self-requested a review October 28, 2020 00:11
Copy link
Member

@peombwa peombwa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like the UI freeze also happens with Connect-MgGraph when called with -ForceRefresh. Consider using NoSynchronizationContext with Connect-MgGraph as well.

Here is a repro of the same :

Add-Type -AssemblyName PresentationFramework

[xml]$xaml = @"
<Window
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    Title="Window" Height="200" Width="300">
    <Grid Background="#FFECECEC">
    <Button Name="button1" Content="Connect-MgGraph" HorizontalAlignment="Left" Margin="10,10,10,10" VerticalAlignment="Top"/>
	<Button Name="button2" Content="Connect-MgGraph -ForceRefresh" HorizontalAlignment="Left" Margin="10,30,10,10" VerticalAlignment="Top"/>
    <Button Name="button3" Content="Invoke-GraphRequest" HorizontalAlignment="Left" Margin="10,50,10,10" VerticalAlignment="Top"/>
    </Grid>
    </Window>
"@

$reader = (New-Object System.Xml.XmlNodeReader $xaml)

$window = [Windows.Markup.XamlReader]::Load($reader)

$button1 = $window.FindName("button1")
$button1.Add_Click( {
    write-host (Connect-MgGraph | out-string)
})

$button2 = $window.FindName("button2")
$button2.Add_Click( {
    write-host (Connect-MgGraph -ForceRefresh | out-string)
})

$button3 = $window.FindName("button3")
$button3.Add_Click( {
    write-host (Invoke-GraphRequest -uri "https://graph.microsoft.com/v1.0/users" | out-string)
})

$window.ShowDialog()

@peombwa peombwa dismissed their stale review October 28, 2020 00:15

See comment

@georgend georgend requested a review from peombwa October 30, 2020 10:11
@darrelmiller darrelmiller modified the milestones: 1.1.0, 1.2.0 Nov 11, 2020
peombwa
peombwa previously approved these changes Nov 16, 2020
Minor cleanup
@georgend georgend requested a review from peombwa November 18, 2020 11:15
@georgend georgend merged commit 2da2646 into dev Nov 25, 2020
@peombwa peombwa mentioned this pull request Nov 30, 2020
@peombwa peombwa deleted the bugfixes/powershellFreezes branch December 11, 2020 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Double Formatted Resource Strings in InvokeMgGraphRequest.cs Powershell freezes when using Invoke-GraphRequest and WPF
3 participants