This means 462 bytes into the intermediate language of the method that's
throwing the exception. This info would only be useful if you did an IL
disassembly on the compiled code to see exactly what was failing, but of
course you'd need to know what DLL the exception was thrown in.
I'd venture to guess that this is what's actually happening:
1) Your project is compiled with debug info, but there is only one line in
that project that can possibly be causing the catch -- the one line of code
that's in the try block. Therefore:
2) The exception is being thrown inside a .NET assembly, somewhere in the
chain of internal methods that is called as a result of g_oDBLocal.Open().
This internal code is NOT compiled in debug mode, which explains why you're
not getting file/line/column info in the stack trace.
So if you are working on a generic routine that walks the stack trace to get
the offending line number you will have to handle the possibility that the
exception is thrown in system or 3rd party code and you won't always be able
to get the line number (and of course you won't be able to get the line #
for your own code if your project is in release mode).
So I conclude that the routine mentioned in the stack trace, OpenLocalDB, is
a (probably protected or private) method within an assembly in the GAC
somewhere, most likely System.Data.dll.
--Bob
Le said:
Hi,
Please see the code below, the StackFrame.ToString() gives me following
Information
OpenLocalDB at offset 462 in file: line:column <filename unknown> :0:0
Can you tell me, what it means "offset nnn"
Thanks
catch( System.DivideByZeroException ex)
{
System.Diagnostics.StackTrace st = new
System.Diagnostics.StackTrace(ex);
System.Diagnostics.StackFrame sF;
int i;
for (i=0; i< st.FrameCount; i++)
{
sF = st.GetFrame(i);
MessageBox.Show(sF.ToString());
}
}