![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
-----Original Message----- 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. . |
#3
| |||
| |||
|
|
From: "Bruno Jouhier [MVP]" <bjouhier (AT) club-internet (DOT) fr Subject: Serious bug on ternary operator: ExecutionEngineException Date: Wed, 6 Oct 2004 22:20:37 +0200 Lines: 44 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-RFC2646: Format=Flowed; Original Message-ID: <eE$C5H#qEHA.3252 (AT) TK2MSFTNGP14 (DOT) phx.gbl Newsgroups: microsoft.public.dotnet.vjsharp NNTP-Posting-Host: l01v-23-55.d4.club-internet.fr 212.194.242.55 Path: cpmsftngxa06.phx.gbl!TK2MSFTNGXA03.phx.gbl!TK2MSFT NGP08.phx.gbl!TK2MSFTNGP14 |
|
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.vjsharp:6474 X-Tomcat-NG: microsoft.public.dotnet.vjsharp 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. |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |