Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Visual J# / October 2004

Tip: Looking for answers? Try searching our database.

Serious bug on ternary operator: ExecutionEngineException

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bruno Jouhier [MVP] - 06 Oct 2004 21:20 GMT
The following program compiles fine bug generates an
ExecutionEngineException at runtime:

package TOBugJSharp;
import System.Decimal;

public class Buggy
{
   /** @property */
   public Decimal get_DecimalValue() { return new Decimal(1); }

   public Object GetValue(boolean withCast)
   {
       return withCast ? (Object)get_DecimalValue() : get_DecimalValue();
   }

   /** @attribute System.STAThread() */
   public static void main(String[] args)
   {
       Buggy buggy = new Buggy();
       Object val = buggy.GetValue(true);
       // instanceof triggers ExecutionEngineException!
       if (val instanceof String)
           System.out.println("string");
       else
           System.out.println("other: " + val);
   }
}

Also, if you change it call buggy.GetValue(false) instead of
buggy.GetValue(true), it prints
   other: null
which is also wrong (if you try val.getClass() , you get an NPE!)

So, it sounds that the compiler is generating buggy IL on the ternary
operator inside GetValue, my guess is that the Decimal is not boxed
correctly and then things go wild (but I am not an IL expert).

I tried it with Whidbey and the bug is still there. So, I will post it on
the whidbey site too.

Bruno.
wendy ferrari  =  maman75@hotmail.com - 08 Oct 2004 02:41 GMT
>-----Original Message-----
>The following program compiles fine bug generates an
[quoted text clipped - 41 lines]
>
>.
Amit Bhagwat [MSFT] - 10 Oct 2004 10:06 GMT
Hi Bruno,

Thanks for reporting this issue in the compiler. We will be fixing this
issue in the next release of VJ#.

Amit
--------------------
>From: "Bruno Jouhier [MVP]" <bjouhier@club-internet.fr>
>Subject: Serious bug on ternary operator: ExecutionEngineException
[quoted text clipped - 9 lines]
>NNTP-Posting-Host: l01v-23-55.d4.club-internet.fr 212.194.242.55
>Path:
cpmsftngxa06.phx.gbl!TK2MSFTNGXA03.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP14
.phx.gbl
>Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.vjsharp:6474
>X-Tomcat-NG: microsoft.public.dotnet.vjsharp
[quoted text clipped - 41 lines]
>
>Bruno.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.