Exception.InnerException ?

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 ?
Who is Participating?
SanclerConnect With a Mentor Commented:
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.

pillmillAuthor Commented:

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


Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.