<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2">
<meta name="Generator" content="Microsoft Word 12 (filtered medium)">
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";
        color:black;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";
        color:black;}
tt
        {mso-style-priority:99;
        font-family:"Courier New";}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Consolas;
        color:black;}
span.EmailStyle20
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
-->
</style><!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->
</head>
<body bgcolor="white" lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;
color:#1F497D">Does this only happen in debug mode?&nbsp; Do you have a class or a method named like Mountains.filtered.set (in other words do you have any idea of what this
 code is)?&nbsp; &nbsp;Or are you maybe deriving from a class named Mountains which has a set method?&nbsp;
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;
color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;
color:#1F497D">Ultimately what I&#8217;m getting at is it&#8217;d be good to run this on the desktop CLR and get the same method created.&nbsp; So if you can isolate the code then run it
 on the desktop you could run w/ the &#8211;X:SaveAssemblies option.&nbsp; That will write out the IL we generate to disk as a Snippets.scripting.dll and then you can run peverify on that and see if the generated code is actually unverifiable (or if maybe there&#8217;s a CLR
 bug related to verification).<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;
color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;
color:#1F497D">If there is actually unverifiable code then we have a bug we need to fix.&nbsp; If we have verifiable code or some difference between when we&#8217;re using RefEmit
 and DynamicMethods then maybe the CLR has a bug that needs to be fixed.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;
