I'm facing an issue with a click button event, when I press it the second time I get a the following exception:
Sys.InvalidOperationException: ManagedRuntimeError error #4004 in control 'Xaml1':
System.ArgumentException: Value does not fall within the expected range
at Ms.InternalXcpImports.MethodEx(IntPtr ptr, String name, CValue[] cvData)
Scenario:
I'm using a popup, inside that popup I have a user control.
In that use control I'm using a grid and let the user adding elements to it.
When the user press ok, I add a new control to the canvas (a table box).
The way to reproduce this error is playing with the grid (just adding elements), is there any well know bug on using the DataGrid? What's the best way to add / edit elements on the new RC0 DataGrid? We developers are a bit lost on this area.
Well... after researching a bit the issue beacuse I have replaced a listbox with the new combobox.
Not sure if the new combo is not quite stable, or maybe the installation package is not quite good (I cannot drag and drop a combo from the toolbox, but If I type it manually on the XAML I get intellisense from there).
Anybody is experiencing simliar "combo + popup" issues?
MS.Internal.WrappedException: Catastrophic failure (Excepción de HRESULT: 0x8000FFFF (E_UNEXPECTED)) ---> System.Exception: Catastrophic failure (Excepción de HRESULT: 0x8000FFFF (E_UNEXPECTED))
at MS.Internal.XcpImports.CheckHResult(UInt32 hr)
at MS.Internal.XcpImports.CreateObjectByTypeIndex(UInt32 typeIndex)
at System.Windows.DependencyObject..ctor(UInt32 nativeTypeIndex, IntPtr constructDO)
at System.Windows.DependencyObject..ctor(UInt32 nativeTypeIndex)
at MS.Internal.ManagedObjectReference..ctor()
at MS.Internal.ManagedObjectReference..ctor(Object target)
at MS.Internal.XcpImports.SetValue(INativeCoreTypeWrapper doh, DependencyProperty property, Object obj)
at System.Windows.DependencyObject.SetObjectValueToCore(DependencyProperty dp, Object value)
at System.Windows.DependencyObject.SetValueInternal(DependencyProperty dp, Object value, Boolean allowReadOnlySet, Boolean isSetByStyle, Boolean isSetByBuiltInStyle)
at System.Windows.DependencyObject.SetValueInternal(DependencyProperty dp, Object value)
at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value)
at System.Windows.Controls.Control.set_DefaultStyleKey(Object value)
at System.Windows.Controls.ItemsControl..ctor()
at System.Windows.CoreTypes.GetCoreWrapper(Int32 typeId)
at MS.Internal.ManagedPeerTable.EnsureManagedPeer(IntPtr unmanagedPointer, Int32 typeIndex, Type type, Boolean preserveManagedObjectReference)
at MS.Internal.ManagedPeerTable.EnsureManagedPeer(IntPtr unmanagedPointer, Int32 typeIndex, Type type)
at MS.Internal.FrameworkCallbacks.CreateManagedPeer(IntPtr element, Int32 typeIndex)
--- End of inner exception stack trace ---
at MS.Internal.XcpImports.CheckHResult(UInt32 hr)
at MS.Internal.XcpImports.NotifyHasManagedPeer(IntPtr context, Int32 iType, UInt32 isCustomType, UInt32 isGCRoot)
at System.Windows.DependencyObject..ctor(UInt32 nativeTypeIndex, IntPtr constructDO)
at System.Windows.DependencyObject..ctor(UInt32 nativeTypeIndex)
at System.Windows.ResourceDictionary..ctor()
at System.Windows.CoreTypes.GetCoreWrapper(Int32 typeId)
at MS.Internal.ManagedPeerTable.EnsureManagedPeer(IntPtr unmanagedPointer, Int32 typeIndex, Type type, Boolean preserveManagedObjectReference)
at MS.Internal.ManagedPeerTable.EnsureManagedPeer(IntPtr unmanagedPointer, Int32 typeIndex, Type type)
at MS.Internal.ManagedPeerTable.GetManagedPeer(IntPtr nativeObject)
at System.Windows.DependencyObject.AddReferenceTo(IntPtr nativeOwner, IntPtr nativeTarget)
If bind the combo only once when showing your popup, you can just add dynamically your popup to the tree. Then won't crash.
You can as well before each rebind on the combo just remove the once that is already there and create a new one with the same ID (and hook it up to your visual tree).
These are nasty tricks, but right now it seems that are the only way to fix this issue. I have used both approach, if you need it can post some code.
It's expected that a service patch will be release in some weeks, but no official news about that.
Whew! Glad it wasn't just me getting this error. I've tried everything on my end to figure it out, thinking it was "operator error". But I can reproduce this in so many ways with the combobox. Looking forward to the fix.
Is there an issue ticket on this that I can track?
Taking your remove/add workaround, I decided to remove the parent StackPanel that contained my buggy ComboBox and re-add it to my Page's LayoutRoot. That seems to solve it for that particular ComboBox and any other sibling ComboBoxes that might cause the
same problem.
Out of curiosity, I tried to instantiate the panel StackPanel within my Page's constructor. Then within the event code block that would cause the ArgumentException error, I removed the StackPanel from the LayoutRoot and added it (i.e. the same StackPanel
I instantiated in the Page's constructor) to the LayoutRoot. Still get the error. So the ComboBox
must be dropped/deconstructed/collected, rather than just detached/reattached to the thread.
Here's my code that works (in the simplest of terms):
public partial class Page : UserControl
{
// My newly created user control, with the buggy comboboxprivate MyPanelControl MyPanel = new MyPanelControl();
// removed code...private void EnterDataObject(MyDataObject dataObject)
{
MyPanel = new MyPanelControl();
MyPanel.DataContext = dataObject;
LayoutRoot.Children.Add(MyPanel);
}
private void ExitDataObject()
{
if (MyPanel != null)
{
// NOTE: Remove works whether an object exists or not
LayoutRoot.Children.Remove(MyPanel);
}
}
}
Unfortunately, I lose some of my cool dynamic effects. But at least the application doesn't crash, right? :)
Brauliod
Contributor
2392 Points
736 Posts
System.ArgumentException: Value does not fall within the expected range at Ms.InternalXcpImports....
Sep 28, 2008 11:42 AM | LINK
I'm facing an issue with a click button event, when I press it the second time I get a the following exception:
Sys.InvalidOperationException: ManagedRuntimeError error #4004 in control 'Xaml1':
System.ArgumentException: Value does not fall within the expected range
at Ms.InternalXcpImports.MethodEx(IntPtr ptr, String name, CValue[] cvData)
Scenario:
The way to reproduce this error is playing with the grid (just adding elements), is there any well know bug on using the DataGrid? What's the best way to add / edit elements on the new RC0 DataGrid? We developers are a bit lost on this area.
Thanks
Braulio
Free Silverlght Based Network Diagram Editor
Brauliod
Contributor
2392 Points
736 Posts
[Found the issue worth to research]Re: System.ArgumentException: Value does not fall within the e...
Sep 28, 2008 12:19 PM | LINK
Well... after researching a bit the issue beacuse I have replaced a listbox with the new combobox.
Not sure if the new combo is not quite stable, or maybe the installation package is not quite good (I cannot drag and drop a combo from the toolbox, but If I type it manually on the XAML I get intellisense from there).
Anybody is experiencing simliar "combo + popup" issues?
Thanks
Braulio
Free Silverlght Based Network Diagram Editor
Brauliod
Contributor
2392 Points
736 Posts
Re: More detail about the Exception...
Sep 28, 2008 12:23 PM | LINK
More Detail abou tthe exception...
MS.Internal.WrappedException: Catastrophic failure (Excepción de HRESULT: 0x8000FFFF (E_UNEXPECTED)) ---> System.Exception: Catastrophic failure (Excepción de HRESULT: 0x8000FFFF (E_UNEXPECTED))
at MS.Internal.XcpImports.CheckHResult(UInt32 hr)
at MS.Internal.XcpImports.CreateObjectByTypeIndex(UInt32 typeIndex)
at System.Windows.DependencyObject..ctor(UInt32 nativeTypeIndex, IntPtr constructDO)
at System.Windows.DependencyObject..ctor(UInt32 nativeTypeIndex)
at MS.Internal.ManagedObjectReference..ctor()
at MS.Internal.ManagedObjectReference..ctor(Object target)
at MS.Internal.XcpImports.SetValue(INativeCoreTypeWrapper doh, DependencyProperty property, Object obj)
at System.Windows.DependencyObject.SetObjectValueToCore(DependencyProperty dp, Object value)
at System.Windows.DependencyObject.SetValueInternal(DependencyProperty dp, Object value, Boolean allowReadOnlySet, Boolean isSetByStyle, Boolean isSetByBuiltInStyle)
at System.Windows.DependencyObject.SetValueInternal(DependencyProperty dp, Object value)
at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value)
at System.Windows.Controls.Control.set_DefaultStyleKey(Object value)
at System.Windows.Controls.ItemsControl..ctor()
at System.Windows.CoreTypes.GetCoreWrapper(Int32 typeId)
at MS.Internal.ManagedPeerTable.EnsureManagedPeer(IntPtr unmanagedPointer, Int32 typeIndex, Type type, Boolean preserveManagedObjectReference)
at MS.Internal.ManagedPeerTable.EnsureManagedPeer(IntPtr unmanagedPointer, Int32 typeIndex, Type type)
at MS.Internal.FrameworkCallbacks.CreateManagedPeer(IntPtr element, Int32 typeIndex)
--- End of inner exception stack trace ---
at MS.Internal.XcpImports.CheckHResult(UInt32 hr)
at MS.Internal.XcpImports.NotifyHasManagedPeer(IntPtr context, Int32 iType, UInt32 isCustomType, UInt32 isGCRoot)
at System.Windows.DependencyObject..ctor(UInt32 nativeTypeIndex, IntPtr constructDO)
at System.Windows.DependencyObject..ctor(UInt32 nativeTypeIndex)
at System.Windows.ResourceDictionary..ctor()
at System.Windows.CoreTypes.GetCoreWrapper(Int32 typeId)
at MS.Internal.ManagedPeerTable.EnsureManagedPeer(IntPtr unmanagedPointer, Int32 typeIndex, Type type, Boolean preserveManagedObjectReference)
at MS.Internal.ManagedPeerTable.EnsureManagedPeer(IntPtr unmanagedPointer, Int32 typeIndex, Type type)
at MS.Internal.ManagedPeerTable.GetManagedPeer(IntPtr nativeObject)
at System.Windows.DependencyObject.AddReferenceTo(IntPtr nativeOwner, IntPtr nativeTarget)
This didn't happened on Beta 2 :-(
Free Silverlght Based Network Diagram Editor
Brauliod
Contributor
2392 Points
736 Posts
Re: More detail about the Exception...
Sep 28, 2008 04:34 PM | LINK
More info about the Combo Crash inside a popup:
-
The popup and user control is declared inside the main XAML (I don't add it dynamically):
<Popup x:Name="popupAddTable" Width="600" Height="305"> <Dialogs:AddTableDlg x:Name="inAddTableDlg"/> </Popup>-
In order to show/hide the popup is Use IsOpen.
-
Everytime the popup is shown I just rebind the source:
"Description";cbAddTableDlgType.SelectedIndex = 0;
Free Silverlght Based Network Diagram Editor
Allen Chen –...
Star
13909 Points
1810 Posts
Microsoft
Re: More detail about the Exception...
Sep 30, 2008 09:01 AM | LINK
Hi,
Thanks for your reporting. It's a known issue that we're now investigating.
Allen Chen
Microsoft Online Community Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
chinna_g
Member
17 Points
66 Posts
Re: More detail about the Exception...
Nov 03, 2008 09:38 AM | LINK
Hi Braulio,
I am getting same issue. when i browse i have seen your BLOG , please let me know whether this problem is solved by MS.
Regards,
Chinna.
Brauliod
Contributor
2392 Points
736 Posts
Re: Re: More detail about the Exception...
Nov 03, 2008 06:09 PM | LINK
Hello Chinna,
You have two solutions for this issue:
These are nasty tricks, but right now it seems that are the only way to fix this issue. I have used both approach, if you need it can post some code.
It's expected that a service patch will be release in some weeks, but no official news about that.
HTH
Braulio
Free Silverlght Based Network Diagram Editor
deriven
Member
14 Points
9 Posts
Re: System.ArgumentException: Value does not fall within the expected range at Ms.InternalXcpImpo...
Nov 04, 2008 06:44 PM | LINK
Whew! Glad it wasn't just me getting this error. I've tried everything on my end to figure it out, thinking it was "operator error". But I can reproduce this in so many ways with the combobox. Looking forward to the fix.
Is there an issue ticket on this that I can track?
bug ComboBox known issue
Brauliod
Contributor
2392 Points
736 Posts
Re: Re: System.ArgumentException: Value does not fall within the expected range at Ms.InternalXcp...
Nov 04, 2008 06:54 PM | LINK
I'm not aware of any ticket :-(... waiting for the magic patch.
In the mean time if you need some help with the workaround just give me a shout.
Free Silverlght Based Network Diagram Editor
deriven
Member
14 Points
9 Posts
Re: Re: System.ArgumentException: Value does not fall within the expected range at Ms.InternalXcp...
Nov 04, 2008 09:16 PM | LINK
Taking your remove/add workaround, I decided to remove the parent StackPanel that contained my buggy ComboBox and re-add it to my Page's LayoutRoot. That seems to solve it for that particular ComboBox and any other sibling ComboBoxes that might cause the same problem.
Out of curiosity, I tried to instantiate the panel StackPanel within my Page's constructor. Then within the event code block that would cause the ArgumentException error, I removed the StackPanel from the LayoutRoot and added it (i.e. the same StackPanel I instantiated in the Page's constructor) to the LayoutRoot. Still get the error. So the ComboBox must be dropped/deconstructed/collected, rather than just detached/reattached to the thread.
Here's my code that works (in the simplest of terms):
Unfortunately, I lose some of my cool dynamic effects. But at least the application doesn't crash, right? :)
bug ComboBox known issue workaround