[IronPython] Silverlight - Cannot save value from target back to source

Dino Viehland dinov at microsoft.com
Fri Sep 3 19:11:54 CEST 2010


Does this only happen in debug mode?  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)?   Or are you maybe deriving from a class named Mountains which has a set method?

Ultimately what I'm getting at is it'd be good to run this on the desktop CLR and get the same method created.  So if you can isolate the code then run it on the desktop you could run w/ the -X:SaveAssemblies option.  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's a CLR bug related to verification).

If there is actually unverifiable code then we have a bug we need to fix.  If we have verifiable code or some difference between when we're using RefEmit and DynamicMethods then maybe the CLR has a bug that needs to be fixed.

From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Lukas Cenovsky
Sent: Friday, September 03, 2010 9:04 AM
To: Discussion of IronPython
Subject: Re: [IronPython] Silverlight - Cannot save value from target back to source

I am trying to debug this bug and I need some help.

I have built IronPython 2.6.1 - Silverlight debug binaries. I have pointed VS 2010 symbols folder to the folder with these binaries.

I run the Silverlight app in the debug mode (debug=true in index.html), attach VS 2010 debugger, select Thrown for Common Language Runtime Exceptions and Managed Debugging Assistants in Debug - Exceptions dialog.

All symbols are loaded, so I click on the checkbox button on the page. The following exception occurs:

System.Security.VerificationException occurred
  Message=Operation could destabilize the runtime.
  StackTrace:
       at Mountains.filtered(Nullable`1 value)
  InnerException:

No source available.This is the Call stack:

>    Snippets.scripting!Mountains.filtered.set(bool? value) + 0x23 bytes
     [Native to Managed Transition]
     [Managed to Native Transition]
     System.Windows.dll!System.Windows.CLRPropertyListener.Value.set(object value) + 0x23 bytes
     System.Windows.dll!System.Windows.PropertyAccessPathStep.Value.set(object value) + 0x10 bytes
     System.Windows.dll!System.Windows.Data.BindingExpression.UpdateValue() + 0x3b2 bytes
     System.Windows.dll!System.Windows.Data.BindingExpression.UpdateValueIfNecessary() + 0x27 bytes
     System.Windows.dll!System.Windows.Data.BindingExpression.TargetPropertyChanged(System.Windows.DependencyObject sender, System.Windows.DependencyProperty dp) + 0x2b bytes
     System.Windows.dll!System.Windows.DependencyObject.OnPropertyChanged(System.Windows.DependencyProperty dp) + 0x17 bytes
     System.Windows.dll!System.Windows.FrameworkElement.OnPropertyChanged(System.Windows.DependencyProperty dp) + 0x51 bytes
     System.Windows.dll!System.Windows.DependencyObject.RaisePropertyChangeNotifications(System.Windows.DependencyProperty dp, object oldValue, object newValue) + 0x5c bytes
     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) + 0xf6 bytes
     System.Windows.dll!System.Windows.DependencyObject.SetValueInternal(System.Windows.DependencyProperty dp, object value, bool allowReadOnlySet) + 0x1da bytes
     System.Windows.dll!System.Windows.Controls.Primitives.ToggleButton.OnToggle() + 0x8d bytes
     System.Windows.dll!System.Windows.Controls.Primitives.ToggleButton.OnClick() + 0xf bytes
     System.Windows.dll!System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(System.Windows.Input.MouseButtonEventArgs e) + 0x8e bytes
     System.Windows.dll!System.Windows.Controls.Control.OnMouseLeftButtonUp(System.Windows.Controls.Control ctrl, System.EventArgs e) + 0x31 bytes
     System.Windows.dll!MS.Internal.JoltHelper.FireEvent(System.IntPtr unmanagedObj, System.IntPtr unmanagedObjArgs, int argsTypeIndex, string eventName) + 0x234 bytes
     [Appdomain Transition]

I click Step Into and another exception occurs:

System.Reflection.TargetInvocationException occurred
  Message=Exception has been thrown by the target of an invocation.
  StackTrace:
       at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
       at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
  InnerException: System.TypeInitializationException
       Message=The type initializer for 'Microsoft.VisualStudio.DebuggerVisualizers.DebugViewerShim.DebugeeHost' threw an exception.
       TypeName=Microsoft.VisualStudio.DebuggerVisualizers.DebugViewerShim.DebugeeHost
       InnerException: System.TypeLoadException
            Message=Could not load type 'System.MarshalByRefObject' from assembly 'mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'.
            StackTrace:
                 at Microsoft.VisualStudio.DebuggerVisualizers.DebugViewerShim.DebugeeHost..cctor()
            InnerException:

Stepping further shows the System.Windows.Data error I posted below.

Any ideas/hints? Thank you.

--
-- Lukáš


On 2.9.2010 20:39, Lukas Cenovsky wrote:
 Following my binding experiments in WPF, I tried to convert the sample into Silverlight and I hit another binding errors there.

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).

Here is the code I use (the whole source is attached):

    @property
    @clrtype.accepts()
    @clrtype.returns(System.Nullable[System.Boolean])
    def filtered(self):
        return self._filtered

    @filtered.setter
    @clrtype.accepts(System.Nullable[System.Boolean])
    @clrtype.returns()
    def filtered(self, value):
        self._filtered = value
        self.OnPropertyChanged('filtered')

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.

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. ---> System.Security.VerificationException: Operation could destabilize the runtime.
   at Mountains.filtered(Nullable`1 value)
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Reflection.RuntimePropertyInfo.SetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture)
   at System.Reflection.RuntimePropertyInfo.SetValue(Object obj, Object value, Object[] index)
   at System.Windows.CLRPropertyListener.set_Value(Object value)
   at System.Windows.PropertyAccessPathStep.set_Value(Object value)
   at System.Windows.Data.BindingExpression.UpdateValue().

The similar exception is raised for float or System.Double.

I have found an old issue similar to this: http://ironpython.codeplex.com/workitem/16831?ProjectName=ironpython

Any workaround would be nice for this bug :-)

--
-- Lukáš






_______________________________________________

Users mailing list

Users at lists.ironpython.com<mailto:Users at lists.ironpython.com>

http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20100903/79d933cb/attachment.html>


More information about the Ironpython-users mailing list