C# MainWindow()构造函数(C WPF)结尾处System.Core.dll中的System.NullReferenceException

C# MainWindow()构造函数(C WPF)结尾处System.Core.dll中的System.NullReferenceException,c#,wpf,xaml,C#,Wpf,Xaml,我有一个C语言的简单窗口,其中包含一些元素。当我尝试运行它时,在System.Core.dll中会出现System.NullReferenceException。在调试过程中,在主窗口构造函数的末尾引发异常,括号位于该末尾 public MainWindow() { System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("de-DE");

我有一个C语言的简单窗口,其中包含一些元素。当我尝试运行它时,在System.Core.dll中会出现System.NullReferenceException。在调试过程中,在主窗口构造函数的末尾引发异常,括号位于该末尾

public MainWindow()
    {
        System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("de-DE");
        InitializeComponent();
        user = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
        handler = new DataHandlerPlants();
        tbTransponder.Focus();
        loadgrid(); //gets grid-Items from DB
        loadComboboxes(); //gets combobox-Items from DB
    } //Here is where the exception is raised

是什么原因造成的?

刚刚意识到问题:


我在GridView中添加了分组,但分组所依据的列不可用。

你能用方法的代码更新问题吗?@SebastianHofmann刚刚这么做了it@AleksAndreev我已经阅读了答案,但是这里没有合适的内容。如果没有足够的信息,请将完整的异常堆栈跟踪放在这里