Telerik GridViewPinButton visibility in RadGridView - wpf

I've encountered a strange issue regarding the GridViewPinButton visibility in RadGridView.
My only wish is to disable this functionality- to set the GridViewPinButton visibility to collapse in every row in RadGridView.
Now, I have one place where it works great and another one where I can see this button while I'm hovering the rows.
In both places I haven't written any code concerning the GridViewPinButton , and in both cases the visibility of the button is set to collapsed by default.
The only difference I can see is in snoop :
When it works well, GridViewPinButton does not have any child elements:
while it has them in the second case (where it does not work well):
When I click the button, I get the error:
Could not find any resources appropriate for the specified culture or the neutral culture. Make sure Telerik.Windows.Controls.GridView.Strings.resources was correctly embedded or linked into assembly Telerik.Windows.Controls.GridView at compile time, or that all the satellite assemblies required are loadable and fully signed.
Stack trace is attached:
at System.Resources.ManifestBasedResourceGroveler.HandleResourceStreamMissing(String fileName)
at System.Resources.ManifestBasedResourceGroveler.GrovelForResourceSet(CultureInfo culture, Dictionary2 localResourceSets, Boolean tryParents, Boolean createIfNotExists, StackCrawlMark& stackMark)
at System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo requestedCulture, Boolean createIfNotExists, Boolean tryParents, StackCrawlMark& stackMark)
at System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo culture, Boolean createIfNotExists, Boolean tryParents)
at System.Resources.ResourceManager.GetString(String name, CultureInfo culture)
at Telerik.Windows.Controls.GridView.GridViewItemContainerGenerator.GetBlockAndPosition(Object item, Boolean deletedFromItems, GeneratorPosition& position, ItemBlock& block, Int32& offsetFromBlockStart, Int32& correctIndex)
at Telerik.Windows.Controls.GridView.GridViewItemContainerGenerator.OnItemReplaced(Object oldItem, Object newItem, Int32 index)
at Telerik.Windows.Controls.GridView.GridViewItemContainerGenerator.OnCollectionChanged(Object sender, NotifyCollectionChangedEventArgs args)
at Telerik.Windows.Controls.GridView.GridViewItemContainerGenerator.System.Windows.IWeakEventListener.ReceiveWeakEvent(Type managerType, Object sender, EventArgs e)
at System.Windows.WeakEventManager.ListenerList.DeliverEvent(Listener& listener, Object sender, EventArgs args, Type managerType)
at System.Windows.WeakEventManager.ListenerList1.DeliverEvent(Object sender, EventArgs e, Type managerType)
at System.Windows.WeakEventManager.DeliverEventToList(Object sender, EventArgs args, ListenerList list)
at System.Windows.WeakEventManager.DeliverEvent(Object sender, EventArgs args)
at System.Collections.Specialized.NotifyCollectionChangedEventHandler.Invoke(Object sender, NotifyCollectionChangedEventArgs e)
at Telerik.Windows.Data.DataItemCollection.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
at Telerik.Windows.Data.DataItemCollection.OnPinnedItemsCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e)
at System.Collections.Specialized.NotifyCollectionChangedEventHandler.Invoke(Object sender, NotifyCollectionChangedEventArgs e)
at System.Collections.ObjectModel.ObservableCollection1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
at Telerik.Windows.Data.DataItemCollection.AddToPinnedItems(Object item)
at System.Windows.Input.CommandBinding.OnExecuted(Object sender, ExecutedRoutedEventArgs e)
at System.Windows.Input.CommandManager.ExecuteCommandBinding(Object sender, ExecutedRoutedEventArgs e, CommandBinding commandBinding)
at System.Windows.Input.CommandManager.FindCommandBinding(CommandBindingCollection commandBindings, Object sender, RoutedEventArgs e, ICommand command, Boolean execute)
at System.Windows.Input.CommandManager.FindCommandBinding(Object sender, RoutedEventArgs e, ICommand command, Boolean execute)
at System.Windows.Input.CommandManager.OnExecuted(Object sender, ExecutedRoutedEventArgs e)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.Input.RoutedCommand.ExecuteImpl(Object parameter, IInputElement target, Boolean userInitiated)
at System.Windows.Input.CommandManager.TransferEvent(IInputElement newSource, ExecutedRoutedEventArgs e)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.Input.RoutedCommand.ExecuteImpl(Object parameter, IInputElement target, Boolean userInitiated)
at System.Windows.Controls.Button.OnClick()
at Telerik.Windows.Controls.RadButton.OnClick()
at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
at System.Windows.Input.InputManager.ProcessStagingArea()
at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at System.Windows.Interop.HwndSource.InputFilterMessage(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)

