tags:

views:

25

answers:

2

Trying to deploy an application written in VB.NET. First had an issue with not including the PowerPacks (what is in this anyway?) but that went away and the application installed correctly once I included it as a prerequisite.

Now however once the user logs into the application the main menu just bombs, doesn't even load, the app just quits. I suspected it was the DataGridView and had those suspicions confirmed when I changed the application's startup form to one without the grid.

Any ideas as to why this is happening? Is there some prerequisite or reference I'm missing?

Thanks in advance.

+2  A: 

Are you sure that the user has the .NET Framework 4.0 installed? Chances are, unless you target the framework installed, a WinForms app would crash if the machine doesn't have the target framework.

AJ
I have .NET Framework 3.5 SP1 selected as the prerequisite which VS 2010 selected for me. Are you saying that this control requires .NET Framework 4.0?
Tom
It would appear so, yes, since the DataGridView version is coming up as 4.0.0.0. You're setting 3.5 SP1 is the prerequisite in your Setup project? In the actual WinForm project, what framework version are you targeting?
AJ
The target framework is .NET 3.5. Should I change that to 4.0, rebuild and see what happens?
Tom
You should change it to whatever the highest version of the framework is on the user's workstation. If they don't have 4.0, but do have 3.5, and you're targeting 3.5, then there's something else going on. Do you have any way of checking what framework(s) the user has?
AJ
Sure, I can just hop on their machine. How do I see what version they have, through add/remove programs? I notice on my machine I have 4.0.
Tom
Add/remove programs is probably the simplest way. Otherwise, if all else fails, look at c:\windows\Microsoft.Net\Framework and see which version folders reside there.
AJ
The latest version this user has is v4.0.30319, same as my computer.
Tom
Go to c:\windows\assembly on both your machine and the user's machine and check the version of System.Windows.Forms.
AJ
We both have versions 1.0.500 and 2.0.0.0.
Tom
It's not the datagridview control, I took it off the main form and it still bombs. Also, another form with the datagrid runs fine.
Tom
Hmm. Then I would do what @Hans Passant suggests and track it down that way.
AJ
+3  A: 

Don't guess at this. Write an event handler for AppDomain.Current.UnhandledException and display the value of e.ExceptionObject.ToString().

In a VB.NET windows forms application:

Partial Friend Class MyApplication
    Private Sub MyApplication_UnhandledException(ByVal sender As Object, ByVal e As Microsoft.VisualBasic.ApplicationServices.UnhandledExceptionEventArgs) Handles Me.UnhandledException
        MessageBox.Show(e.Exception.ToString())
    End Sub
End Class
Hans Passant
Ok, I didn't have any error handling in my MyApplication_UnhandledException event and putting some in there reveals the error to be "Collection was modified; enumeration operation may not execute" which is even more puzzling as I can't see why that error would only trigger when the app is deployed and not in the IDE.
Tom
Be sure to look at the exception's StackTrace property, it tells you where the bug is located.
Hans Passant
Where can I access this property. I don't see it under Microsoft.VisualBasic.ApplicationServices.UnhandledExceptionEventArgs. Sorry, I'm kind of new with vb.net.
Tom
UnhandledExceptionEventArgs.Exception.StackTrace
Hans Passant
The only property I see for ...EventArgs is Empty. This probably deserves it's own thread now but off hand can you think of any reason why I'm getting that error when the application is deployed but not when running it in the IDE?
Tom
I updated my post with a code sample. It bombs because the machine on which you run is not quite the same as the machine on which you debug. It could be that you're modifying a collection that has only one item in it. Or it can be a threading bug. There's no way to really guess until we/you see that stack trace.
Hans Passant
Ok, I think I'm officially out of my league here. Here's the stack trace: http://img405.imageshack.us/img405/1285/stacktrace.jpg
Tom
I'm officially out of my league too, I have no idea what your form looks like to produce a stack trace like that. Bombs when it gets closed, that's all I know. e.Exception.InnerException could be next. Quacks like threading bug and a dire need to get a debugger on that machine. Well, you know 300% more about the problem. Good luck!
Hans Passant
I'm going to mark this as answered and start a new thread for the other problem, thanks Hans.
Tom