Home All Groups Group Topic Archive Search About

get variable that involve with exception

Author
13 Oct 2006 1:57 PM
mtczx232
have a way to get the variables (and values) that involve with
exception from exception object?
have a way to know the specific address where exception fire in the
code?
(the stack call give only the mathod, not specific line or command
that fire the exception).

Author
13 Oct 2006 2:32 PM
Chris Fulstow
Exception.StackTrace should give you some of that information if you're
running in Debug mode.

http://msdn2.microsoft.com/en-us/library/system.exception.stacktrace.aspx


mtczx***@yahoo.com wrote:
Show quote
> have a way to get the variables (and values) that involve with
> exception from exception object?
> have a way to know the specific address where exception fire in the
> code?
>  (the stack call give only the mathod, not specific line or command
> that fire the exception).
Author
15 Oct 2006 1:16 AM
mtczx232
Chris Fulstow wrote:
> Exception.StackTrace should give you some of that information if you're
> running in Debug mode.
>
> http://msdn2.microsoft.com/en-us/library/system.exception.stacktrace.aspx
>
>
> mtczx***@yahoo.com wrote:
> > have a way to get the variables (and values) that involve with
> > exception from exception object?
> > have a way to know the specific address where exception fire in the
> > code?
> >  (the stack call give only the mathod, not specific line or command
> > that fire the exception).

if you read my question we not get more bla bla on the internet.
my claim is very simple! the StackTrace is not give us any idea what
line of code make the exception.

for example:

   private sub xx()
      ..
      dim s as string=b.toString()  //the b is null, so it's throw
exception
      ..
   end sub

So  now we see how is difficult to know witch line make the problem and
witch var is null!

have solution for this problam?
Author
15 Oct 2006 4:06 AM
Carl Daniel [VC++ MVP]
mtczx***@yahoo.com wrote:
Show quote
> Chris Fulstow wrote:
>> Exception.StackTrace should give you some of that information if
>> you're running in Debug mode.
>>
>> http://msdn2.microsoft.com/en-us/library/system.exception.stacktrace.aspx
>>
>>
>> mtczx***@yahoo.com wrote:
>>> have a way to get the variables (and values) that involve with
>>> exception from exception object?
>>> have a way to know the specific address where exception fire in the
>>> code?
>>>  (the stack call give only the mathod, not specific line or command
>>> that fire the exception).
>
> if you read my question we not get more bla bla on the internet.
> my claim is very simple! the StackTrace is not give us any idea what
> line of code make the exception.
>
> for example:
>
>   private sub xx()
>      ..
>      dim s as string=b.toString()  //the b is null, so it's throw
> exception
>      ..
>   end sub
>
> So  now we see how is difficult to know witch line make the problem
> and witch var is null!
>
> have solution for this problam?

As Chris already indicated, if you're runing a debug build then the stack
trace from the exception will tell you the file name and line number where
the exception was thrown.  If you're not running a debug build, then you'll
only get the function name.

That's all there is - there ain't no more.

-cd
Author
15 Oct 2006 4:52 PM
mtczx232
what you mean, debug build is running from VS? if is true what we do on
the customer place?

We face day after day with this problem! the Program compile yet under
debug profile and deliver to customer for debugging session. the
customer call about bugs, but the max Info is name of procedure . I
very wonder why Microsoft not give us more info for this session! it's
very simple to add to exception more info about the line on source (I
know about the code version problem), and add the CLI code thet make
the problem.

the real thing is, that since microsoft and third's parties give us
Decompilers, there no problam to add to exception viewer the source
code from CLI code itself, without need to keep track after versions of
source codes that belong to this CLI.

I see demostrasion of AVIcode product that collect such info on each
exception. I wonder, if exception not include this info, How Avicode
collect it? I not think that Avicode change or replace fuction from
Framwork or change the code that JIT make from CLI?

So I can get the CLI code with the command that make the exception?

AddThis Social Bookmark Button