color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;;
color:windowtext">From:</span></b><span style="font-size:10.0pt;font-family:
&quot;Tahoma&quot;,&quot;sans-serif&quot;;color:windowtext"> users-bounces@lists.ironpython.com [mailto:users-bounces@lists.ironpython.com]
<b>On Behalf Of </b>Lukas Cenovsky<br>
<b>Sent:</b> Friday, September 03, 2010 9:04 AM<br>
<b>To:</b> Discussion of IronPython<br>
<b>Subject:</b> Re: [IronPython] Silverlight - Cannot save value from target back to source<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal">I am trying to debug this bug and I need some help.<br>
<br>
I have built IronPython 2.6.1 - Silverlight debug binaries. I have pointed VS 2010 symbols folder to the folder with these binaries.<br>
<br>
I run the Silverlight app in the debug mode (debug=true in index.html), attach VS 2010 debugger, select Thrown for
<i>Common Language Runtime Exceptions</i> and <i>Managed Debugging Assistants</i> in Debug - Exceptions dialog.<br>
<br>
All symbols are loaded, so I click on the checkbox button on the page. The following exception occurs:<br>
<br>
<tt><span style="font-size:10.0pt">System.Security.VerificationException occurred</span></tt><span style="font-size:10.0pt;font-family:&quot;Courier New&quot;"><br>
<tt>&nbsp; Message=Operation could destabilize the runtime.</tt><br>
<tt>&nbsp; StackTrace:</tt><br>
<tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at Mountains.filtered(Nullable`1 value)</tt><br>
<tt>&nbsp; InnerException: </tt></span><br>
<br>
No source available.This is the Call stack:<br>
<br>
<tt><span style="font-size:10.0pt">&gt;&nbsp;&nbsp;&nbsp; Snippets.scripting!Mountains.filtered.set(bool? value) &#43; 0x23 bytes&nbsp;&nbsp;&nbsp;
</span></tt><span style="font-size:10.0pt;font-family:
&quot;Courier New&quot;"><br>
<tt>&nbsp;&nbsp;&nbsp;&nbsp; [Native to Managed Transition]&nbsp;&nbsp;&nbsp; </tt><br>
<tt>&nbsp;&nbsp;&nbsp;&nbsp; [Managed to Native Transition]&nbsp;&nbsp;&nbsp; </tt><br>
<tt>&nbsp;&nbsp;&nbsp;&nbsp; System.Windows.dll!System.Windows.CLRPropertyListener.Value.set(object value) &#43; 0x23 bytes&nbsp;&nbsp;&nbsp;
</tt><br>
<tt>&nbsp;&nbsp;&nbsp;&nbsp; System.Windows.dll!System.Windows.PropertyAccessPathStep.Value.set(object value) &#43; 0x10 bytes&nbsp;&nbsp;&nbsp;
</tt><br>
<tt>&nbsp;&nbsp;&nbsp;&nbsp; System.Windows.dll!System.Windows.Data.BindingExpression.UpdateValue() &#43; 0x3b2 bytes&nbsp;&nbsp;&nbsp;
</tt><br>
<tt>&nbsp;&nbsp;&nbsp;&nbsp; System.Windows.dll!System.Windows.Data.BindingExpression.UpdateValueIfNecessary() &#43; 0x27 bytes&nbsp;&nbsp;&nbsp;
</tt><br>
<tt>&nbsp;&nbsp;&nbsp;&nbsp; System.Windows.dll!System.Windows.Data.BindingExpression.TargetPropertyChanged(System.Windows.DependencyObject sender, System.Windows.DependencyProperty dp) &#43; 0x2b bytes&nbsp;&nbsp;&nbsp;
</tt><br>
<tt>&nbsp;&nbsp;&nbsp;&nbsp; System.Windows.dll!System.Windows.DependencyObject.OnPropertyChanged(System.Windows.DependencyProperty dp) &#43; 0x17 bytes&nbsp;&nbsp;&nbsp;
</tt><br>
<tt>&nbsp;&nbsp;&nbsp;&nbsp; System.Windows.dll!System.Windows.FrameworkElement.OnPropertyChanged(System.Windows.DependencyProperty dp) &#43; 0x51 bytes&nbsp;&nbsp;&nbsp;
</tt><br>
<tt>&nbsp;&nbsp;&nbsp;&nbsp; System.Windows.dll!System.Windows.DependencyObject.RaisePropertyChangeNotifications(System.Windows.DependencyProperty dp, object oldValue, object newValue) &#43; 0x5c bytes&nbsp;&nbsp;&nbsp;
</tt><br>
<tt>&nbsp;&nbsp;&nbsp;&nbsp; System.Windows.dll!System.Windows.DependencyObject.UpdateEffectiveValue(System.Windows.DependencyProperty property, System.Windows.EffectiveValueEntry oldEntry, ref System.Windows.EffectiveValueEntry newEntry, System.Windows.DependencyObject.ValueOperation
 operation) &#43; 0xf6 bytes&nbsp;&nbsp;&nbsp; </tt><br>
<tt>&nbsp;&nbsp;&nbsp;&nbsp; System.Windows.dll!System.Windows.DependencyObject.SetValueInternal(System.Windows.DependencyProperty dp, object value, bool allowReadOnlySet) &#43; 0x1da bytes&nbsp;&nbsp;&nbsp;
</tt><br>
<tt>&nbsp;&nbsp;&nbsp;&nbsp; System.Windows.dll!System.Windows.Controls.Primitives.ToggleButton.OnToggle() &#43; 0x8d bytes&nbsp;&nbsp;&nbsp;
</tt><br>
<tt>&nbsp;&nbsp;&nbsp;&nbsp; System.Windows.dll!System.Windows.Controls.Primitives.ToggleButton.OnClick() &#43; 0xf bytes&nbsp;&nbsp;&nbsp;
</tt><br>
<tt>&nbsp;&nbsp;&nbsp;&nbsp; System.Windows.dll!System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(System.Windows.Input.MouseButtonEventArgs e) &#43; 0x8e bytes&nbsp;&nbsp;&nbsp;
</tt><br>
<tt>&nbsp;&nbsp;&nbsp;&nbsp; System.Windows.dll!System.Windows.Controls.Control.OnMouseLeftButtonUp(System.Windows.Controls.Control ctrl, System.EventArgs e) &#43; 0x31 bytes&nbsp;&nbsp;&nbsp;
</tt><br>
<tt>&nbsp;&nbsp;&nbsp;&nbsp; System.Windows.dll!MS.Internal.JoltHelper.FireEvent(System.IntPtr unmanagedObj, System.IntPtr unmanagedObjArgs, int argsTypeIndex, string eventName) &#43; 0x234 bytes&nbsp;&nbsp;&nbsp;
</tt><br>
<tt>&nbsp;&nbsp;&nbsp;&nbsp; [Appdomain Transition]&nbsp;&nbsp;&nbsp; </tt><br>
</span><br>
I click Step Into and another exception occurs:<br>
<br>
<tt><span style="font-size:10.0pt">System.Reflection.TargetInvocationException occurred</span></tt><span style="font-size:10.0pt;font-family:&quot;Courier New&quot;"><br>
<tt>&nbsp; Message=Exception has been thrown by the target of an invocation.</tt><br>
<tt>&nbsp; StackTrace:</tt><br>
<tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct&amp; sig, MethodAttributes methodAttributes, RuntimeType typeOwner)</tt><br>
<tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)</tt><br>
<tt>&nbsp; InnerException: System.TypeInitializationException</tt><br>
<tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Message=The type initializer for 'Microsoft.VisualStudio.DebuggerVisualizers.DebugViewerShim.DebugeeHost' threw an exception.</tt><br>
<tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TypeName=Microsoft.VisualStudio.DebuggerVisualizers.DebugViewerShim.DebugeeHost</tt><br>
<tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; InnerException: System.TypeLoadException</tt><br>
<tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Message=Could not load type 'System.MarshalByRefObject' from assembly 'mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'.</tt><br>
<tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; StackTrace:</tt><br>
<tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at Microsoft.VisualStudio.DebuggerVisualizers.DebugViewerShim.DebugeeHost..cctor()</tt><br>
<tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; InnerException: </tt></span><br>
<br>
Stepping further shows the System.Windows.Data error I posted below.<br>
<br>
Any ideas/hints? Thank you.<br>
<br>
--<br>
-- Lukáš<br>
<br>
<br>
On 2.9.2010 20:39, Lukas Cenovsky wrote: <o:p></o:p></p>
<p class="MsoNormal">&nbsp;Following my binding experiments in WPF, I tried to convert the sample into Silverlight and I hit another binding errors there.
<br>
<br>
When I bind anything else than string, I receive an error when the target value is changed and the source should be updated. This happens in all IronPython versions (2.6.1 on .Net 2.0 and 4, 2.7a1).
<br>
<br>
Here is the code I use (the whole source is attached): <br>
<br>
&nbsp;&nbsp;&nbsp; @property <br>
&nbsp;&nbsp;&nbsp; @clrtype.accepts() <br>
&nbsp;&nbsp;&nbsp; @clrtype.returns(System.Nullable[System.Boolean]) <br>
&nbsp;&nbsp;&nbsp; def filtered(self): <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return self._filtered <br>
<br>
&nbsp;&nbsp;&nbsp; @filtered.setter <br>
&nbsp;&nbsp;&nbsp; @clrtype.accepts(System.Nullable[System.Boolean]) <br>
&nbsp;&nbsp;&nbsp; @clrtype.returns() <br>
&nbsp;&nbsp;&nbsp; def filtered(self, value): <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self._filtered = value <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.OnPropertyChanged('filtered') <br>
<br>
As you can see I tried to use System.Nullable[System.Boolean] instead of bool but it did not help. I also tried to use converter and convert the value to this type (System.Nullable[System.Boolean](value)) but that did not help either. All resulted in the following
 exception for bool type. <br>
<br>
System.Windows.Data Error: Cannot save value from target back to source. BindingExpression: Path='filtered' DataItem='Mountains' (HashCode=2058916); target element is 'System.Windows.Controls.CheckBox' (Name=''); target property is 'IsChecked' (type 'System.Nullable`1[System.Boolean]')..
 System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---&gt; System.Security.VerificationException: Operation could destabilize the runtime.
<br>
&nbsp;&nbsp; at Mountains.filtered(Nullable`1 value) <br>
&nbsp;&nbsp; --- End of inner exception stack trace --- <br>
&nbsp;&nbsp; at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct&amp; sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
<br>
&nbsp;&nbsp; at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
<br>
&nbsp;&nbsp; at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
<br>
&nbsp;&nbsp; at System.Reflection.RuntimePropertyInfo.SetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture)
<br>
&nbsp;&nbsp; at System.Reflection.RuntimePropertyInfo.SetValue(Object obj, Object value, Object[] index)
<br>
&nbsp;&nbsp; at System.Windows.CLRPropertyListener.set_Value(Object value) <br>
&nbsp;&nbsp; at System.Windows.PropertyAccessPathStep.set_Value(Object value) <br>
&nbsp;&nbsp; at System.Windows.Data.BindingExpression.UpdateValue(). <br>
<br>
The similar exception is raised for float or System.Double. <br>
<br>
I have found an old issue similar to this: <a href="http://ironpython.codeplex.com/workitem/16831?ProjectName=ironpython">
http://ironpython.codeplex.com/workitem/16831?ProjectName=ironpython</a> <br>
<br>
Any workaround would be nice for this bug :-) <br>
<br>
-- <br>
-- Lukáš <br>
<br>
<o:p></o:p></p>
<pre><o:p>&nbsp;</o:p></pre>
<pre><o:p>&nbsp;</o:p></pre>
<pre>_______________________________________________<o:p></o:p></pre>
<pre>Users mailing list<o:p></o:p></pre>
<pre><a href="mailto:Users@lists.ironpython.com">Users@lists.ironpython.com</a><o:p></o:p></pre>
<pre><a href="http://lists.ironpython.com/listinfo.cgi/users-ironpython.com">http://lists.ironpython.com/listinfo.cgi/users-ironpython.com</a><o:p></o:p></pre>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
</div>
</body>
</html>