Vanilla WPF application freezes on one client machine

At the client, one of our WPF applications began to freeze. When trying to reproduce the problem with a minimal working example, I found that even the most basic (non-trivial) WPF application will hang on this machine.

Example A Create a new C # WPF project in Visual Studio 2008. Change nothing, compile it and run it on the client machine. He will work.

Example B : take example A and add a TextBlock to the main form of Window1 :

 <Window ...> <Grid> <TextBlock>Test</TextBlock> </Grid> </Window> 

Compile the application and run it on the client machine. It will freeze: the title bar and the border of the window are visible, the inside is transparent, and the window does not react to anything (you cannot move or close it). The application must be disabled using the task manager.

Obviously, this client WPF is corrupted. Is this a known problem, that is, has anyone encountered it before and already knows how to solve it (for example, reinstall .net 3.5 SP1, etc.)?

W7SP1 development machine, XP client machine (probably SP3, not tested).

+6
source share
2 answers

Check out Tom Dudfield's instructions to clear the WPF font cache . It worked for me for several users.

+5
source

In addition, I recently had this experience in a more complex example.

spinning:

I tried clearing the font cache and it did nothing for my hanging application, but YMMV. Nevertheless, it seems harmless.

I also tried NGEN'ing the entire framework, but this did not solve the problem.

DECISION:

In my MVVM application, I have an ItemsControl element (general, not a real ListBox) on a complex control that has been removed from a tab. The ItemsControl element represented about 14 rows of data consisting of user controls tied to a small collection that itself was surrounded by a ScrollViewer. With ScrollViewer, the selected computers will tremble and get stuck endlessly. Commenting on Xaml, the application looked completely normal, which largely eliminated problems in the backup ViewModel.

Removing the surrounding ScrollViewer fixed the problem, and in any case, it was not really necessary. I suspect that the real problem is hiding in some style, but to be honest, there was no time or patience to investigate further ...

Fragment

 <!--<ScrollViewer ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.CanContentScroll="True" Grid.Row="7" --> <ItemsControl Grid.Row="7" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Name="FileSettingsList" ItemsSource="{Binding MigratorFiles.FilesCollection}" BorderThickness="2" HorizontalContentAlignment="Left" Template="{StaticResource FileNameSettingsItemsControlTemplate}" ItemsPanel="{StaticResource FileNameSettingsItemsPanelTemplate}" ItemTemplate="{StaticResource FileNameSettingsItemDataTemplate}" > </ItemsControl> <!-- /ScrollViewer --> 
0
source

Source: https://habr.com/ru/post/887609/


All Articles