Hello,
I got an issue with the XamMultiColumnComboEditor control since the the 14.2 service release 2178. This also apply to 15.1 service release 2008.
An invisible UserControl which host a XamMultiColumnComboEditor control raises a "System.NullReferenceException" and crash the application (both VS13 designer & BIN application):
à Infragistics.Controls.Editors.ComboEditorBase`2.XamWebComboEditor_Loaded(Object sender, RoutedEventArgs e) à System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs) à System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised) à System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args) à System.Windows.UIElement.RaiseEvent(RoutedEventArgs e) à System.Windows.BroadcastEventHelper.BroadcastEvent(DependencyObject root, RoutedEvent routedEvent) à System.Windows.BroadcastEventHelper.BroadcastLoadedEvent(Object root) à MS.Internal.LoadedOrUnloadedOperation.DoWork() à System.Windows.Media.MediaContext.FireLoadedPendingCallbacks() à System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks() à System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget) à System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget) à System.Windows.Media.MediaContext.Resize(ICompositionTarget resizedCompositionTarget) à System.Windows.Interop.HwndTarget.OnResize() à System.Windows.Interop.HwndTarget.HandleMessage(WindowMessage msg, IntPtr wparam, IntPtr lparam) à System.Windows.Interop.HwndSource.HwndTargetFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) à MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) à MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o) à System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) à MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler) à System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs) à MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
Steps to reproduce
1. Define a simple WPF user control "UserControl1" and add the XamMultiColumnComboEditor:
<UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:ig="http://schemas.infragistics.com/xaml" xmlns:Custom="http://infragistics.com/Windows" x:Class="WpfApplication1.UserControl1" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="300"> <Grid> <ig:XamMultiColumnComboEditor/> Grid> UserControl>
2. In a window, or page, put that custom control "UserControl1" Inside the second tab - a tab which is not displayed by default
Note: standard WPF TabControl or Infragistics XamTabControl have the same behavior.
<Window xmlns:igWPF="http://schemas.infragistics.com/xaml/wpf" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:ig="http://schemas.infragistics.com/xaml" xmlns:local="clr-namespace:WpfApplication1" x:Class="WpfApplication1.MainWindow" Title="MainWindow" Height="350" Width="525"> <Grid> <igWPF:XamTabControl> <igWPF:TabItemEx x:Name="tabItemEx1" Header="tabItemEx1"> <Grid/> igWPF:TabItemEx> <igWPF:TabItemEx x:Name="tabItemEx2" Header="tabItemEx2"> <local:UserControl1 /> igWPF:TabItemEx> igWPF:XamTabControl> Grid> Window>
- Close both documents and open again the window : VS13 designer crashes.
- Close both documents, compile and run : application crashes.
Notes:
- If we move the TabControl to the UserControl : KO, same behavior
- If we move UserControl1 to the first tab (the one which is displayed by default) : OK
Lib. reference: InfragisticsWPF4.Controls.Editors.XamComboEditor - 14.2.20142.2178 (was OK in 14.2.20142.2081)
code snippets
MainWindow:
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:ig="http://schemas.infragistics.com/xaml" xmlns:local="clr-namespace:WpfApplication1" x:Class="WpfApplication1.MainWindow" Title="MainWindow" Height="350" Width="525"> <Grid> <local:UserControl1 HorizontalAlignment="Left" Margin="139,142,0,0" VerticalAlignment="Top"/> Grid> Window>
UserControl1 snippet :
<UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:ig="http://schemas.infragistics.com/xaml" x:Class="WpfApplication1.UserControl1" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="300"> <Grid> <TabControl> <TabItem> <Grid> <CheckBox>DEFAULT ITEMCheckBox> Grid> TabItem> <TabItem> <ig:XamMultiColumnComboEditor /> TabItem> TabControl> Grid> UserControl>
Also seeing this error in existing projects. Some update would be nice.
Hi Everyone,
We've also hit this issue, so thanks for all the info & updates, it definitely saved us some time.
Infragistics, Any idea of a timescale for the fix please?
I am just checking if there is anything else I can do for you.
I've run into this issue as well.Used the auto updater and code started breaking in the weirdest place. Awesome.
So, armed with a decompiler I tried to find out if there's any way to avoid this problem. Seems there isn't:- XamMultiColumnComboEditor has an internal handler for the Loaded event- that handler dereferences the internal property Editor without checking it for null- the Editor property is only ever set in OnApplyTemplate
What this means is that if Loaded fires before OnApplyTemplate is called, the exception is thrown.That is precisely what happens when the control is used in a virtualizing container (like TabControl or Popup).
The best workaround I have found for now is not to use the control
Hello Oliver,
Thank you for your post.
I have been looking into it. I have created a support ticket for you with number CAS-154877-B6R9V2, in order to be able to get automatically updated when a Service Release containing your fix is available for download.