开发者

Launching my deployed my app gets "has stopped working" error. How do I debug this?

I deployed a VB.Net app and ran it and I get 'AppName has stopped working" "Windows is checking for a solution to the problem" along with a Cancel button under Windows 7. Under XP I am only getting the option to Se开发者_如何学编程nd the error report to Microsoft or not.

There is no apparent way to hook into a debugger. I am not getting any exception data. I have put msgboxes at the very start of my code and they are not hit so it is failing before any of my code is even executing. I have checked all dependencies that I can think of.

I developed the app on VS2008 Windows 7 and deploying to Windows 7 and WinXP.

I need some advice - how do I debug this?


The easiest way to debug this issue is to use Windbg if you are aware and there is Tess blog to figure out this.

On Windows 7 it is much easier to debug because stack walk capability using ETW. And here is how you can use in Managed code


Ok, here is what I did.

I disabled Enable Application Framework in the Application tab of Project Properties. Using this makes things easier, but much less transparent. I will never use that crutch again!

By using your own Sub Main you can actually see and respond to errors that happen when your form is loading like:

Public MainForm As frmSettings

Public Sub Main()

    Try
        MainForm = New frmSettings
    Catch ex As Exception
        Log.WriteToProgressLog("Error new form: " & ex.Message)
    End Try

    Try
        MainForm.Show()
    Catch ex As Exception
        Log.WriteToProgressLog("Error Showing Form: " & ex.Message)
    End Try

    Try
        Application.Run(MainForm)
    Catch ex As Exception
        Log.WriteToProgressLog("Error Running App: " & ex.Message)
    End Try

End Sub

And you can see the form globally using this. Yeah I know, purists will complain, but my philosophy is: I have zero tolerance for zero tolerance policies. I have even been known to use a goto if it made the code more efficient and easier to read. Anyhoo...

After changing this I was getting an error instantiating the form. Turns out Microsoft.VisualBasic.PowerPacks.Vs.dll component (I have a single line control on my form which needs this apparently) is not part of the .Net 3.5 distribution so you have to include it with your app. What's up with that? And it is not set to copy local by default. WT...? I assumed incorrectly that I only needed to include external dependencies. So much for .Net XCopy installations!

  • Brad
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