unhandled exception after deployment

G

Guest

I recently wrote my first Vb.net application, or at least my first complex app since moving up from vb6. When run from the VS.NET IDE, the program shows no errors and runs fine. When the output exe is run(this is a windows application) on my development pc, the exe runs fine as well. When the application is deployed on any other machine with .net framework 1.1, it generates an unhandled exception prioir to loading anything.
The setup project seems to be including all the proper dependencies and I have tried both debug and release configurations. I am running the exe from a local drive, so I do not think it is a security exception. What is causing this exception?
 
G

Greg Burns

Hmmm...

Try using the code below to start your app. Maybe it will give you an idea
of what is going wrong.

Greg


Option Strict On

Imports System.Security

Module Module1

'The main entry point for the application.
<STAThread()> Public Sub Main()

Try
'Demand full trust permissions
Dim fullTrust As New
PermissionSet(Permissions.PermissionState.Unrestricted)
fullTrust.Demand()

SubMain()
Catch ex As SecurityException
' Report that permissions were not full trust
MessageBox.Show("This application requires full-trust security
permissions to execute.")

Catch ex As Exception
HandleUnhandledException(ex)
End Try

End Sub


Private Sub SubMain()

' // Setup unhandled exception handlers
AddHandler AppDomain.CurrentDomain.UnhandledException, AddressOf
OnUnhandledException

AddHandler Application.ThreadException, AddressOf
OnGuiUnhandedException

Application.Run(New Main)

End Sub

'// CLR unhandled exception
Private Sub OnUnhandledException(ByVal sender As Object, ByVal e As
UnhandledExceptionEventArgs)
HandleUnhandledException(e.ExceptionObject)
End Sub

' // Windows Forms unhandled exception
Private Sub OnGuiUnhandedException(ByVal sender As Object, ByVal e As
System.Threading.ThreadExceptionEventArgs)
HandleUnhandledException(e.Exception)
End Sub


Private Sub HandleUnhandledException(ByVal o As Object)
Dim e As Exception = CType(o, Exception)

MessageBox.Show("An unhandled exception occurred and the application
is shutting down.")
MessageBox.Show(e.ToString)

Environment.Exit(1) ' // Shutting down

End Sub


End Module
 
C

Cor Ligthert

Hi Dave,

One of the improvements of AdoNet is that it should not give this always
been anoying errors.

Therefore most regulars in this newsgroup use ADONET and when there comes a
question from someone who has problems with Ado in deployment, because he
persist in using that, I hope you understand it.

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top