System.ExecutionEngineException issue when loading a WPF window from Windows Form

I found a rather strange behavior ...

Here's how to replicate the problem:

  • Create a WPF application project.
  • Remove StartupUri from the App.xaml file.
  • Add a launch event handler to the application with the signature " private void Application_Startup(object sender, StartupEventArgs e)"
  • Now add a form to the project (right-click and select a new element).
  • in the Application_Startup method, create a form object and show it as Form1 f1 = new Form1(); f1.ShowDialog();
  • In real Form1, add a button to the constructor and add a click event handler to the button.
  • Add a new WPF window to your Window1 project.
  • In the Form1 event handler created in step 6, add lines of code to create the WPF window: Window1 w1 = new Window1(); w1.Show();
  • Run the project and click on the winform button to display the WPF window ... works fine so far.
    1. WPF winform. .

, , WPF, winform. winform WPF.

WPF . , , ! WPF, . , , ...

, http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/442782b1-00a1-4e2e-9cc6-ae99b6699126/, .

?

+5
1

Wpf ( "" VS ShutdownMode Application.Xaml) " ". , Wpf-, Wpf , .

, " " ( "OnExplicitShutdown" Xaml). Application.Current.Shutdown , , (, winforms ).

+10

All Articles