It stuck at the the following code:
public partial class MainWindow : Window
{
public static MainWindow? Current { get; private set; }
public MainWindowViewModel ViewModel { get; private set; }
public MainWindow()
{
InitializeComponent(); //The Exception throw at this line
ViewModel = new MainWindowViewModel(this);
DataContext = ViewModel;
Current = this;
Width = SystemProfile.MainWindowWidth;
Height = SystemProfile.MainWindowHeight;
}
}
The following is the exception message:
System.Windows.Markup.XamlParseException
HResult=0x80131501
Message=“在“System.Windows.StaticResourceExtension”上提供值时引发了异常。”,行号为“31”,行位置为“52”。
Source=PresentationFramework
StackTrace:
在 System.Windows.Markup.XamlReader.RewrapException(Exception e, IXamlLineInfo lineInfo, Uri baseUri)
在 System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)
在 System.Windows.Markup.WpfXamlLoader.LoadBaml(XamlReader xamlReader, Boolean skipJournaledProperties, Object rootObject, XamlAccessLevel accessLevel, Uri baseUri)
在 System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream)
在 System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
在 XFEToolBox.Views.Windows.MainWindow.InitializeComponent() 在 C:\Users\XFEstudio\Desktop\work\C#\GitHub\XFEstudio\XFEToolBox\XFEToolBox\Views\Windows\MainWindow.xaml 中: 第 1 行
此异常最初是在此调用堆栈中引发的:
[外部代码]
内部异常 1:
IndexOutOfRangeException: Index was outside the bounds of the array.
And I believe that i did nothing before and after I upgrade my Visual Studio.
Thanks for your reading.