You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Dotnet 8 renders the controls in the Windows automation tree differently compared to earlier dotnet versions.
Buttons in an itemscontrol can't be found anymore, breaking the existing automation.
Using the "Accessabilitiy Insights for Windows" shows a different graph compared to dotnet 6/7 (see below)
With <TargetFramework>net7.0-windows</TargetFramework> , the automation tree looks like
pane "Desktop 1"
window "MainWindow"
title bar ''
button "TopButton"
button "ItemButton1"
Actual behavior
With <TargetFramework>net8.0-windows</TargetFramework>, the automation tree looks like
pane "Desktop 1"
window "MainWindow"
title bar ''
button "TopButton"
list view #note that here was the "ItemButton1" - now it is not present anymore!
Regression?
Yes
Known Workarounds
No response
Impact
The UI Tests for our applications breaks; need workarounds
Configuration
Microsoft.WindowsDesktop.App 8.0.1
Microsoft.NETCore.App 8.0.1
windows 10.19045.3803
x64
Vs2022
Other information
No response
Reacted by lindexi, Marius Bughiu, Lukas Volf and andreeadumitru
I do not think you can expect automation trees to stay intact between major version upgrades - I would consider it business-as-usual these getting broken on major upgrade.
@psmulovics In this case the WPF controls change type and are not usable anymore, I edited and tried to emphasize this by a small comment. It is not only a tree re-ordering issue, but elements that were clickable can not be found anymore! Ofc, any suggested workarounds are welcome! We have paused dotnet8 migration due to this, the automation tech is central to our development.
This seems to fix the issue and restore the original pre-NET8 behavior. To test it, I used the following piece of code in the test app from this bug report:
Good work guys - but be sure to test this with the ms app "Accessibilities for Windows" to make sure it looks the same.
It shows larger differences than what I see from your inspection using the TreeWalker-code above!
@Tobiidave - Could you please take a look at this comment, where the same scenario is explained in detail? Please let us know if it isn't working for you.
@Tobiidave
It is too late to do it in the App ctor. And thanks for creating this issue. It helped me to figure out the workaround. We also have a problem with dataitems. It is random, but all or few might be empty sometimes in ItemsControls with item template.
Use this one in the startup WPF project:
Just checking in - any updates on this issue? We've been hearing from a few customers at DevExpress who are running into problems because of this breaking change
This problem seems to be the reason why you can't always reliably obtain info about controls in Autodesk Revit v2026 (which is built using .NET 8) for doing UI automation testing.
I saw the following problem:
You open Autodeskt Revit 2026 and open last project (.rvt file)
You query UIA for its controls
You see all controls
You switch its Ribbon to a different tab
You query UIA for its controls
You don't see controls of the active tab
You go to Inspect.exe or Accessibility Insights for Windows, you see that controls in second tab are not available via UIA/MSAA
Your actual expectation is to see them.
Then, at some point, I've got those controls to appear (absolutely randomly).
At some point I thought it's because Autodesk Rebvit's team decided to avoid supporting UI automation. But then why some controls would be there, and some not?
But now, with this bug, and bugs #8800 and #8715 it is clear that this is a WPF on .NET 8 platform bug, not Autodesk Revit's bug.
My question is, are there any plans to fix this for .NET 8 and up?
@danielkornev Given the slow pace on the official side, I've started working on a community release that may include a fix for this. However, this is purely a spare-time effort for me, so development is progressing rather slowly.
Activity
lindexi commentedon Jan 12, 2024
@Tobiidave Maybe this behavior be changed by #6862
I'm not sure.
Tobiidave commentedon Jan 12, 2024
I don't know how the 6862 affected this. But the problem exists in both 8.0.0 and 8.0.1
psmulovics commentedon Jan 12, 2024
I do not think you can expect automation trees to stay intact between major version upgrades - I would consider it business-as-usual these getting broken on major upgrade.
Tobiidave commentedon Jan 15, 2024
@psmulovics In this case the WPF controls change type and are not usable anymore, I edited and tried to emphasize this by a small comment. It is not only a tree re-ordering issue, but elements that were clickable can not be found anymore! Ofc, any suggested workarounds are welcome! We have paused dotnet8 migration due to this, the automation tech is central to our development.
lindexi commentedon Jan 19, 2024
@Tobiidave Sorry hear that. I still haven't found the exact change code for this issues.
jimm98y commentedon Jan 20, 2024
I've created a test app and I've tried to restore the original behavior simply by setting this in OnStartup:
Unfortunately, it looks like it's too late and the value is already set and cached. So I had to use reflection instead:
This seems to fix the issue and restore the original pre-NET8 behavior. To test it, I used the following piece of code in the test app from this bug report:
NET8 before the fix:
NET8 after the fix:
NET6 behavior:
Kuldeep-MS commentedon Jan 23, 2024
I am investigating the issue from my end.
Tobiidave commentedon Jan 23, 2024
Good work guys - but be sure to test this with the ms app "Accessibilities for Windows" to make sure it looks the same.
It shows larger differences than what I see from your inspection using the TreeWalker-code above!
walterlv commentedon Jan 30, 2024
I've tested this code below to set the
AppContextswitch and find it worked.This means that if it is late on startup, it can be set before the WPF initialization which reflection is not needed. @jimm98y
Tobiidave commentedon Aug 20, 2024
Hi. So now when .Net7 is out of support and this issue is blocking from moving to .Net8, what do think we should do with our app and +1000 customers?
lindexi commentedon Aug 21, 2024
@Tobiidave Sorry, I do not think the PR can enter .NET 9
Tobiidave commentedon Aug 21, 2024
So how would we handle these changes in the windows automation tree?
Kuldeep-MS commentedon Aug 21, 2024
@Tobiidave - Could you please take a look at this comment, where the same scenario is explained in detail? Please let us know if it isn't working for you.
Tobiidave commentedon Aug 23, 2024
Hi - I took the test project attached to this thread, added
But the automation tree did not change.
syromiatnikov commentedon Feb 6, 2025
@Tobiidave
It is too late to do it in the App ctor. And thanks for creating this issue. It helped me to figure out the workaround. We also have a problem with dataitems. It is random, but all or few might be empty sometimes in ItemsControls with item template.
Use this one in the startup WPF project:
AlexGoOn commentedon Apr 30, 2025
Just checking in - any updates on this issue? We've been hearing from a few customers at DevExpress who are running into problems because of this breaking change
danielkornev commentedon Jul 15, 2026
This problem seems to be the reason why you can't always reliably obtain info about controls in Autodesk Revit v2026 (which is built using .NET 8) for doing UI automation testing.
I saw the following problem:
Your actual expectation is to see them.
Then, at some point, I've got those controls to appear (absolutely randomly).
At some point I thought it's because Autodesk Rebvit's team decided to avoid supporting UI automation. But then why some controls would be there, and some not?
But now, with this bug, and bugs #8800 and #8715 it is clear that this is a WPF on .NET 8 platform bug, not Autodesk Revit's bug.
My question is, are there any plans to fix this for .NET 8 and up?
lindexi commentedon Jul 16, 2026
@danielkornev Given the slow pace on the official side, I've started working on a community release that may include a fix for this. However, this is purely a spare-time effort for me, so development is progressing rather slowly.
See https://github.com/WpfLab/WpfRuntime
danielkornev commentedon Jul 16, 2026
My current experiment is to try to reconstruct UI Automation tree from WPF visual tree...