Can't get vb.net project to work on a different PC ... get unhandled exception error
Posted on 2004-10-29
I have a fairly simple VB.net project that works fine from the IDE. I created a deployment package and installed it on in a different directory on the same PC, and it works fine. However, when I take that deployment package, install it on a different PC, I get an unhandled exception error box immediately when trying to launch the program.
The creation of the install package and the installation itself seems to go fine with no error indications.
At one point, I could not even install the package on my own machine... after putting in an exception handler (as shown below) to try to capture the exception, I saw that I was getting a system.security.securityexception... I did research on that and went through doing the .net wizards things...giving the assembly full trust, and also opening up net security. At least I was able to get the package installed and working on one of my two local PC's outside of the .net IDE, so I figured I had made some progress.
Now, when I install the package on a second local PC, I no longer get the security exception, but just get the unhandled exception. The PC where I developed the application and where the install package worked fine is running Windows XP Professional. The second PC I have where the install seems to work but the program won't run is running Windows 2000. Both PC's are connected to the same network and the same database. I can get to the Oracle database with other applications just fine from both PC's. My VB6 applications work fine from both PC's.
When I try to run the program from my second PC, I get a box from the Common Language Runtime Debugging Services which states, "Application has generated an exception that could not be handled.... Process id = 0x958 (2392), Thread id=0x948(2376)" I'm pretty sure this happens before anything happens in my program.
Although I've done projects in VB6, I'm new to the .net environment... the exception handler I included was basically copied ... the project uses the Oracle.data.adapter to read a couple of tables. As I said, it works just fine from the IDE, and also from the exe I installed on the same machine as the IDE.
I'd appreciate any help in getting the deployment package to work, and/or at least to have the exception handler actually give me some information about what is going on. I thought .net was supposed to make deployment a lot easier than VB6????
Here is the initial code:
Public Class frmFTSearchMain
Dim intDataSelect, intSearchType As Integer
Dim intConj1, intConj2 As Integer
Dim sarnumber As String
Dim strPanelKey As String
Dim strPanelID As String
Dim strConj(2) As String ' array to hold conjunctions
Dim strSearch1, strSearch2, strSearch3 As String
Dim strORAdb As String
Dim cmdOracleCommand As New OracleCommand
Dim conOracleConnection As New OracleConnection
Dim tooltip1 As New ToolTip
Dim ItemCounter As Integer
Dim ipagecounter As Integer
Dim StringtoPrint As String
Dim strHeadingtoPrint As String
Dim currentDomain As AppDomain = AppDomain.CurrentDomain
#Region " Windows Form Designer generated code "
<<<<standard .net-generated code snipped out for brevity>>>>
Public Sub myhandler(ByVal sender As Object, ByVal args As UnhandledExceptionEventArgs)
Dim e As Exception = DirectCast(args.ExceptionObject, Exception)
Console.WriteLine("Myhandler caught : " + e.Message)
End Sub 'myunhandled exception error
Public Sub frmFTSearchMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
AddHandler currentDomain.UnhandledException, AddressOf myhandler
lblRegionID.Text = "(D900 Region)"
strORAdb = "data source = my.world ;" _
& " user ID = check ;" _
& " password = check ; "
conOracleConnection.ConnectionString = strORAdb
..... rest of program..... nothing really unusual...
Thanks in advance....