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
Infinite Measure/Arrange/Layout/Scroll loop possible with the treeview #21
Comments
Three pieces of information:
|
I've turned the virtualization back on but added a checkbox to turn it off. If scrolling hangs the viewer just uncheck the checkbox. |
We are encountering this issue. We have a large treeview, and with Virtualization we can follow a specific scrolling behavior and can consistently reproduce this issue. Are there any known workarounds (other than disabling virtualization)? And are there any updates on the status of this issue? |
If you can repro consistently, would you be able to follow the instructions above and record the trace and attach it here? I can then route to the WPF team. What version of .NET Framework are you using? |
Do I need to be using MSBuildStructuredLog to create the log? The project is on .NET Framework 4.6.1, but I tried the recently released 4.8 in hopes that it would be fixed; it was not. |
You could use your own program to reproduce and record a trace. Instructions from @SamBent: ========== We’ve fixed many issues in VirtualizingStackPanel since the one you’ve mentioned. Does your hang repro on latest .Net? If so, open a bug. The hangs, crashes, and incorrect scrolling bugs in VSP have the “feature” that same surface symptoms (hot codepath, callstack, scroll offset) can arise from different root causes. So just because your bug looks like one we’ve fixed doesn’t mean it’s the same. If you’ve stumbled on a new root cause, we’re very interested in fixing it. Recent versions of .Net have some built-in tracing for these kinds of problems. Add the highlighted line (and the surrounding tags if needed) to MyApp.exe.config, replacing “MyTreeView” by the name of the problematic control (assuming you’ve named it: ). Then run MyApp.exe so as to repro the problem. Afterwards there will be a file named ScrollTrace.stf (or similar) in your app folder. Attach it to the bug (or send it to me).
BTW, “01038” isn’t a useful version number. Use this page to determine which version of .Net is on your machine. |
I found a relatively simple repro:
|
Personal notes: C:\Users\Kirill\AppData\Local\SourceServer\VSTFDEVDIV_DEVDIV2\DevDiv\FX\Rel\Net48Rel1Last_B\wpf\src\Framework\System\Windows\Controls\VirtualizingStackPanel.cs\1745372\VirtualizingStackPanel.cs |
http://.../DevDiv2/DevDiv/_versionControl/changeset/1728280 |
@KirillOsenkov - All the known hangs in TreeView are fixed as of the latest .NET updates, applying to .NET 4.7.x and .NET 4.8 and deployed in July or August 2020 (depending on your OS and your Windows Update settings). So if you have those updates and you still need to uncheck the box, it's an "unknown" hang and you should report it to https://github.com/dotnet/wpf/issues and send me the crash dump and .stf files as described earlier. |
@SamBent thanks Sam, I saw you've fixed another one of these in April I think. I myself have been dogfooding with virtualization and haven't seen it since. So maybe the customer who reported it doesn't have the latest framework update. I'll keep an eye out for more of these issues. I admire your perseverance in fixing these and it is much appreciated. I know how insanely difficult this area is. Thanks so much for your efforts here! |
@SamBent I have the latest Windows updates, .NET Framework 4.8 (528372 in the registry). How can I know I have the fix from July or August 2020 you're mentioning? |
@jairbubbles Go to Settings -> Update & Security -> Windows Update -> View Update History. Look for a "Quality Update" entry of the form "2020-10 Cumulative Update for .NET Framework 3.5 and 4.8 for Windows 20H2 for X64 (KB4578968)" - you should see several of these with different dates, OS, KB numbers. If you have one dated 2020-08 or later, you should have the fix. If in doubt, follow an update link to the description page. The left column of this page has links to previous updates for your OS. Look in these to find the update where the fix first appeared. This depends on your OS; for example on my machine I tracked back to "July 31, 2020 — KB4562899 Cumulative Update Preview for .NET Framework 3.5, 4.8 for Windows 10 Version 2004 and Windows Server, version 2004" (here), which lists a WPF fix:
These updates are cumulative - if you have one issued any time after the fix, you have the fix. |
@SamBent I couldn't find a KB corresponding exactly, only security related KB (last one from 16/10/2020) Please also note that I still have the issue if I uncheck the box "Enable tree virtualization" but it's still an infinite loop in a VirtualizingStackPanel. Maybe it' just a different situation. |
Have you confirmed it's an infinite loop? Maybe it's just a very long list being laid out? How long have you waited? |
Like many many minutes and there is still the |
Would you be able to obtain a scroll trace as per Sam’s instructions in this issue? |
@KirillOsenkov This was indeed on the "results" tree, to get the trace I added: <appSettings>
<add key="ScrollingTraceTarget" value="resultsList" />
</appSettings> Here is the scroll trace: freeze.zip |
@SamBent FYI we have a trace above |
@jairbubbles The zip contains only the build log "freeze.binlog". We need "ScrollTrace.stf" and the corresponding .dmp file. Plus a description of what you did while viewing "freeze.binlog" that led to the hang. |
@SamBent My bad, I uploaded th wrong zip... Here is the good one: ScrollTrace.zip The repro steps are detailed on the other issue: #407 |
The .stf trace doesn't match your repro steps. I don't any evidence of "select the last item" or "press Down key"; these wouldn't show up directly in the trace, but it looks like they wouldn't work anyway - the loop is already in effect. What I see in the trace is three MouseWheelDown commands. The first two scroll the treeview down by 96 pixels, leaving it not quite at the end - there's 2.4 more pixels still left to reveal. The third asks to scroll down by 48 pixels, but we scroll by only 2.4. There's then a check to see if we've scrolled the right amount; the naive answer is "no" because 48 != 2.4, but it's then supposed to recognize that 2.4 put us at the end, which is OK. This didn't work for some reason, and we retry the scroll - but nothing has really changed, so this loops. The reason @KirillOsenkov and I cannot repro the hang is probably because it's very sensitive to the exact height of your window relative to the data. For example when I view your freeze.binlog, two MouseWheelDowns don't get me near the end - it takes 4 or 5 and even then I still don't end up so close to the end. But the data in the trace is often enough to piece together a repro, by cooking the window height and element height to match yours, and presumably run into the same floating-point rounding issue (which is what I'm guessing is the root cause). |
@SamBent You're right I can reproduce by only scrolling with the mouse wheel in the results tree! (But it also works with the down arrow If I do scroll before at the bottom with the scrollbar.) I I snoop I can see that the tree view dimensions are: |
@jairbubbles thanks for diving so deep to investigate! Can you upload your PresentationFramework.dll? You can use Debug -> Windows -> Modules when you break in VS to get the path it’s being loaded from. This way we’ll know which exact build of WPF you’re running and whether you have all the latest fixes. |
@KirillOsenkov Assembly file version is |
By the way, do you plan to redistribute the application as a .NET Core / .NET 5 (self-contained) app in a near-future? |
I want to, but it needs time and I’m very busy these days. It’ll be easier if you upload the actual binary, I need the MVID and the Pdb Guid and age to look up the Pdb and matching source. Unfortunately the dll isn’t stamped with a commit. |
Or if you want you can run the Pdb tool yourself and tell me what the Pdb guid is: https://github.com/KirillOsenkov/MetadataTools |
Here you go:
|
Please also note @KirillOsenkov that I compiled the application as .NET Core app and I can't reproduce the issue. That might indeed indicates that the fix is not yet on .NET Framework. (BTW I pushed a draft MR #411, compiling to .NET Core is pretty straight forward but I guess all the work will be on the CI side) |
Interesting, my .dll version is
This makes me think that you don't have the latest version. Unfortunately I wasn't able to track down symbols for your build, so I can't definitively pinpoint the source code it was built from. Not sure why the symbols from your drop aren't published. Thanks for the .NET Core PR. If you undraft it I'll take it. |
Have same issues (PresentationFramework.dll version is also |
4.8.4220.0 is the 2020-08 update - it has the latest fixes. 4270 is a later update, containing nothing new that's relevant here. The latest hang (from #407) apparently has a different root cause from the ones reported here (#21). From my POV, they are different bugs, although I understand that they are both hangs and thus look the same to users. To avoid confusion, I recommend continuing the discussion at #407. (Which I'm about to do...) |
I'll close this bug as it has been fixed in WPF. We have another one #407 where we have a fix that should hopefully be released via Windows Update soonish. |
Since the big treeview is virtualized and variable height (due to the yellow breadcrumb panel at the bottom), it is a recipe for disaster - we can fall into an infinite layout loop in WPF (which is a known problem: https://connect.microsoft.com/VisualStudio/feedback/details/969547/infinite-measure-and-arrange-loop-with-virtualizingstackpanel)
Look into making sure that the treeview height doesn't dance when the selection changes (somehow calm down the layout storm caused by the breadcrumb panel vertical resize).
The text was updated successfully, but these errors were encountered: