This error ocurr when I call System.Application.Run(); in a WPF application. There is no other call to method Run(). Someone did see this?
+2
A:
Why would you need to call Run() manually? The framework does it for you if you have an Application derived object usually defined in a file called App.xaml.
If you go in your obj
directory you'll find the auto generated file for the application object (file is called App.g.cs) and it has something similar to:
/// <summary>
/// App
/// </summary>
public partial class App : System.Windows.Application {
/// <summary>
/// InitializeComponent
/// </summary>
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
public void InitializeComponent() {
#line 4 "..\..\App.xaml"
this.StartupUri = new System.Uri("Window1.xaml", System.UriKind.Relative);
#line default
#line hidden
}
/// <summary>
/// Application Entry Point.
/// </summary>
[System.STAThreadAttribute()]
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
public static void Main() {
gridsh.App app = new gridsh.App();
app.InitializeComponent();
app.Run();
}
}
Notice it defines a static main which has the call to Run
.
Aviad P.
2010-01-06 16:30:57
Note that a way to be able to define your own `Main()` is to not define an App.xaml, and instead define `Main()` in App.cs, calling Application.Run() yourself.
Will Eddins
2010-01-06 19:03:26
A:
Hey,
No, if you didn't include another call to Run, maybe try deleting the file and recreating it...
Brian
2010-01-06 16:56:49