all groups > vj# > october 2004 >
You're in the

vj#

group:

Serious bug on ternary operator: ExecutionEngineException


Serious bug on ternary operator: ExecutionEngineException Bruno Jouhier [MVP]
10/6/2004 10:20:37 PM
vj#:
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.

Serious bug on ternary operator: ExecutionEngineException wendy ferrari = maman75 NO[at]SPAM hotmail.com
10/7/2004 6:41:32 PM

[quoted text, click to view]
RE: Serious bug on ternary operator: ExecutionEngineException Amit.vjc NO[at]SPAM online.microsoft.com
10/10/2004 9:06:42 AM
Hi Bruno,

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

Amit
--------------------
[quoted text, click to view]
cpmsftngxa06.phx.gbl!TK2MSFTNGXA03.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP14
.phx.gbl
[quoted text, click to view]
AddThis Social Bookmark Button