question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Use PropertyGrid in WPF, the memory increased from 63M to 4.5G

See original GitHub issue
  • .NET Core Version: 5.0.202

  • Have you experienced this same bug with .NET Framework?: No

Problem description: when i am use propertygrid in wpf, if set the SelectedObject, the memory increase from 63M to 4.5G

The Xaml Like this

<Window x:Class="WpfApp1.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:WpfApp1"
        xmlns:local1="clr-namespace:WpfCustomControlLibrary1;assembly=WpfCustomControlLibrary1"
        xmlns:winForms="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"
        mc:Ignorable="d"
        Title="MainWindow" Height="450" Width="800" Loaded="Window_Loaded">
    <DockPanel>
        <ComboBox DockPanel.Dock="Top" ItemsSource="{Binding ObjectItems}" SelectedIndex="{Binding SelectedIndex}"/>
        <WindowsFormsHost>
            <winForms:PropertyGrid x:Name="propertyGrid" PropertySort="Categorized" Dock="Fill"/>
        </WindowsFormsHost>
    </DockPanel>
</Window>

The CS Code Like This:

public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            this.propertyGrid.SelectedObject = new System.Windows.Forms.Button();
        }
    }

Expected behavior:

Minimal repro:

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
dupeng0224commented, May 15, 2021

i have resolved this problem, Update the Visual Studio To 16.9.5, One Previous Version is 16.9.4,and anthor version is 16.8.2. i think this problem is because of roslyn。

0reactions
dupeng0224commented, May 14, 2021

显示器:24寸,屏幕分辨率:1920*1080

------------------ 原始邮件 ------------------ 发件人: @.>; 发送时间: 2021年5月14日(星期五) 上午8:32 收件人: @.>; 抄送: @.>; @.>; 主题: Re: [dotnet/wpf] Use PropertyGrid in WPF, the memory increased from 63M to 4.5G (#4504)

@dupeng0224 what is your screen resolution?

你的屏幕有多大呢?屏幕分辨率多少呢?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Running on .NET Core / .NET 5.0 exhibits huge memory ...
NET 5.0 exhibits huge memory leak when resizing, and uses alot more ... Use PropertyGrid in WPF, the memory increased from 63M to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found