FindElement.Refresh stuck in infinite loop when setting a child's events source to the parent's
See original GitHub issueDescribe the bug
If you set a control’s events source to a parent’s, the foreach
loop in FindElement.Refresh()
will get stuck in an infinite loop.
Steps to reproduce the bug Try this code: XAML:
<local:TestControl x:Name="CustomControl" AutomationProperties.Name="CustomControl">
<Button x:Name="Button1" Content="Button"/>
</local:TestControl>
XAML.CS
namespace MUXControlsTestApp
{
public sealed class TestControl : ContentControl
{
protected override AutomationPeer OnCreateAutomationPeer()
{
return new TestControlAutomationPeer(this);
}
}
public sealed class TestControlAutomationPeer : FrameworkElementAutomationPeer
{
public TestControlAutomationPeer(TestControl owner) : base(owner){}
protected override AutomationControlType GetAutomationControlTypeCore()
{
return AutomationControlType.Custom;
}
}
[TopLevelTestPage(Name = "Expander")]
public sealed partial class ExpanderPage : TestPage
{
public ExpanderPage()
{
this.InitializeComponent();
var customControlPeer = FrameworkElementAutomationPeer.FromElement(CustomControl);
var buttonPeer= FrameworkElementAutomationPeer.FromElement(Button1);
buttonPeer.EventsSource = customControlPeer;
}
}
}
Expected behavior
Screenshots
Version Info
NuGet package version:
Windows app type:
UWP | Win32 |
---|---|
Windows 10 version | Saw the problem? |
---|---|
Insider Build (xxxxx) | |
May 2020 Update (19041) | |
November 2019 Update (18363) | |
May 2019 Update (18362) | |
October 2018 Update (17763) | |
April 2018 Update (17134) | |
Fall Creators Update (16299) | |
Creators Update (15063) |
Device form factor | Saw the problem? |
---|---|
Desktop | |
Xbox | |
Surface Hub | |
IoT |
Additional context
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Ember.js Route: How to avoid infinite loop when refreshing ...
To answer directly, there is no way to only refresh the parent route. You might, however, be able to just reload the model...
Read more >3 ways to cause an infinite loop in React - Alex Sidorenko
Set a function to onClick event. It is a proper way to set event handlers. This way state will only update after a...
Read more >IntelliJ IDEA 2023.1 (231.8109.175 build) Release Notes
Bug, IDEA-309755, Micronaut: if both parent and child beans exist, attempt to inject child beans as qualified dependency of parent type is reported...
Read more >https://np.edu/_resources/js/build/wy.bundle.js.map
n // for some reason Chrome can't handle source map in server-rendered\n ... {\n warn(\n 'You may have an infinite update loop '...
Read more >Untitled
Ori design studio, Sociology book in urdu pdf free download, Sabat orthodontics brecksville, Macross delta vf 31f, Bike hire mapua nz, Can a...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It seems that this is not an issue with the test infra, but rather the underlying framework/library that provides us with the
UIObject
objects. In the scenario described by @ejserna , the list of descendants seems to be infinite, at some point it keeps containing the same element over and over again. So the only efficient solution I can think of is save the previous element and break the for loop if the previous element is equal to the current item, does that sound reasonable as a workaround?@chingucoding I think that’s a good workaround, at least that’s what @alexhinz and I thought would make sense.