This is a migrated thread and some comments may be shown as answers.

Telerik RadContextMenu & MEF

3 Answers 123 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Razvan asked on 26 Apr 2011, 04:51 PM
I'm trying to develop a plugin system using MEF and i`m exporting controls from the plugin XAP to the main application. From the plugin, all resources used are in a resource dictionary also exported with MEF. When the plugin is imported the resource dictionary is added to the main's app resources (App.Current.Resources). All goes well, the controls function correctly when imported in the main app, but when trying to open any context menu the application crashes with the following stack trace:
Value does not fall within the expected range.
   at MS.Internal.XcpImports.MethodEx(IntPtr ptr, String name, CValue[] cvData)
   at MS.Internal.XcpImports.MethodPack(IntPtr objectPtr, String methodName, Object[] rawData)
   at MS.Internal.XcpImports.UIElement_TransformToVisual(UIElement element, UIElement visual)
   at System.Windows.UIElement.TransformToVisual(UIElement visual)
   at Telerik.Windows.Controls.RadContextMenu.OnIsOpenChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
   at System.Windows.DependencyObject.RaisePropertyChangeNotifications(DependencyProperty dp, Object oldValue, Object newValue)
   at System.Windows.DependencyObject.UpdateEffectiveValue(DependencyProperty property, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, ValueOperation operation)
   at System.Windows.DependencyObject.SetValueInternal(DependencyProperty dp, Object value, Boolean allowReadOnlySet)
   at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value)
   at Telerik.Windows.Controls.RadContextMenu.set_IsOpen(Boolean value)
   at Telerik.Windows.Controls.RadContextMenu.TriggerEventFired()
   at Telerik.Windows.Controls.RadContextMenu.OnEventTriggered(Object sender, EventArgs e)
   at Telerik.Windows.Controls.RadContextMenu.OnElementWithContextMenuMouseClick(Object sender, MouseButtonEventArgs 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)
The context menu is added like:
           <Editor_Views:ArrowEx X1="{Binding Start.PosX}"
                                       X2="{Binding End.PosX}"
                                       Y1="{Binding Start.PosY}"
                                       Y2="{Binding End.PosY}"
                                       LinkType="{Binding Model.LinkType,Mode=OneWay}"
                                       StartNodeWidth="{Binding Start.Width}"
                                       StartNodeHeight="{Binding Start.Height}"
                                       EndNodeWidth="{Binding End.Width}"
                                       EndNodeHeight="{Binding End.Height}"
                <telerik:RadContextMenu Visibility="{Binding CurrentState, Converter={StaticResource StateToVisibilityConverter}}">
                    <telerik:RadMenuItem Header="Delete"
                                         Command="{Binding DeleteCommand}">
                            <Image Source="/Editor;component/Assets/Icons/delete.png"
                                   Height="16" />
In the main app the control is added to an ItemsControl which resides in a child window. The main app has no knowledge whatsoever about what control comes from the plugin. All the logic is done in the plugin.
Saw the following post and i wonder if it's the same case .
If anyone has encountered this before or has any suggestions? Thank you.

3 Answers, 1 is accepted

Sort by
Top achievements
Rank 1
answered on 28 Apr 2011, 08:28 AM
Seems that the issue is easier to reproduce than i expected. Here  you can download the project that reproduces the issue. I need an answer soon as this is very important. Thank you.
Telerik team
answered on 28 Apr 2011, 09:02 PM
Hello Razvan,

This problem is resolved with our latest official release.
Please use 2011 Q1 SP1 assemblies.

Sorry for the caused inconvenience.

All the best,
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Top achievements
Rank 1
answered on 29 Apr 2011, 08:22 AM
Thank you. Downloaded the new assemblies and everything works as expected.
Asked by
Top achievements
Rank 1
Answers by
Top achievements
Rank 1
Telerik team
Share this question