Excel AddIn written in C#, .NET4.0, VS2010, When a ribbon is clicked, the exceptio is thrown.
In ribbon click event handler, I basically initialize a WPF window and ShowDialog
Name:InvalidOperationException
Message:Recursive call to Automation Peer API is not valid.
Target:System.Collections.Generic.List`1[System.Windows.Automation.Peers.AutomationPeer]
GetChildren()
Stack: at System.Windows.Automation.Peers.AutomationPeer.GetChildren()
at System.Windows.Automation.Peers.AutomationPeer.isDescendantOf(AutomationPeer
parent)
at System.Windows.Automation.Peers.AutomationPeer.isDescendantOf(AutomationPeer
parent)
at System.Windows.Automation.Peers.AutomationPeer.isDescendantOf(AutomationPeer
parent)
at System.Windows.Automation.Peers.AutomationPeer.isDescendantOf(AutomationPeer
parent)
at System.Windows.Automation.Peers.AutomationPeer.ValidateConnected(AutomationPeer
connectedPeer)
at MS.Internal.Automation.ElementProxy.StaticWrap(AutomationPeer peer,
AutomationPeer referencePeer)
at System.Windows.Automation.Peers.AutomationPeer.UpdateChildrenInternal(Int32
invalidateLimit)
at System.Windows.Automation.Peers.AutomationPeer.UpdateChildren()
at Microsoft.Windows.Automation.Peers.DataGridItemAutomationPeer.GetChildrenCore()
at System.Windows.Automation.Peers.AutomationPeer.EnsureChildren()
at System.Windows.Automation.Peers.AutomationPeer.GetChildren()
at System.Windows.Automation.Peers.AutomationPeer.isDescendantOf(AutomationPeer
parent)
at System.Windows.Automation.Peers.AutomationPeer.isDescendantOf(AutomationPeer
parent)
at System.Windows.Automation.Peers.AutomationPeer.isDescendantOf(AutomationPeer
parent)
at System.Windows.Automation.Peers.AutomationPeer.isDescendantOf(AutomationPeer
parent)
at System.Windows.Automation.Peers.AutomationPeer.ValidateConnected(AutomationPeer
connectedPeer)
at MS.Internal.Automation.ElementProxy.StaticWrap(AutomationPeer peer,
AutomationPeer referencePeer)
at System.Windows.Automation.Peers.AutomationPeer.ProviderFromPeer(AutomationPeer
peer)
at System.Windows.Automation.Peers.AutomationPeer.RaisePropertyChangedEvent(AutomationProperty
property, Object oldValue, Object newValue)
at Microsoft.Windows.Controls.DataGridRow.OnIsSelectedChanged(Object
sender, DependencyPropertyChangedEventArgs e)
at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs
e)
at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs
e)
at Microsoft.Windows.Controls.DataGridRow.OnPropertyChanged(DependencyPropertyChangedEventArgs
e)
at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs
args)
at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex
entryIndex, DependencyProperty dp, PropertyMetadata metadata,
EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean
coerceWithDeferredReference, Boolean coerceWithCurrentValue,
OperationType operationType)
at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp,
Object value, PropertyMetadata metadata, Boolean
coerceWithDeferredReference, Boolean coerceWithCurrentValue,
OperationType operationType, Boolean isInternal)
at System.Windows.DependencyObject.SetCurrentValueInternal(DependencyProperty
dp, Object value)
at System.Windows.Controls.Primitives.Selector.ItemSetIsSelected(Object
item, Boolean value)
at System.Windows.Controls.Primitives.Selector.OnGeneratorStatusChanged(Object
sender, EventArgs e)
at System.Windows.Controls.ItemContainerGenerator.SetStatus(GeneratorStatus
value)
at System.Windows.Controls.ItemContainerGenerator.Generator.System.IDisposable.Dispose()
at System.Windows.Controls.VirtualizingStackPanel.MeasureOverride(Size
constraint)
at Microsoft.Windows.Controls.Primitives.DataGridRowsPresenter.MeasureOverride(Size
constraint)
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at System.Windows.ContextLayoutManager.UpdateLayout()
at System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg)
at System.Windows.Media.MediaContext.InvokeOnRenderCallback.DoWork()
at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object
resizedCompositionTarget)
at System.Windows.Media.MediaContext.AnimatedRenderMessageHandler(Object
resizedCompositionTarget)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate
callback, Object args, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object
source, Delegate method, Object args, Int32 numArgs, Delegate
catchHandler)
at System.Windows.Threading.DispatcherOperation.InvokeImpl()
at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object
state)
at System.Threading.ExecutionContext.runTryCode(Object userData)
at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode
code, CleanupCode backoutCode, Object userData)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext
executionContext, ContextCallback callback, Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean
ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Windows.Threading.DispatcherOperation.Invoke()
at System.Windows.Threading.Dispatcher.ProcessQueue()
at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate
callback, Object args, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object
source, Delegate method, Object args, Int32 numArgs, Delegate
catchHandler)
at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority
priority, TimeSpan timeout, Delegate method, Object args, Int32
numArgs)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame
frame)
at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
at System.Windows.Window.ShowHelper(Object booleanBox)
at System.Windows.Window.Show()
at System.Windows.Window.ShowDialog()
at CommodityAddIn.Connect.ShowLaunchUI(Functions selectedFunction)
at CommodityAddIn.Connect.LIMSRBtnClick(CommandBarButton Ctrl, Boolean& CancelDefault)
No comments:
Post a Comment