Set
RowIndicatorVisibility="Collapsed"
on your RadGridView

Related

Touch, Framework 4.7, multiple windows & Windows Creator Update

Since Windows 10 creator update, we have a touch compliant WPF App that crashes:
Crash occurs when we are moving from one window to another on a touch action.
Here is the revelant part of the stack :
Source : PresentationCore
System.NullReferenceException: Object reference not set to an instance of an object.
at System.Windows.Input.StylusWisp.WispStylusDevice.get_TabletDevice()
at System.Windows.Input.StylusTouchDeviceBase..ctor(StylusDeviceBase stylusDevice)
at System.Windows.Input.StylusWisp.WispLogic.PromoteMainToMouse(StagingAreaInputItem stagingItem)
at System.Windows.Input.StylusWisp.WispLogic.PromoteStoredItemsToMouse(WispStylusTouchDevice touchDevice)
at System.Windows.Input.StylusWisp.WispStylusTouchDevice.OnManipulationEnded(Boolean cancel)
at System.Windows.Input.ManipulationDevice.OnManipulationCancel()
at System.Windows.Input.InputManager.RaiseProcessInputEventHandlers(ProcessInputEventHandler postProcessInput, ProcessInputEventArgs processInputEventArgs)
at System.Windows.Input.InputManager.ProcessStagingArea()
at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
at System.Windows.Input.ManipulationLogic.ReportFrame(ICollection`1 manipulators)
at System.Windows.Input.ManipulationDevice.ReportFrame()
at System.Windows.Input.ManipulationDevice.RemoveManipulator(IManipulator manipulator)
at System.Windows.Input.Manipulation.TryRemoveManipulator(UIElement element, IManipulator manipulator)
at System.Windows.Input.TouchDevice.PromoteMainToManipulation(UIElement manipulatableElement, TouchEventArgs touchEventArgs)
at System.Windows.Input.TouchDevice.PostProcessInput(Object sender, ProcessInputEventArgs e)
at System.Windows.Input.InputManager.RaiseProcessInputEventHandlers(ProcessInputEventHandler postProcessInput, ProcessInputEventArgs processInputEventArgs)
at System.Windows.Input.InputManager.ProcessStagingArea()
at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
at System.Windows.Input.TouchDevice.Capture(IInputElement element, CaptureMode captureMode)
at System.Windows.Input.TouchDevice.PromoteMainToManipulation(UIElement manipulatableElement, TouchEventArgs touchEventArgs)
at System.Windows.Input.TouchDevice.PostProcessInput(Object sender, ProcessInputEventArgs e)
at System.Windows.Input.InputManager.RaiseProcessInputEventHandlers(ProcessInputEventHandler postProcessInput, ProcessInputEventArgs processInputEventArgs)
at System.Windows.Input.InputManager.ProcessStagingArea()
at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
at System.Windows.Input.TouchDevice.RaiseTouchUp()
at System.Windows.Input.TouchDevice.ReportUp()
at System.Windows.Input.StylusWisp.WispLogic.PromoteMainUpToTouch(WispStylusDevice stylusDevice, StagingAreaInputItem stagingItem)
at System.Windows.Input.StylusWisp.WispLogic.PromoteMainToTouch(ProcessInputEventArgs e, StylusEventArgs stylusEventArgs)
at System.Windows.Input.StylusWisp.WispLogic.PostProcessInput(Object sender, ProcessInputEventArgs e)
at System.Windows.Input.InputManager.RaiseProcessInputEventHandlers(ProcessInputEventHandler postProcessInput, ProcessInputEventArgs processInputEventArgs)
at System.Windows.Input.InputManager.ProcessStagingArea()
at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
at System.Windows.Input.StylusWisp.WispLogic.InputManagerProcessInput(Object oInput)
at System.Windows.Input.StylusWisp.WispLogic.PreProcessInput(Object sender, PreProcessInputEventArgs e)
at System.Windows.Input.InputManager.ProcessStagingArea()
at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at System.Windows.Interop.HwndSource.InputFilterMessage(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 System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(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.Window.ShowHelper(Object booleanBox)
at System.Windows.Window.ShowDialog()
...
Let me be precise, the product is perfectly working on windows 7/8/8.1/10(non creator) and we do not use any Wacom or stylus device except our finger :)
If you have any idea, let me know and i will test it.

WPF UI thread blocks inside BindingList.OnListChanged

I am having a strange problem where occasionally my WPF application deadlocks (blocks forever) inside BindingList<>.OnListChanged() call.
I created my own class, a child of BindingList
public class SortableBindingList<tItem> : BindingList<tItem>
{
//I provide an implementation of ApplySortCore so that the list can be sorted
protected override void ApplySortCore(PropertyDescriptor aProp,
ListSortDirection aDirection)
{
//
// I perform sorting here by copying items into a different list, sorting
// and copying back: this[index] = (tItem)(sortedList[index])
//
// Raise the ListChanged event so bound controls refresh their
// values.
OnListChanged(new ListChangedEventArgs(ListChangedType.Reset, -1));
}
}
The problem occurs deep inside OnListChanged(). The UI thread blocks forever waiting on something.
WindowsBase.dll!System.Windows.Threading.DispatcherSynchronizationContext.Wait(System.IntPtr[] waitHandles, bool waitAll, int millisecondsTimeout) Unknown
mscorlib.dll!System.Threading.SynchronizationContext.InvokeWaitMethodHelper(System.Threading.SynchronizationContext syncContext, System.IntPtr[] waitHandles, bool waitAll, int millisecondsTimeout) Unknown
[Native to Managed Transition]
PresentationFramework.dll!System.Windows.SystemResources.FindResourceInternal(object key, bool allowDeferredResourceReference, bool mustReturnDeferredResourceReference) Unknown
PresentationFramework.dll!System.Windows.FrameworkElement.FindResourceInternal(System.Windows.FrameworkElement fe, System.Windows.FrameworkContentElement fce, System.Windows.DependencyProperty dp, object resourceKey, object unlinkedParent, bool allowDeferredResourceReference, bool mustReturnDeferredResourceReference, System.Windows.DependencyObject boundaryElement, bool isImplicitStyleLookup, out object source) Unknown
PresentationFramework.dll!System.Windows.StyleHelper.GetChildValueHelper(System.Windows.UncommonField<System.Collections.Specialized.HybridDictionary[]> dataField, ref MS.Utility.ItemStructList<System.Windows.ChildValueLookup> valueLookupList, System.Windows.DependencyProperty dp, System.Windows.DependencyObject container, MS.Internal.FrameworkObject child, int childIndex, bool styleLookup, ref System.Windows.EffectiveValueEntry entry, out System.Windows.ValueLookupType sourceType, System.Windows.FrameworkElementFactory templateRoot) Unknown
PresentationFramework.dll!System.Windows.StyleHelper.GetChildValue(System.Windows.UncommonField<System.Collections.Specialized.HybridDictionary[]> dataField, System.Windows.DependencyObject container, int childIndex, MS.Internal.FrameworkObject child, System.Windows.DependencyProperty dp, ref MS.Utility.FrugalStructList<System.Windows.ChildRecord> childRecordFromChildIndex, ref System.Windows.EffectiveValueEntry entry, out System.Windows.ValueLookupType sourceType, System.Windows.FrameworkElementFactory templateRoot) Unknown
PresentationFramework.dll!System.Windows.StyleHelper.GetValueFromStyleOrTemplate(MS.Internal.FrameworkObject fo, System.Windows.DependencyProperty dp, ref System.Windows.EffectiveValueEntry entry) Unknown
PresentationFramework.dll!System.Windows.FrameworkElement.GetRawValue(System.Windows.DependencyProperty dp, System.Windows.PropertyMetadata metadata, ref System.Windows.EffectiveValueEntry entry) Unknown
PresentationFramework.dll!System.Windows.FrameworkElement.EvaluateBaseValueCore(System.Windows.DependencyProperty dp, System.Windows.PropertyMetadata metadata, ref System.Windows.EffectiveValueEntry newEntry) Unknown
WindowsBase.dll!System.Windows.DependencyObject.EvaluateEffectiveValue(System.Windows.EntryIndex entryIndex, System.Windows.DependencyProperty dp, System.Windows.PropertyMetadata metadata, System.Windows.EffectiveValueEntry oldEntry, System.Windows.EffectiveValueEntry newEntry, System.Windows.OperationType operationType) Unknown
WindowsBase.dll!System.Windows.DependencyObject.UpdateEffectiveValue(System.Windows.EntryIndex entryIndex, System.Windows.DependencyProperty dp, System.Windows.PropertyMetadata metadata, System.Windows.EffectiveValueEntry oldEntry, ref System.Windows.EffectiveValueEntry newEntry, bool coerceWithDeferredReference, bool coerceWithCurrentValue, System.Windows.OperationType operationType) Unknown
WindowsBase.dll!System.Windows.DependencyObject.InvalidateProperty(System.Windows.DependencyProperty dp, bool preserveCurrentValue) Unknown
PresentationFramework.dll!System.Windows.StyleHelper.InvalidateResourceDependents(System.Windows.DependencyObject container, System.Windows.ResourcesChangeInfo info, ref MS.Utility.FrugalStructList<System.Windows.ChildPropertyDependent> resourceDependents, bool invalidateVisualTreeToo) Unknown
PresentationFramework.dll!System.Windows.TreeWalkHelper.InvalidateStyleAndReferences(System.Windows.DependencyObject d, System.Windows.ResourcesChangeInfo info, bool containsTypeOfKey) Unknown
PresentationFramework.dll!System.Windows.TreeWalkHelper.OnResourcesChanged(System.Windows.DependencyObject d, System.Windows.ResourcesChangeInfo info, bool raiseResourceChangedEvent) Unknown
PresentationFramework.dll!System.Windows.FrameworkElement.OnAncestorChangedInternal(System.Windows.TreeChangeInfo parentTreeState) Unknown
PresentationFramework.dll!System.Windows.TreeWalkHelper.OnAncestorChanged(System.Windows.DependencyObject d, System.Windows.TreeChangeInfo info, bool visitedViaVisualTree) Unknown
PresentationFramework.dll!System.Windows.DescendentsWalker<System.Windows.TreeChangeInfo>.StartWalk(System.Windows.DependencyObject startNode, bool skipStartNode) Unknown
PresentationFramework.dll!MS.Internal.PrePostDescendentsWalker<System.Windows.TreeChangeInfo>.StartWalk(System.Windows.DependencyObject startNode, bool skipStartNode) Unknown
PresentationFramework.dll!System.Windows.TreeWalkHelper.InvalidateOnTreeChange(System.Windows.FrameworkElement fe, System.Windows.FrameworkContentElement fce, System.Windows.DependencyObject parent, bool isAddOperation) Unknown
PresentationFramework.dll!System.Windows.FrameworkElement.OnVisualParentChanged(System.Windows.DependencyObject oldParent) Unknown
PresentationCore.dll!System.Windows.Media.Visual.FireOnVisualParentChanged(System.Windows.DependencyObject oldParent) Unknown
PresentationCore.dll!System.Windows.Media.Visual.RemoveVisualChild(System.Windows.Media.Visual child) Unknown
PresentationCore.dll!System.Windows.Media.VisualCollection.DisconnectChild(int index) Unknown
PresentationCore.dll!System.Windows.Media.VisualCollection.Clear() Unknown
PresentationFramework.dll!System.Windows.Controls.UIElementCollection.ClearInternal() Unknown
PresentationFramework.dll!System.Windows.Controls.Panel.ClearChildren() Unknown
PresentationFramework.dll!System.Windows.Controls.Panel.EnsureEmptyChildren(System.Windows.FrameworkElement logicalParent) Unknown
PresentationFramework.dll!System.Windows.Controls.Panel.OnItemsChangedInternal(object sender, System.Windows.Controls.Primitives.ItemsChangedEventArgs args) Unknown
PresentationFramework.dll!System.Windows.Controls.VirtualizingPanel.OnItemsChangedInternal(object sender, System.Windows.Controls.Primitives.ItemsChangedEventArgs args) Unknown
PresentationFramework.dll!System.Windows.Controls.Panel.OnItemsChanged(object sender, System.Windows.Controls.Primitives.ItemsChangedEventArgs args) Unknown
PresentationFramework.dll!System.Windows.Controls.ItemContainerGenerator.OnRefresh() Unknown
PresentationFramework.dll!System.Windows.Controls.ItemContainerGenerator.OnCollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs args) Unknown
WindowsBase.dll!System.Windows.WeakEventManager.ListenerList<System.Collections.Specialized.NotifyCollectionChangedEventArgs>.DeliverEvent(object sender, System.EventArgs e, System.Type managerType) Unknown
WindowsBase.dll!System.Windows.WeakEventManager.DeliverEvent(object sender, System.EventArgs args) Unknown
WindowsBase.dll!System.Collections.Specialized.CollectionChangedEventManager.OnCollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs args) Unknown
PresentationFramework.dll!System.Windows.Data.CollectionView.OnCollectionChanged(System.Collections.Specialized.NotifyCollectionChangedEventArgs args) Unknown
PresentationFramework.dll!System.Windows.Controls.ItemCollection.OnViewCollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) Unknown
WindowsBase.dll!System.Windows.WeakEventManager.ListenerList<System.Collections.Specialized.NotifyCollectionChangedEventArgs>.DeliverEvent(object sender, System.EventArgs e, System.Type managerType) Unknown
WindowsBase.dll!System.Windows.WeakEventManager.DeliverEvent(object sender, System.EventArgs args) Unknown
WindowsBase.dll!System.Collections.Specialized.CollectionChangedEventManager.OnCollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs args) Unknown
PresentationFramework.dll!System.Windows.Data.CollectionView.OnCollectionChanged(System.Collections.Specialized.NotifyCollectionChangedEventArgs args) Unknown
PresentationFramework.dll!System.Windows.Data.BindingListCollectionView.RefreshOverride() Unknown
PresentationFramework.dll!System.Windows.Data.CollectionView.RefreshInternal() Unknown
PresentationFramework.dll!System.Windows.Data.CollectionView.RefreshOrDefer() Unknown
PresentationFramework.dll!System.Windows.Data.BindingListCollectionView.OnListChanged(object sender, System.ComponentModel.ListChangedEventArgs args) Unknown
System.dll!System.ComponentModel.BindingList<System.__Canon>.OnListChanged(System.ComponentModel.ListChangedEventArgs e) Unknown
I cannot figure out why it would block. I only access this list on the UI thread, not any other thread.
Thank you very much for any info.
I don't think you need to do this
// Raise the ListChanged event so bound controls refresh their
// values.
OnListChanged(new ListChangedEventArgs(ListChangedType.Reset, -1));
Remove that one, BindingList. The UI should listen to updates like Sorting, Searching, Add, etc.

MS Access 2013: Attempted to read or write protected memory. This is often an indication that other memory is corrupt

We are running windows 8 64 bit and MS Office 2013 64 bit on a virtual machine. I got this error when I am trying to query the access database with parameters in the query string. The stack trace is:
at System.Data.Common.UnsafeNativeMethods.ICommandText.Execute(IntPtr pUnkOuter, Guid& riid, tagDBPARAMS pDBParams, IntPtr& pcRowsAffected, Object& ppRowset)
at System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method)
at System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior)
at _64AccessTest.MainWindow.Button_Click_1(Object sender, RoutedEventArgs e) in c:\Users\xiaosu\Documents\Visual Studio 2012\Projects\64AccessTest\64AccessTest\MainWindow.xaml.cs:line 110
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.Controls.Button.OnClick()
at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
at System.Windows.Input.InputManager.ProcessStagingArea()
at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at System.Windows.Interop.HwndSource.InputFilterMessage(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.LegacyInvokeImpl(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.Application.RunInternal(Window window)
at System.Windows.Application.Run()
at _64AccessTest.App.Main() in c:\Users\xiaosu\Documents\Visual Studio 2012\Projects\64AccessTest\64AccessTest\obj\Debug\App.g.cs:line 0
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
I have got the following code:
var connectionString = #"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\temp\templates\64Access.accdb;Persist Security Info=False;";
using (OleDbConnection connection = new OleDbConnection(connectionString))
{
connection.Open();
const String query = "PARAMETERS #Id LONG; select * from Subject where Id = #Id";
OleDbCommand _command = new OleDbCommand(query, connection);
_command.Parameters.Add("#Id", OleDbType.Integer);
_command.Parameters["#Id"].Value = 1;
using (OleDbDataReader reader = _command.ExecuteReader()){
......
}
}
The exception occurs at this line: using (OleDbDataReader reader = _command.ExecuteReader()
We are running .NET 4 with Visual Studio 2012 and this is a WPF application.
The wired thing is if I do not pass parameters to the sql query, it works fine. Once the query has some parameters, the error occurs.
In Visual Studio, the platform is set to AnyCPU which is what we want. We do not want to change this to x86.
Thanks for the help.

WPF ScrollViewer - Width and Height must be non-negative

Every now and again an app throws a 'width and height must be non-negative' error
Width and Height must be non-negative.
at System.Windows.Size..ctor(Double width, Double height)
at System.Windows.Controls.ScrollViewer.OnLayoutUpdated(Object sender, EventArgs e)
at System.Windows.ContextLayoutManager.fireLayoutUpdateEvent()
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.RenderMessageHandler(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)
Nothing changes (window size...) and it seems that it is caught outside the normal sub.. Any ideas?
Thanks

Telerik Reporting inside a WPF MAF (System.Addin) control

I am using MAF (System.Addin) to display a WPF control onto a shared main form. When I add the telerik reportviewer I am getting a exception that I am trying to access a different thread then the one that owns the control. If you look through the exception stack you can see a reference to Application.Mainwindow however, since I am in a Addin the application mainwindow does not belong to my domain.
Is there a way to set the Application.Mainwindow inside of a Addin object?
System.Windows.Markup.XamlParseException occurred
Message=Cannot create instance of 'RadSlider' defined in assembly 'Telerik.Windows.Controls, Version=2010.3.1110.35, Culture=neutral, PublicKeyToken=5803cfa389c90ce7'. Exception has been thrown by the target of an invocation. Error at object 'System.Windows.Controls.StackPanel' in markup file 'Telerik.ReportViewer.Wpf;component/Themes/Default/ReportViewer.xaml'.
Source=PresentationFramework
LineNumber=0
LinePosition=0
NameContext=87_T
StackTrace:
at System.Windows.Markup.XamlParseException.ThrowException(String message, Exception innerException, Int32 lineNumber, Int32 linePosition, Uri baseUri, XamlObjectIds currentXamlObjectIds, XamlObjectIds contextXamlObjectIds, Type objectType)
at System.Windows.Markup.XamlParseException.ThrowException(ParserContext parserContext, Int32 lineNumber, Int32 linePosition, String message, Exception innerException)
at System.Windows.Markup.BamlRecordReader.ThrowExceptionWithLine(String message, Exception innerException)
at System.Windows.Markup.BamlRecordReader.CreateInstanceFromType(Type type, Int16 typeId, Boolean throwOnFail)
at System.Windows.Markup.BamlRecordReader.GetElementAndFlags(BamlElementStartRecord bamlElementStartRecord, Object& element, ReaderFlags& flags, Type& delayCreatedType, Int16& delayCreatedTypeId)
at System.Windows.Markup.BamlRecordReader.BaseReadElementStartRecord(BamlElementStartRecord bamlElementRecord)
at System.Windows.Markup.BamlRecordReader.ReadElementStartRecord(BamlElementStartRecord bamlElementRecord)
at System.Windows.Markup.BamlRecordReader.ReadRecord(BamlRecord bamlRecord)
at System.Windows.StyleHelper.LoadOptimizedTemplateContent(DependencyObject container, ParserContext parserContext, OptimizedTemplateContent optimizedTemplateContent, FrameworkTemplate frameworkTemplate, IComponentConnector componentConnector, IStyleConnector styleConnector, List`1 affectedChildren, UncommonField`1 templatedNonFeChildrenField)
at System.Windows.FrameworkTemplate.LoadContent(DependencyObject container, List`1 affectedChildren, UncommonField`1 templatedNonFeChildrenField)
at System.Windows.StyleHelper.ApplyTemplateContent(UncommonField`1 dataField, DependencyObject container, FrameworkElementFactory templateRoot, Int32 lastChildIndex, HybridDictionary childIndexFromChildID, FrameworkTemplate frameworkTemplate)
at System.Windows.FrameworkTemplate.ApplyTemplateContent(UncommonField`1 templateDataField, FrameworkElement container)
at System.Windows.FrameworkElement.ApplyTemplate()
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
at System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at System.Windows.Controls.Border.MeasureOverride(Size constraint)
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at System.Windows.Controls.Control.MeasureOverride(Size constraint)
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at System.Windows.Controls.DockPanel.MeasureOverride(Size constraint)
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at System.Windows.Controls.Decorator.MeasureOverride(Size constraint)
at System.Windows.Documents.AdornerDecorator.MeasureOverride(Size constraint)
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at System.Windows.Interop.HwndSource.SetLayoutSize()
at System.Windows.Interop.HwndSource.set_RootVisualInternal(Visual value)
at System.Windows.Interop.HwndSource.set_RootVisual(Visual value)
at System.Windows.Forms.Integration.ElementHost.OnHandleCreated(EventArgs e)
at System.Windows.Forms.Control.WmCreate(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.Integration.ElementHost.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.IntCreateWindowEx(Int32 dwExStyle, String lpszClassName, String lpszWindowName, Int32 style, Int32 x, Int32 y, Int32 width, Int32 height, HandleRef hWndParent, HandleRef hMenu, HandleRef hInst, Object pvParam)
at System.Windows.Forms.UnsafeNativeMethods.CreateWindowEx(Int32 dwExStyle, String lpszClassName, String lpszWindowName, Int32 style, Int32 x, Int32 y, Int32 width, Int32 height, HandleRef hWndParent, HandleRef hMenu, HandleRef hInst, Object pvParam)
at System.Windows.Forms.NativeWindow.CreateHandle(CreateParams cp)
at System.Windows.Forms.Control.CreateHandle()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.IntCreateWindowEx(Int32 dwExStyle, String lpszClassName, String lpszWindowName, Int32 style, Int32 x, Int32 y, Int32 width, Int32 height, HandleRef hWndParent, HandleRef hMenu, HandleRef hInst, Object pvParam)
at System.Windows.Forms.UnsafeNativeMethods.CreateWindowEx(Int32 dwExStyle, String lpszClassName, String lpszWindowName, Int32 style, Int32 x, Int32 y, Int32 width, Int32 height, HandleRef hWndParent, HandleRef hMenu, HandleRef hInst, Object pvParam)
at System.Windows.Forms.NativeWindow.CreateHandle(CreateParams cp)
at System.Windows.Forms.Control.CreateHandle()
at System.Windows.Forms.Control.get_Handle()
at System.Windows.Forms.Integration.WindowsFormsHost.BuildWindowCore(HandleRef hwndParent)
at System.Windows.Interop.HwndHost.BuildWindow(HandleRef hwndParent)
at System.Windows.Interop.HwndHost.BuildOrReparentWindow()
at System.Windows.Interop.HwndHost.OnSourceChanged(Object sender, SourceChangedEventArgs e)
at System.Windows.SourceChangedEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.UIElement.RaiseEvent(RoutedEventArgs e)
at System.Windows.PresentationSource.UpdateSourceOfElement(DependencyObject doTarget, DependencyObject doAncestor, DependencyObject doOldParent)
at System.Windows.PresentationSource.RootChanged(Visual oldRoot, Visual newRoot)
at System.Windows.Interop.HwndSource.set_RootVisualInternal(Visual value)
at System.Windows.Interop.HwndSource.set_RootVisual(Visual value)
at System.AddIn.Pipeline.FrameworkElementAdapters.ViewToContractAdapter(FrameworkElement root)
at DRIP.AddIn.Adapter.DRIPAddInViewToContractAdapter.UrlHandler(String uri)
InnerException: System.Reflection.TargetInvocationException
Message=Exception has been thrown by the target of an invocation.
Source=mscorlib
StackTrace:
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache)
at System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at System.Windows.Markup.BamlRecordReader.CreateInstanceFromType(Type type, Int16 typeId, Boolean throwOnFail)
InnerException: System.InvalidOperationException
Message=The calling thread cannot access this object because a different thread owns it.
Source=WindowsBase
StackTrace:
at System.Windows.Threading.Dispatcher.VerifyAccess()
at System.Windows.Threading.DispatcherObject.VerifyAccess()
at System.Windows.Application.get_MainWindow()
at Telerik.Windows.Controls.RadSlider..ctor() in c:\Builds\WPF_Scrum\Release_WPF_2010_Q3\Sources\Development\Core\Controls\Slider\RadSlider.cs:line 217
InnerException:
In this configuration (Telerik Reporting, WPF, and MAF (System.Addin)) The WPF cannot be used due to the RadSlider requiring a link to the MainForm.
I have switched to using the Winform in a FormHost and it worked. Its not ideal, but it works.

Resources