Exception.InnerException ?

Posted on 2007-08-10
Last Modified: 2013-11-26
I am getting a runtime exception in a VB6 conversion.
The application calls custom OCX controls from a VB.NET project.

The error message is : System.InvalidOperationException was unhandled

It occurs at the following line:
Me.MainForm = Global.App.Main

How do I debug this further ?
Question by:pillmill
    LVL 34

    Accepted Solution

    I would put the offending line, temporarily, in a Try Catch block giving some "saveable" output in the catch.  Like this

             Me.MainForm = Global.App.Main
         Catch ex As Exception
         End Try

    using ex.ToString reports the full error text.  Using Debug.WriteLine means that the output can, if necessary, be copied and pasted to study at leisure.


    Author Comment


    The first error reported is:
    "A first chance exception of type 'System.InvalidCastException' occurred in AxInterop.Application1.dll"

    How do I determine the line in Application1 at which this exception was thrown ?
    LVL 34

    Expert Comment

    Unless you can detect it from the stack trace - which should follow the line you've quoted from the error message - I don't know.



    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
    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…
    THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.
    The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

    730 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

    16 Experts available now in Live!

    Get 1:1 Help Now