HighTechTalks DotNet Forums  

InvocationTarget Exception missing StackTrace

Dotnet VJSharp microsoft.public.dotnet.vjsharp


Discuss InvocationTarget Exception missing StackTrace in the Dotnet VJSharp forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Dylan
 
Posts: n/a

Default InvocationTarget Exception missing StackTrace - 10-07-2004 , 05:19 AM







We are executing a J# instance method via reflection that
causes an exception to be thrown. The reflection API
throws an InvocationTargetException however the details of
the original exception contained within the
InvocationTargetException and the StackTrace are null.

This appears to be a similar problem that Brien posted to
this newsgroup on 2002-10-24 13:54:08.

Gopinath (MS) responsed on 22-10-30 22:34:05 stated that
there appeared to be a bug in J# "that the stack trace is
not getting set properly".

Can you confirm if this "bug" was fixed in any release of
J# or the .Net Framework

As Brien stated, providing accurate debugging information
is critical to any IDE.

If you someone could provide an update on the status of
this problem it would be very helpful

Dylan

Reply With Quote
  #2  
Old   
Bruno Jouhier [MVP]
 
Posts: n/a

Default Re: InvocationTarget Exception missing StackTrace - 10-09-2004 , 02:53 AM






It is probably because the exception that gets thrown by the method is a non
Java exception (an exception that derives from System.Exception but not from
java.lang.Throwable). The problem is that the getTargetException() method
returns a java.lang.Throwable, and it cannot be used to return a non Java
exception, so the J# designers have decided to return null in this case.

I signaled this problem a long while ago, and it really needs attention
because it prevents you from using the Java reflection API if you want to be
able to log all exception stacktraces in a reliable way (because of that, we
had to switch to the .NET reflection API, which caused other annoyances,
like having to box primitive types the .NET way rather than the Java way).

There a few ways J# could solve this without breaking Java specs (they
cannot change the return type of getTargetException). For example, there
could be an additional method like getDotNetTargetException() that returns a
System.Exception, or J# could use a wrapper class that wraps a
System.Exception into a java.lang.Exception, and getTargetException could
return the wrapped exception.

Another annoyance is that J# treats .NET exceptions as checked exceptions
(you have to declare them in your throws clause), which is at odds with the
way C# (and other .NET languages) treat .NET exceptions.

Bruno.

"Dylan" <dylan.hayes (AT) bearingpoint (DOT) com> a écrit dans le message de news:
08ee01c4ac4e$cebd1020$a301280a (AT) phx (DOT) gbl...
Quote:
We are executing a J# instance method via reflection that
causes an exception to be thrown. The reflection API
throws an InvocationTargetException however the details of
the original exception contained within the
InvocationTargetException and the StackTrace are null.

This appears to be a similar problem that Brien posted to
this newsgroup on 2002-10-24 13:54:08.

Gopinath (MS) responsed on 22-10-30 22:34:05 stated that
there appeared to be a bug in J# "that the stack trace is
not getting set properly".

Can you confirm if this "bug" was fixed in any release of
J# or the .Net Framework

As Brien stated, providing accurate debugging information
is critical to any IDE.

If you someone could provide an update on the status of
this problem it would be very helpful

Dylan



Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.