1

After successfuly running an application written with Visual Basic 2008 Express Edition on an XPSP3 host, I copied the EXE file to a fresh Windows 7 host... And it crashed with not much information:

Description: Stopped working

Problem signature:

Problem Event Name: CLR20r3

Problem Signature 01: myapp.exe

Problem Signature 02: 1.0.0.0

Problem Signature 03: 4eb2a385

Problem Signature 04: myapp

Problem Signature 05: 1.0.0.0

Problem Signature 06: 4eb2a385

Problem Signature 07: f

Problem Signature 08: c6

Problem Signature 09: System.InvalidOperationException

OS Version: 6.1.7600.2.0.0.256.1

Locale ID: 1033

What steps can I take to investigate why a VB.NET application doesn't run on a different host?


It was due to a missing dependency. To catch this type of error, add the following to Form1:

Public Sub New()
    AddHandler Application.ThreadException, AddressOf OnThreadException
    AddHandler AppDomain.CurrentDomain.UnhandledException, AddressOf UnhandledExceptionEventRaised

    InitializeComponent()
End Sub

Private Sub UnhandledExceptionEventRaised(ByVal sender As Object, ByVal e As UnhandledExceptionEventArgs)
    If e.IsTerminating Then
        Dim o As Object = e.ExceptionObject
        MessageBox.Show(o.ToString) ' use EventLog instead
    End If
End Sub

Private Sub OnThreadException(ByVal sender As Object, _
                   ByVal e As ThreadExceptionEventArgs)
    ' This is where you handle the exception
    MessageBox.Show(e.Exception.Message)
End Sub
Community
  • 1
  • 1
Gulbahar
  • 5,343
  • 20
  • 70
  • 93
  • Did you deploy the .PDB with the executable? – George Johnston Nov 03 '11 at 14:38
  • My first step would be to make sure the framework used to create the app is supported on the new host (e.g. do you require .NET 4, but the host only has 2.0?) – Widor Nov 03 '11 at 14:38
  • Thanks for the tips. I added the PDB file, and the Windows7 has .Net 4 installed, but I'm getting the same error. – Gulbahar Nov 03 '11 at 14:46
  • According to ILSpy (http://wiki.sharpdevelop.net), it requires .Net framework 2.0... which Windows7 says is already installed when I run dotnetfx.exe – Gulbahar Nov 03 '11 at 14:54
  • possible duplicate of [Deciphering the .NET clr20r3 exception parameters P1..P10](http://stackoverflow.com/questions/4052770/deciphering-the-net-clr20r3-exception-parameters-p1-p10) – Hans Passant Nov 04 '11 at 13:11

1 Answers1

1

Since you are using the Express Edition, you can't use remote debugging. Wrap sensitive code with Try...Catch, and write exceptions to logs or to the Event Viewer.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
MichaelS
  • 7,023
  • 10
  • 51
  • 75
  • Thanks for the help. After adding another routine to handle the AppDomain.CurrentDomain.UnhandledException, it showed that I was missing Microsoft.VisualBasic.PowerPacks.Vs 9.0.0.0. I'll read up about how to check for dependencies and how to distribute them. – Gulbahar Nov 04 '11 at 10:34
  • 1
    Indeed, simply copying Microsoft.VisualBasic.PowerPacks.Vs.dll in the same directory where the application is located solved the problem. Newbie learned something important today :-) – Gulbahar Nov 04 '11 at 11:40
  • @user148523: Great! You should post your own answer and mark it as the correct answer. Thanks for the upvote. – MichaelS Nov 04 '11 at 12:50