<HTML>
<HEAD>
<TITLE>Re: [IronPython] Silverlight: Cannot cast from 'System.Nullable`1[System.Boolean]' to 'System.Boolean'</TITLE>
</HEAD>
<BODY>
<FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'>Oh, from your VideoBrush thread? Didn&#8217;t try it ... I&#8217;ll look now<BR>
<BR>
<BR>
On 5/28/08 11:46 AM, &quot;Michael Foord&quot; &lt;<a href="fuzzyman@voidspace.org.uk">fuzzyman@voidspace.org.uk</a>&gt; wrote:<BR>
<BR>
</SPAN></FONT><BLOCKQUOTE><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'>Jimmy Schementi wrote:<BR>
&gt; Yay for finding a IronPython bug =) Does it work if you do IsChecked =<BR>
&gt; None as well? Dino, do you know about this?<BR>
&gt;<BR>
<BR>
I'll try setting IsChecked to None.<BR>
<BR>
Did you see that on the Mac (Safari) I'm not getting the MediaEnded<BR>
event on a MediaElement when a video stops playing? Probably not an<BR>
IronPython bug, more likely a Silverlight one. It used to work for 1.1<BR>
Alpha though (I get a CurrentStateChanged event where the state changes<BR>
to Buffering instead!).<BR>
<BR>
Michael<BR>
<BR>
&gt; ~js<BR>
&gt;<BR>
&gt; On 5/17/08 11:46 AM, &quot;Michael Foord&quot; &lt;<a href="fuzzyman@voidspace.org.uk">fuzzyman@voidspace.org.uk</a>&gt; wrote:<BR>
&gt;<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;This is cool. I have a checkbox in my silverlight UI.<BR>
&gt;<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;I have a code path that does:<BR>
&gt;<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;if self.remember_me.IsChecked:<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;PutStored(username, password)<BR>
&gt;<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;The *second* time through this code path it blows up with the<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;exception<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;below. I can fix it by changing the test to:<BR>
&gt;<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;if self.remember_me.IsChecked == True:<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;PutStored(username, password)<BR>
&gt;<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;Which works fine, but I thought you might be interested. :-)<BR>
&gt;<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;Full traceback below...<BR>
&gt;<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;ArgumentException: Cannot cast from<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;'System.Nullable`1[System.Boolean]'<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;to 'System.Boolean'<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;ArgumentException<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;at Microsoft.Scripting.Ast.LambdaCompiler.EmitCast(Type from, Type to)<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;at Microsoft.Scripting.Ast.LambdaCompiler.Emit(UnaryExpression node)<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;at<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;Microsoft.Scripting.Ast.LambdaCompiler.EmitExpression(Expression node)<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;at Microsoft.Scripting.Ast.LambdaCompiler.Emit(BinaryExpression node)<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;at<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;Microsoft.Scripting.Ast.LambdaCompiler.EmitExpression(Expression node)<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;at Microsoft.Scripting.Ast.LambdaCompiler.EmitReturn(Expression expr)<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;at Microsoft.Scripting.Ast.LambdaCompiler.Emit(ReturnStatement node)<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;at<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;Microsoft.Scripting.Ast.LambdaCompiler.EmitExpression(Expression node)<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;at Microsoft.Scripting.Actions.StandardRule`1.Emit(LambdaCompiler cg,<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;Label ifFalse)<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;at Microsoft.Scripting.Actions.SmallRuleSet`1.MakeTarget(CodeContext<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;context)<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;at Microsoft.Scripting.Actions.RuleSet`1.GetOrMakeTarget(CodeContext<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;context)<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;at<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;Microsoft.Scripting.Actions.DynamicSiteHelpers.UpdateSite[T](CodeContext<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;callerContext, Object site, T&amp; target, RuleSet`1&amp; rules,<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;StandardRule`1<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;rule)<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;at<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;Microsoft.Scripting.Actions.RuleTree`1.GetRuleMaybeExecute(CodeContext<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;callerContext, Object[] args, Boolean execute, Object site, T&amp; target,<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;RuleSet`1&amp; rules, Object&amp; result)<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;at<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;Microsoft.Scripting.Actions.RuleTree`1.ExecuteRuleAndUpdateSite(CodeContext<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;callerContext, Object[] args, Object site, T&amp; target, RuleSet`1&amp;<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;rules,<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;Object&amp; result)<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;at<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;Microsoft.Scripting.Actions.RuleCache.ActionRuleCache.ExecuteRuleAndUpdateSite[T](CodeContext<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;context, Object[] args, Object site, T&amp; target, RuleSet`1&amp; rules,<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;Object&amp; result)<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;at<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;Microsoft.Scripting.Actions.RuleCache.ExecuteRuleAndUpdateSite[T](CodeContext<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;callerContext, DynamicAction action, Object[] args, Object site, T&amp;<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;target, RuleSet`1&amp; rules, Object&amp; result)<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;at<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;Microsoft.Scripting.Actions.ActionBinder.UpdateSiteAndExecute[T](CodeContext<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;callerContext, DynamicAction action, Object[] args, Object site, T&amp;<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;target, RuleSet`1&amp; rules)<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;at<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;Microsoft.Scripting.Actions.DynamicSite`2.UpdateBindingAndInvoke(CodeContext<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;context, T0 arg0)<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;at<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;Microsoft.Scripting.Actions.DynamicSiteHelpers.UninitializedTargetHelper`7.Invoke1(DynamicSite`2<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;site, CodeContext context, T0 arg0)<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;at Microsoft.Scripting.Actions.DynamicSite`2.Invoke(CodeContext<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;context,<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;T0 arg0)<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;at _stub_##224(Closure , DynamicSite`2 , CodeContext , Object )<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;at Microsoft.Scripting.Actions.DynamicSite`2.Invoke(CodeContext<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;context,<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;T0 arg0)<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;at S$3.onLogin$18(Closure , Object self, Object sender, Object event)<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;at Microsoft.Scripting.Utils.InvokeHelper`5.Invoke(Object arg0, Object<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;arg1, Object arg2, Object arg3)<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;at Microsoft.Scripting.Utils.ReflectedCaller.InvokeInstance(Object<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;instance, Object[] args)<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;at Microsoft.Scripting.Ast.Interpreter.InvokeMethod(MethodInfo method,<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;Object instance, Object[] parameters)<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;at<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;Microsoft.Scripting.Ast.Interpreter.InterpretMethodCallExpression(CodeContext<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;context, Expression expr)<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;at Microsoft.Scripting.Ast.Interpreter.Interpret(CodeContext context,<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;Expression expr)<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;at<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;Microsoft.Scripting.Ast.Interpreter.InterpretReturnStatement(CodeContext<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;context, Expression expr)<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;at Microsoft.Scripting.Ast.Interpreter.Interpret(CodeContext context,<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;Expression expr)<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;at Microsoft.Scripting.Ast.Interpreter.Execute(CodeContext context,<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;Expression expression)<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;at Microsoft.Scripting.Actions.StandardRule`1.ExecuteTarget(Object<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;site,<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;CodeContext context, Object[] args)<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;at<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;Microsoft.Scripting.Actions.RuleTree`1.GetRuleMaybeExecute(CodeContext<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;callerContext, Object[] args, Boolean execute, Object site, T&amp; target,<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;RuleSet`1&amp; rules, Object&amp; result)<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;at<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;Microsoft.Scripting.Actions.RuleTree`1.ExecuteRuleAndUpdateSite(CodeContext<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;callerContext, Object[] args, Object site, T&amp; target, RuleSet`1&amp;<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;rules,<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;Object&amp; result)<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;at<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;Microsoft.Scripting.Actions.RuleCache.ActionRuleCache.ExecuteRuleAndUpdateSite[T](CodeContext<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;context, Object[] args, Object site, T&amp; target, RuleSet`1&amp; rules,<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;Object&amp; result)<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;at<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;Microsoft.Scripting.Actions.RuleCache.ExecuteRuleAndUpdateSite[T](CodeContext<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;callerContext, DynamicAction action, Object[] args, Object site, T&amp;<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;target, RuleSet`1&amp; rules, Object&amp; result)<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;at<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;Microsoft.Scripting.Actions.ActionBinder.UpdateSiteAndExecute[T](CodeContext<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;callerContext, DynamicAction action, Object[] args, Object site, T&amp;<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;target, RuleSet`1&amp; rules)<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;at<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;Microsoft.Scripting.Actions.DynamicSite`5.UpdateBindingAndInvoke(CodeContext<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;context, T0 arg0, T1 arg1, T2 arg2, T3 arg3)<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;at<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;Microsoft.Scripting.Actions.DynamicSiteHelpers.UninitializedTargetHelper`7.Invoke4(DynamicSite`5<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;site, CodeContext context, T0 arg0, T1 arg1, T2 arg2, T3 arg3)<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;at Microsoft.Scripting.Actions.DynamicSite`5.Invoke(CodeContext<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;context,<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;T0 arg0, T1 arg1, T2 arg2, T3 arg3)<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;at _stub_##217(Closure , DynamicSite`4 , CodeContext , Object ,<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;Object ,<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;Object )<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;at Microsoft.Scripting.Actions.DynamicSite`4.Invoke(CodeContext<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;context,<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;T0 arg0, T1 arg1, T2 arg2)<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;at System.Void(Object, RoutedEventArgs), using<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;PythonBinder##183(Closure<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;, Object , RoutedEventArgs )<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;at System.Windows.Controls.Primitives.ButtonBase.OnClick()<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;at<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;e)<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;at<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(Object<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;sender, MouseButtonEventArgs e)<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;at System.Windows.CoreInvokeHandler.InvokeEventHandler(Int32<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;typeIndex,<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;Delegate handlerDelegate, Object sender, Object args)<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;unmanagedObjArgs, Int32 argsTypeIndex, String eventName)<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;? Hide<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;Debugging Output<BR>
&gt;<BR>
&gt;<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;Michael Foord<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;<a href="http://www.ironpythoninaction.com/">http://www.ironpythoninaction.com/</a><BR>
&gt;<BR>
&gt;<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;_______________________________________________<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;Users mailing list<BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;<a href="Users@lists.ironpython.com">Users@lists.ironpython.com</a><BR>
&gt; &nbsp;&nbsp;&nbsp;&nbsp;<a href="http://lists.ironpython.com/listinfo.cgi/users-ironpython.com">http://lists.ironpython.com/listinfo.cgi/users-ironpython.com</a><BR>
&gt;<BR>
&gt; ------------------------------------------------------------------------<BR>
&gt;<BR>
&gt; _______________________________________________<BR>
&gt; Users mailing list<BR>
&gt; <a href="Users@lists.ironpython.com">Users@lists.ironpython.com</a><BR>
&gt; <a href="http://lists.ironpython.com/listinfo.cgi/users-ironpython.com">http://lists.ironpython.com/listinfo.cgi/users-ironpython.com</a><BR>
&gt;<BR>
<BR>
<BR>
--<BR>
<a href="http://www.ironpythoninaction.com/">http://www.ironpythoninaction.com/</a><BR>
<a href="http://www.theotherdelia.co.uk/">http://www.theotherdelia.co.uk/</a><BR>
<a href="http://www.voidspace.org.uk/">http://www.voidspace.org.uk/</a><BR>
<a href="http://www.ironpython.info/">http://www.ironpython.info/</a><BR>
<a href="http://www.resolverhacks.net/">http://www.resolverhacks.net/</a><BR>
<BR>
_______________________________________________<BR>
Users mailing list<BR>
<a href="Users@lists.ironpython.com">Users@lists.ironpython.com</a><BR>
<a href="http://lists.ironpython.com/listinfo.cgi/users-ironpython.com">http://lists.ironpython.com/listinfo.cgi/users-ironpython.com</a><BR>
<BR>
</SPAN></FONT></BLOCKQUOTE>
</BODY>
</HTML>