HandyControl
HandyControl copied to clipboard
hc:Window 窗体在构造函数或 Loaded 函数中调用 this.Close(); 会导致报错
Describe the bug
hc:Window 窗体在构造函数或 Loaded 函数中调用 this.Close(); 会导致报错 System.NullReferenceException:“Object reference not set to an instance of an object.”
Steps to reproduce the bug
var window = new Window1();
window.ShowDialog();
public partial class Window1
{
public Window1()
{
InitializeComponent();
this.Loaded += Window1_Loaded;
}
private void Window1_Loaded(object sender, RoutedEventArgs e)
{
this.Close();
}
}
Expected behavior
No response
Screenshots
No response
NuGet package version
None
IDE
Visual Studio 2022
Framework type
.Net 6.0
Windows version
No response
Additional context
No response