1

Closed

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

Closed Dec 9, 2014 at 7:36 PM by jdhardy
Migrated to GitHub.

comments

cmello wrote Mar 8, 2012 at 3: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 6: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.

wrote Jun 24, 2012 at 5:25 PM

wrote Feb 22, 2013 at 1:09 AM

wrote Jun 26, 2013 at 5:31 AM

wrote Dec 9, 2014 at 7:36 PM