1
Vote

Arithmetic expression mixing int and float literals is not working in Windows Phone

description

The expression 2 + 2 is successfully evaluated, but 2 + 2.5 crashes the app.
 
The expression 2.5 + 2.5 is evaluated successfully.
 
Please see the attached sample.

file attachments

comments

cmello wrote Mar 8, 2012 at 4:39 AM

The exception thrown is ArgumentNullException. Stack trace:


at Microsoft.Scripting.Utils.ContractUtils.RequiresNotNull(Object value, String paramName)
at Microsoft.Scripting.Utils.CollectionUtils.FindIndex[T](IList1 collection, Predicate1 predicate)
at Microsoft.Scripting.Utils.ExceptionUtils.SetData(Exception e, Object key, Object value)
at Microsoft.Scripting.Interpreter.InterpretedFrame.SaveTraceToException(Exception exception)
at Microsoft.Scripting.Interpreter.Interpreter.HandleException(InterpretedFrame frame, Exception exception)
at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.LightLambda.Run1[T0,TRet](FunctionCode arg0)
at IronPython.Compiler.RuntimeScriptCode.InvokeTarget(Scope scope)
at IronPython.Compiler.RuntimeScriptCode.Run()
at Microsoft.Scripting.SourceUnit.Execute()
at Microsoft.Scripting.Hosting.ScriptSource.Execute()
at Microsoft.Scripting.Hosting.ScriptEngine.Execute(String expression)
at PhoneFloatDivision.App.Application_Startup(Object sender, StartupEventArgs e)
at MS.Internal.CoreInvokeHandler.InvokeEventHandler(Int32 typeIndex, Delegate handlerDelegate, Object sender, Object args)
at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName)

jdhardy wrote Mar 10, 2012 at 7:08 AM

The error given is not the root cause; it's a side effect of a bug in how unhandled exception are handled. Fixing that and another issue, the root cause is:


System.InvalidProgramException occurred
Message=InvalidProgramException
StackTrace:
   at System.Dynamic.UpdateDelegates.UpdateAndExecute1[T0,TRet](CallSite site, Int32 arg0)
   at CallSite.Target()
   at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, Object arg0, Object arg1)
   at Microsoft.Scripting.Interpreter.DynamicInstruction`3.Run(InterpretedFrame frame)
   at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
   at Microsoft.Scripting.Interpreter.LightLambda.Run1[T0,TRet](FunctionCode arg0)
   at IronPython.Compiler.RuntimeScriptCode.InvokeTarget(Scope scope)
   at IronPython.Compiler.RuntimeScriptCode.Run()
   at Microsoft.Scripting.SourceUnit.Execute()
   at Microsoft.Scripting.Hosting.ScriptSource.Execute()
   at Microsoft.Scripting.Hosting.ScriptEngine.Execute(String expression)
   at PhoneFloatDivision.App.Application_Startup(Object sender, StartupEventArgs e)
   at MS.Internal.CoreInvokeHandler.InvokeEventHandler(Int32 typeIndex, Delegate handlerDelegate, Object sender, Object args)
   at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName)
Code generation bugs are not fun to fix.