开发者

.net executable build on xp, does not start on windows 7 - werfault

i've made a .NET application on an Windows XP workstation and it works fine. But if i try to run it on Windows 7 the application does not start at all - no windows, no error messages, nothing visibile. I've tryed in every combination of compatibility mode in 7 but no one works. The only thing i can see in task manager is that when i start the application on windows 7 at the same time the werfault.exe process is started, then after a few seconds both disappears.

Is there a werfault.exe log file or something to check to understand what is hap开发者_Python百科pening?

Thanks


You may try looking at the Windows Event Log. It might contain information about the error. Also try running as administrator. You should also make sure that the correct .NET framework is installed on the Windows 7 machine.


Be patient, and learn from the experts, :)

http://blogs.msdn.com/b/tess/archive/2008/06/05/setting-net-breakpoints-in-windbg-for-applications-that-crash-on-startup.aspx

A lower level debugger such as WinDbg can help in most toughest times.

In your case, an unhandled exception occurred, and WinDbg + SOS can show you the exception details, if you run !pe.

Good luck.


The default project template for WinForms is missing a couple of try/catch blocks that it really should have to avoid these kinds of problems.

The form constructor is a simple

InitializeComponent();

Better to have a try/catch block around that throws up a messagebox showing the error.

The same for Main in Program.cs

I have occasionally had problems displaying a messagebox when erroring in these methods so I resort to displaying a console window:

[DllImport("kernel32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool AllocConsole();

Then call:

string msg = "Some explanation.";
AllocConsole();
Console.WriteLine(msg);
MessageBox.Show(msg);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