Solved

Can't get vb.net project to work on a different PC ... get unhandled exception error

Posted on 2004-10-29
1,437 Views
Last Modified: 2008-01-09
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:

***************

Imports System.Data
Imports System.IO
Imports System.Drawing.Printing
Imports Oracle.DataAccess.Client

Public Class frmFTSearchMain
    Inherits System.Windows.Forms.Form
    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>>>>

#End Region

    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....

0
Question by:jrcooperjr
    20 Comments
     
    LVL 4

    Expert Comment

    by:andrewharris
    Is the Oracle Client installed on the new PC? Even though your installer has packaged the Oracle .Net assemblies, these still require the Oracle client installed.

    If this doesnt work, then can you do some debugging to file to see at what point the exception is raised?

    Andrew
    0
     
    LVL 44

    Expert Comment

    by:Arthur_Wood
    need to see EXACTLY what error message is being generated, not your recollection of the error message.

    AW
    0
     
    LVL 12

    Expert Comment

    by:farsight
    If you continue to have major problems, try deploying just a trivial "Hello World" application.
    Assuming that works OK, keep adding components/code a bit at a time, and redeploy.
    When it stops deploying successfully, you know what's causing the problem.

    (Without further info, I also suspect a problem with the Oracle stuff -- either the client or the .Net assemblies.)

    --- --- ---

    BTW, you've set up your global exception handler for WinForms wrong.  It's set up in Form_Load, which is too late.
    Set up your application to start at Sub Main, and use the technique/code shown in this article

    Global Error Handlers
    http://www.dotnet2themax.com/ShowContent.aspx?ID=8983e102-2ff7-4ac1-9620-386b166a91d8

    --- snip --- the most important part of the code from the article ---
    Sub Main()
       ' setup the global error handler
       AddHandler Application.ThreadException, AddressOf UnhandledExceptionProc
       ' display the main form
       Application.Run(New Form1)
    End Sub
    --- snip ---

    (NOTE: Global error handlers are set up differently for WinForms, Console applications, and ASP.NET applications.)
    0
     
    LVL 1

    Author Comment

    by:jrcooperjr
    Thanks everyone for the comments...

     I have determined conclusively that the problem indeed has to do with the Oracle connection...  however, what is missing?  Any suggestions as to what I should be looking at?

    Both machines have the same Oracle Client (Oracle Client 8.1.6) installed... Both machines are able to run other applications that connect to the same Oracle database (e.g, other VB6 applications I've created and TOAD)...  Both also have the .netFramework 1.1 installed (without .netframework 1.0).... again the machine on which the application runs without problem is running Windows XP Professional and is the machine on which Visual Studio.net is installed.  The other machine, which gives an immediate unhandled exception message, is running Windows 2000.  (Both machines are completely up-to-date with respect to Microsoft-supplied patches and service packs for their respective OS.)

    I took the advice from farsight above and set up a trivial application.. (see the code below)... with the Oracle-related dim statements commented out, the application would deploy with no problem on both machines.  However, as soon as I would uncomment either one or both of the Oracle-related dim statements, it would continue to run fine on the XP machine hosting the IDE where it was created, but it would immediately blow out on the other machine.  (I would create a release deployment package, put the package out on a network drive, and use the same package on the network drive to install on each of the local machines, so I am sure that there was no difference introduced due to different deployment packages.)

    Here is the code:
    ***************************************
    Imports System.Threading
    Imports Oracle.DataAccess.Client

    Public Class Form1
        Inherits System.Windows.Forms.Form
      ''''''if both of the following dim statements are commented out, this program will deploy successfully on both machines
      '''''' if either one or both of the following dim statements are uncommented, this program will run
      '''''' only on the machine where it was created with Visual Studio... it will bomb out on the other machine
        '''''  Dim cmdOracleCommand As New OracleCommand
        '''''  Dim conOracleConnection As New OracleConnection

    #Region " Windows Form Designer generated code "
        <<<< contains automatically generated code, snipped for brevity>>>>>>
    #End Region

    ''<<<<< code attempting to add error handling was inserted here... see below>>>>>

        Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
            Me.Close()
        End Sub
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            TextBox1.Text = "This is text filling "
        End Sub
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            Dim idummy1 As Integer
            Dim idummy2 As Integer
            idummy1 = 1
            idummy2 = 1
            idummy1 = 4
        End Sub
    End Class
    ****************************

    As a secondary issue, to get a better handle on the nature of the error, I attempted to include exception handling as suggested by farsight, but was unable to include the code suggested without getting a build error.

    I added the following code section immediately following the .net-generated section:
    **********************************************
    Sub Main()
       ' setup the global error handler
       AddHandler Application.ThreadException, AddressOf UnhandledExceptionProc
       ' display the main form
       Application.Run(New Form1)
    End Sub
    ' the critical error handler
    Private Sub UnhandledExceptionProc(ByVal sender As Object, ByVal e As _
       ThreadExceptionEventArgs)
       Try
          ' let the user decide what to do
          Dim msg As String = String.Format("A {0} exception has occurred.{2}{2}Additional " _
             & "information: {1}{2}{2}Click Yes to save current data{2}Click No to exit wit" _
             & "hout saving{2}Click Cancel to ignore error", e.Exception.GetType.Name, _
             e.Exception.Message, ControlChars.CrLf)
          Dim res As DialogResult = MessageBox.Show(msg, "Unhandled error", _
             MessageBoxButtons.YesNoCancel, MessageBoxIcon.Error)
          Select Case res
             Case DialogResult.Cancel
                ' return to the main application
                Exit Sub
             Case DialogResult.No
                ' do nothing (the application will be exited)
          End Select
       Catch ex As Exception
          ' a very serious error must have occurred, exit
       End Try
       ' If we get here, let's exit the application
       Application.Exit()
    End Sub
    ********************************
    There were no indicated errors, but when I attempted to build this, I received the message

    "no accessible "main" method with an appropriate signature was found in testdeploy.form1

    In looking at the error message (please remember I'm a novice with .net concepts) I tried to solve the problem
    by changing "sub Main()" to be "Public shared sub Main()"  As soon as I did so however, another error cropped up: namely,
    the "unhandledexceptionproc" following "Addressof" in Sub Main had an error squiggly, with an error message
    indicating that "cannot refer to an instance of a class from within a shared member or shared member initializer..." which I couldn't follow... so I would appreciate help with this as well, although my primary concern is just getting the deployment with Oracle to function.

    Thanks again...
    0
     
    LVL 4

    Expert Comment

    by:andrewharris
    A form set as startup object shouldnt have a Main. You need to put your Main in a standard module instead of a Form Module.

    I agree with what farsight is saying however if you know that the problem is with oracle, I suggest you create a bog standard form based application and put an attempt to connect in a try/catch block, then progressively add more until you get the error. Make sure you have a message box that shows the exceptions .Message.

    The error you are getting is an exception raised that is not in a try catch block, ie unhandled.

    Andrew
    0
     
    LVL 1

    Author Comment

    by:jrcooperjr
    Please read what I wrote... the exception is happening when I include the
    " Dim cmdOracleCommand As New OracleCommand"
    in an otherwise simple program.  If that line is in the code, the exception happens.  If it is not in the code, it doesn't happen.

    That is the line.....   there is nothing to put in a Try/catch block, because no instructions ever get executed... it just tries to do the "dim" statement.
    0
     
    LVL 44

    Expert Comment

    by:Arthur_Wood
    actually, that does execute 'code' - but not code that you wrote.  You can verify that it is an 'executable' line, because you can place a breakpoint on that line.

    Have you added a reference to the System.Data.OracleClient namespace?

    AW
    0
     
    LVL 4

    Expert Comment

    by:andrewharris
    OK, Apologies for not ready your post fully!!!

    I have just tested a two line application on a windows 2000 machine with NO oracle client installed but MDAC 2.7 installed:

            Dim test As New OracleClient.OracleCommand
            MsgBox(test.CommandType.ToString)
    This worked fine. Then I realised that you are using ODP.Net which made me think the OracleCommand is in System.Data.OracleClient.OracleCommand AND Oracle.DataAccess.Client, which makes me wonder if the compiler is a little confused.

    Have you tried to run the compiled application on the XP Machine? Also, you could try changing you Dim to  Dim cmdOracleCommand As New Oracle.DataAccess.Client.OracleCommand. Cant see why it should matter, but worth a try (I think).

    I am also downloading the ODP.Net but I only have Oracle 9i installed. WHich leads me to another issue, is 8.1.6 supported by ODP?

    Andrew
    0
     
    LVL 4

    Expert Comment

    by:andrewharris
    Not saying its the problems but you are supposed to use the 9i client for 8i databases:

    http://www.oracle.com/technology/tech/windows/odpnet/faq.html#DBserver

    Andrew
    0
     
    LVL 44

    Expert Comment

    by:Arthur_Wood
    8.1.x  IS NOT supported by ODP.

    AW
    0
     
    LVL 1

    Author Comment

    by:jrcooperjr
    OK... I have tried to follow the above suggestions, and still no success....

    Including a reference to the System.Data.OracleClient namespace did not work...
    Also, with respect to using the 8.1.x client, please note that my complete application (which access data from several Oracle tables and does various other operations with the data) works just fine on the machine where it was developed, which only has the 8.1.x client.  Further, in my simple test application, I'm not even trying to access the data base, but to just include a "dim Oraclecommand as new Oraclecommand" instruction line.  This works fine on one system, but not the other...

    As a secondary issue, even setting up the "sub main" in Module 1, I still am not handling the exception, so I don't have any detailed information about what is going on, except the standard generic unhandled exception error box.

    I have further simplified the code.  Below is the complete and exact source code I am working with...

    To summarize:

    Using VS 2003,   I create an install package for the code shown below on one of my two local machines.  I copy the release folder I create to a network drive.  I use the setup.exe in that folder to install the applicaton back to the local machine on which I created it; and I do a separate installation to a different local machine, which does not have Visual Studio installed on it.

    The machine where I created the application is running Windows XP Pro.  The other machine is running Windows 2000.
    Both machines have the Oracle Client 8.1.6, and both have the .net framework 1.1 (and not 1.0)  (Both machines are also able to connect to an Oracle database with no problem, although I don't think that is an issue, since in my example I'm not even specifying anything about any specific Oracle connection.)

    If I comment out the "Dim Oraclecommand as..." instruction, the deployed .exe runs with no problem on both machines.  If I leave that one line in, the .exe runs fine on the Windows XP machine, but gives an unhandled exception error on the Windows 2000 machine.

    So, what dumb thing am I doing (or not doing) with respect to that one Dim statement?  How can I get this to run on the second machine?  (And secondarily, why isn't what is supposed to be a global exception handler, not handling the exception?)

    Again, here is the complete and total code, verbatim:
    *************************************************
    Imports System.Threading
    Imports System.Data.OracleClient.OracleCommand
    Imports Oracle.DataAccess.Client
    Module Module1
    '''''' the following is copied from
    '''''''http://www.dotnet2themax.com/ShowContent.aspx?ID=8983e102-2ff7-4ac1-9620-386b166a91d8
    ''''''' as suggested by farsight above
        Sub Main()
            ' setup the global error handler
            AddHandler Application.ThreadException, AddressOf UnhandledExceptionProc
            ' display the main form
            Application.Run(New Form1)
        End Sub

        ' the critical error handler
        Public Sub UnhandledExceptionProc(ByVal sender As Object, ByVal e As ThreadExceptionEventArgs)
            Try
                ' let the user decide what to do
                Dim msg As String = String.Format("A {0} exception has occurred.{2}{2}Additional " _
                   & "information: {1}{2}{2}Click Yes to save current data{2}Click No to exit wit" _
                   & "hout saving{2}Click Cancel to ignore error", e.Exception.GetType.Name, _
                   e.Exception.Message, ControlChars.CrLf)
                Dim res As DialogResult = MessageBox.Show(msg, "Unhandled error", _
                   MessageBoxButtons.YesNoCancel, MessageBoxIcon.Error)
                Select Case res
                    Case DialogResult.Cancel
                        ' return to the main application
                        Exit Sub
                    Case DialogResult.No
                        ' do nothing (the application will be exited)
    '''''''''  I didn't include a "yes" response handling since I really don't care.. I just would like this
    '''''''''  message box to display when it hits the exception
                End Select
            Catch ex As Exception
                ' a very serious error must have occurred, exit
            End Try
            ' If we get here, let's exit the application
            Application.Exit()
        End Sub
    End Module
    '''''''''''''''''''''''''''''''''''''
    Imports System.Data.OracleClient.OracleCommand
    Imports System.Threading
    Imports Oracle.DataAccess.Client

    Public Class Form1
        Inherits System.Windows.Forms.Form
        Dim cmdOracleCommand As New Oracle.DataAccess.Client.OracleCommand
    #Region " Windows Form Designer generated code "

        Public Sub New()
            MyBase.New()

            'This call is required by the Windows Form Designer.
            InitializeComponent()

            'Add any initialization after the InitializeComponent() call

        End Sub

        'Form overrides dispose to clean up the component list.
        Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
            If disposing Then
                If Not (components Is Nothing) Then
                    components.Dispose()
                End If
            End If
            MyBase.Dispose(disposing)
        End Sub
        'Required by the Windows Form Designer
        Private components As System.ComponentModel.IContainer
        'NOTE: The following procedure is required by the Windows Form Designer
        'It can be modified using the Windows Form Designer.  
        'Do not modify it using the code editor.
        Friend WithEvents Button1 As System.Windows.Forms.Button
        <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
            Me.Button1 = New System.Windows.Forms.Button
            Me.SuspendLayout()
            '
            'Button1
            '
            Me.Button1.Location = New System.Drawing.Point(120, 64)
            Me.Button1.Name = "Button1"
            Me.Button1.Size = New System.Drawing.Size(60, 52)
            Me.Button1.TabIndex = 0
            Me.Button1.Text = "EXIT"
            '
            'Form1
            '
            Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
            Me.ClientSize = New System.Drawing.Size(292, 273)
            Me.Controls.Add(Me.Button1)
            Me.Name = "Form1"
            Me.Text = "Test Deploy"
            Me.ResumeLayout(False)
        End Sub
    #End Region
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            Dim idummy1 As Integer
            idummy1 = 1
        End Sub
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            Me.Close()
        End Sub
    End Class

    0
     
    LVL 4

    Assisted Solution

    by:andrewharris
    Can I suggest that you install ODP.Net on the W2K machine. You obviously installed it on the XP machine and the Packaging may not have picked up some of the newer files installed by the ODP.Net installer.

    Andrew
    0
     
    LVL 1

    Author Comment

    by:jrcooperjr
    OK... I downloaded ODP.net from the Oracle site and installed it on my W2K machine... I still get the unhandled exception error when I try to run my app... and I did everything again after I did the ODP install... I rebooted the system, uninstalled and then reinstalled the application, and still no good...
    In a way, this was a relief, as I didn't think that Oracle's ODP was ever installed on my XP system (unless the Visual Studio install did this in some way) and the app works just great on that system...and wasn't one of the advantages of .net over VB6 was that its packager would automatically include everything one needed to install apps on a client machine (as long as the client had the .net framework in place)?

    I'm still hoping that someone will point out why the *%#*$@(!@  "dim" statement works on one system and not the other....
    thanks...
     
    0
     
    LVL 4

    Expert Comment

    by:andrewharris
    I cant understand how you ended up with access to the Oracle namespace without installing the ODP Client. But that aside I am sorry to say that I agree I can see no reason for this to happen and am all out of ideas (Hair Brained as they may be)

    Andrew
    0
     
    LVL 44

    Expert Comment

    by:Arthur_Wood
    clearly there is some key difference between the develolpment box and the box where the error is being raised.  Identify the differences between the two boxes, and the problem will be in those differences.

    AW
    0
     
    LVL 12

    Accepted Solution

    by:

    Actually my setup for unhandled exceptions in forms is like this, so I'm capturing both Thread exceptions and Unhandled exceptions.

            AddHandler Application.ThreadException, AddressOf HandleThreadException
            AddHandler AppDomain.CurrentDomain.UnhandledException, AddressOf HandleUnhandledException

    Then I use these to actually handle the events.  They're a little weak.  (You can omit the Tracer line.)

        ' Handles the exception event.
        Public Shared Sub HandleThreadException( _
            ByVal sender As Object, _
            ByVal t As System.Threading.ThreadExceptionEventArgs)

            HandleWithMessageBox(t.Exception)
        End Sub

        Public Shared Sub HandleUnhandledException( _
            ByVal sender As Object, _
            ByVal e As UnhandledExceptionEventArgs)

            HandleWithMessageBox(CType(e.ExceptionObject, Exception))
        End Sub

        Private Shared Sub HandleWithMessageBox(ByVal e As Exception)
            Dim newline As String = System.Environment.NewLine
            Dim msg As String = _
                "A problem has occurred in this application which requires a " & _
                "shutdown." & newline & newline & _
                e.Message & newline & newline & _
                e.ToString() & newline & newline

            Tracer.Trace(TraceLevel.Error, msg)
            System.Windows.Forms.MessageBox.Show(msg, "Unrecoverable Application Condition", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)

            ' Exit application.
            Application.Exit()
        End Sub

    Instead of just using e.Message and e.ToString in HandleWithMessageBox, you might want to use ExceptionInfo(e).  This will provide additional info on any inner exceptions, and may provide you with more detail.

        Public Function ExceptionInfo(ByVal ex As Exception) As String
            Dim nl As String = System.Environment.NewLine
            Dim fmt As String = "{0}: {1}" & nl

            Dim sb As New System.Text.StringBuilder
            Dim level As Integer = 1
            Do While Not (ex Is Nothing)
                sb.AppendFormat(fmt, "Level", level)
                sb.AppendFormat(fmt, "TypeName", ex.GetType.Name)
                sb.AppendFormat(fmt, "Message", ex.Message & nl)

                level += 1
                ex = ex.InnerException
            Loop
            Return sb.ToString
        End Function

    Tell us exactly what exception you get.
    0
     
    LVL 1

    Author Comment

    by:jrcooperjr
    Thanks farsight for your code... I cut and pasted it into my test, but still could not get the exception to be handled.. that is, I still got the "exception that could not be handled" message... I have included my complete code for this simple module below...hopefully, I set it up as I was supposed to, but as a relative novice to .net, I'm probably doing something really stupid and obvious..so please don't make any assumptions... what you see below is exactly what I'm trying to run.

    I create an install project for the code, and place the folder containing the deployment project on a network drive.  I then use that setup.exe to install the project.  I install it on a WinXP box (which also happens to be the system which has my .net development system where the project was created) and I install it on a W2K box.  The .exe file that gets installed works error free on the WinXP system.  On the W2K system, it gives me an unhandled exception.

    The critical line is the "dim OracleCommand.." line.  If I comment out that one line, the package runs without error on both machines.  If I leave that line in, the W2K machine gets the exception.

    The exact exception is:  An error box pops up... the box title includes my .exe program name and the words "Common Language Runtime Debugging Services".  The text of the message reads:  "Application has generated an exception that could not be handled.  Process id=0x6f0(1776), Thread id=0x890(2192).  Click OK to terminate the application.  Click CANCEL to debug the application."  Then I have an OK and a cancel button.  If I click Cancel, I get a message stating "A registered JIT debugger is not available.  An attempt to launch a JIT debugger with the following command resulted in an error code of 0x2(2).  Please check computer settings.  cordbg.exe !a 0x6f0"

    Here is my complete code:
    *****************************************


    Imports System.Data.OracleClient.OracleCommand
    Imports System.Threading
    Imports Oracle.DataAccess.Client
    Module Module1

        Sub Main()
            ' setup the global error handler
            AddHandler Application.ThreadException, AddressOf HandleThreadException
            AddHandler AppDomain.CurrentDomain.UnhandledException, AddressOf HandleUnhandledException

            ' display the main form
            Application.Run(New Form1)
        End Sub

        ' the critical error handler
        Public Sub UnhandledExceptionProc(ByVal sender As Object, ByVal e As ThreadExceptionEventArgs)
            Try
                ' let the user decide what to do
                Dim msg As String = String.Format("A {0} exception has occurred.{2}{2}Additional " _
                   & "information: {1}{2}{2}Click Yes to save current data{2}Click No to exit wit" _
                   & "hout saving{2}Click Cancel to ignore error", e.Exception.GetType.Name, _
                   e.Exception.Message, ControlChars.CrLf)
                Dim res As DialogResult = MessageBox.Show(msg, "Unhandled error", _
                   MessageBoxButtons.YesNoCancel, MessageBoxIcon.Error)
                Select Case res
                    Case DialogResult.Cancel
                        ' return to the main application
                        Exit Sub
                    Case DialogResult.No
                        ' do nothing (the application will be exited)
                        '''''''''  I didn't include a "yes" response handling since I really don't care.. I just would like this
                        '''''''''  message box to display when it hits the exception
                End Select
            Catch ex As Exception
                ' a very serious error must have occurred, exit
            End Try
            ' If we get here, let's exit the application
            Application.Exit()
        End Sub
        ' Handles the exception event.
        Public Sub HandleThreadException( _
            ByVal sender As Object, _
            ByVal t As System.Threading.ThreadExceptionEventArgs)
            HandleWithMessageBox(t.Exception)
        End Sub

        Public Sub HandleUnhandledException( _
            ByVal sender As Object, _
            ByVal e As UnhandledExceptionEventArgs)
            HandleWithMessageBox(CType(e.ExceptionObject, Exception))
        End Sub

        Private Sub HandleWithMessageBox(ByVal e As Exception)
            Dim newline As String = System.Environment.NewLine
            Dim msg As String = _
                "A problem has occurred in this application which requires a " & _
                "shutdown." & newline & newline & _
                e.Message & newline & newline & _
                e.ToString() & newline & newline
            ' Exit application.
            Application.Exit()
        End Sub
        Public Function ExceptionInfo(ByVal ex As Exception) As String
            Dim nl As String = System.Environment.NewLine
            Dim fmt As String = "{0}: {1}" & nl

            Dim sb As New System.Text.StringBuilder
            Dim level As Integer = 1
            Do While Not (ex Is Nothing)
                sb.AppendFormat(fmt, "Level", level)
                sb.AppendFormat(fmt, "TypeName", ex.GetType.Name)
                sb.AppendFormat(fmt, "Message", ex.Message & nl)

                level += 1
                ex = ex.InnerException
            Loop
            Return sb.ToString
        End Function

    End Module

    '''''''''''''''''''''''''''
    Imports System.Threading
    Imports System.Data.OracleClient.OracleCommand
    Imports Oracle.DataAccess.Client

    Public Class Form1
        Inherits System.Windows.Forms.Form
        Dim cmdOracleCommand As New Oracle.DataAccess.Client.OracleCommand
    #Region " Windows Form Designer generated code "

        Public Sub New()
            MyBase.New()

            'This call is required by the Windows Form Designer.
            InitializeComponent()

            'Add any initialization after the InitializeComponent() call

        End Sub

        'Form overrides dispose to clean up the component list.
        Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
            If disposing Then
                If Not (components Is Nothing) Then
                    components.Dispose()
                End If
            End If
            MyBase.Dispose(disposing)
        End Sub
        'Required by the Windows Form Designer
        Private components As System.ComponentModel.IContainer
        'NOTE: The following procedure is required by the Windows Form Designer
        'It can be modified using the Windows Form Designer.  
        'Do not modify it using the code editor.
        Friend WithEvents Button1 As System.Windows.Forms.Button
        Private Sub InitializeComponent()
            Me.Button1 = New System.Windows.Forms.Button
            Me.SuspendLayout()
            '
            'Button1
            '
            Me.Button1.Location = New System.Drawing.Point(120, 64)
            Me.Button1.Name = "Button1"
            Me.Button1.Size = New System.Drawing.Size(60, 52)
            Me.Button1.TabIndex = 0
            Me.Button1.Text = "EXIT"
            '
            'Form1
            '
            Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
            Me.ClientSize = New System.Drawing.Size(292, 273)
            Me.Controls.Add(Me.Button1)
            Me.Name = "Form1"
            Me.Text = "Test Deploy"
            Me.ResumeLayout(False)
        End Sub
    #End Region
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            Dim idummy1 As Integer
            idummy1 = 1
        End Sub
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            Me.Close()
        End Sub
    End Class


    0
     
    LVL 1

    Author Comment

    by:jrcooperjr
    Thanks to all for your input...
    I finally found a solution to my problem, which came as soon as I was able to include an exception handler that gave me some information.  (the answers from "farsight" above helped me to get partway toward getting the exception handled, but I wasn't able to get it fully resolved without assistance received in a separate question
    (see http://www.experts-exchange.com/Programming/Programming_Languages/Dot_Net/VB_DOT_NET/Q_21190725.html

    Anyway, the message that the working exception handler finally gave said something like "unable to load OraOps10.dll"

    This immediately led me to look at the Oracle stuff I had loaded on the machine where the application was working, as contrasted to the machine where it wasn't.  Both machines had the Oracle 8.1.6 client.... I also thought both machines had the ODP.net package installed.  I had specifically installed OPD.net (I thought) on the second machine (thanks to the suggestion above I received from Andrew Harris).  However, on looking closer, I had grabbed the Oracle 9i Data provider for .net, and not the Oracle 10g Data Provider.   ( I had grabbed the 9i version because we currently are using Oracle 8, but will be soon going to Oracle 9, but have no immediate plans to go to Oracle 10.)

    However, the exception message immediately led me to look at what I had on my XP box, and I found that there I had loaded the Oracle 10g data provider.  So on the second box, I unloaded the 9i data provider, loaded the 10g data provider, and suddenly everything started working (both my test deployment application as well as my complete "real" application).

    So to summarize, the deployment package created by .net, even though it includes the oracledataaccess.dll, does not automatically include all of the pieces one needs to get a .net/Oracle application working.  The machine must have an Oracle client (I also determined this experimentally).  Both of my machines have the Oracle 8.1.6 client, and they work fine.  In addition to the client, the machine must also have the Oracle 10g data adapter. (I imagine that if one plays around with the deployment packager, that one could figure out how to include these Oracle pieces in the packager, or at least have the packager check the registry to determine whether these have been installed and alert the installer that these packages have to be installed.)
    0
     
    LVL 12

    Expert Comment

    by:farsight
    Thanks for the followup.  It's nice to know how these things are finally resolved.
    0
     
    LVL 4

    Expert Comment

    by:andrewharris
    Dito. Glad it got resolved.

    Andrew
    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Lean Six Sigma Project Manager Certification

    There are many schools of thought around successful project management, but few as highly regarded as the Six Sigma and Lean methods. With 37 hours of learning, this training will explain concrete processes for increasing efficiency and limiting wasted time and effort.

    This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
    With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!

    856 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now