ExecutionEngineException when launching new windows in WPF C#
I am currently developing a piece of software in C# WPF. When I launch a window from my software it works fine in one area of the code, but when called in a different section of code it throws the ExecutionEngineException. I have tried putting a try catch statement around but it isn't going into the catch to display an error.
Below is the code where the window is being opened.
private void requestPassword()
{
MessageBoxResult result = MessageBox.Show("It looks like this is the first time you have used Boardies Password Manager."
+ "\n\nWould you like to enable a password in order to protect your data?\n\nThis password would need to be entered "
+ "each time you run the software, this ensures others can't access your personal information", "Enable Password",
MessageBoxButton.YesNo, MessageBoxImage.Question);
if (result == MessageBoxResult.Yes)
{
new RequestPassword().Show();
}
else
{
new MainScreen().Show();
}
}
Either lines inside the if and else display the error for both windows being opened. It is displaying the error on the line o开发者_如何学JAVAf the code when it goes to launch the new window and it calls the InitialiseComponent() method.
Thanks for any help you can provide
I've found the problem, it was because I was calling of a window first, then calling the class, when I switched it the other way round it worked fine.
精彩评论