none
Null Reference Exception with ComboBox ItemSelection (System.Windows.Controls.Primitives.Popup.OnWindowResize)

    General discussion

  • Hi,

    I am using VS2010 and framework 3.5 sp1.

    In my WPF application, when i select an item in my combobox its throwing nullreference exception.

    and the stack shows

       002DE1BC 70047A41 PresentationFramework_ni!System.Windows.Controls.Primitives.Popup.OnWindowResize(System.Object, System.Windows.AutoResizedEventArgs)+0x29
        002DE1E4 7066412F PresentationCore_ni!System.Windows.Interop.HwndSource.Resize(System.Windows.Size)+0xdf
        002DE248 70636B3E PresentationCore_ni!System.Windows.Interop.HwndSource.OnLayoutUpdated(System.Object, System.EventArgs)+0xfe
        002DE2AC 70636978 PresentationCore_ni!System.Windows.ContextLayoutManager.fireLayoutUpdateEvent()+0xb8
        002DE2E4 70636401 PresentationCore_ni!System.Windows.ContextLayoutManager.UpdateLayout()+0x641
        002DE3EC 7063C6B9 PresentationCore_ni!System.Windows.ContextLayoutManager.UpdateLayoutCallback(System.Object)+0x19
        002DE3F0 7063C690 PresentationCore_ni!System.Windows.Media.MediaContext+InvokeOnRenderCallback.DoWork()+0x10
        002DE3F4 7063C637 PresentationCore_ni!System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()+0x97
        002DE410 7063BFA0 PresentationCore_ni!System.Windows.Media.MediaContext.RenderMessageHandlerCore(System.Object)+0x80
        002DE45C 7063BEFB PresentationCore_ni!System.Windows.Media.MediaContext.RenderMessageHandler(System.Object)+0x2b
        002DE488 73B864AA WindowsBase_ni!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Boolean)+0x8a
        002DE4AC 73B86401 WindowsBase_ni!System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Boolean, System.Delegate)+0xb1
        002DE4F4 73B84504 WindowsBase_ni!System.Windows.Threading.Dispatcher.WrappedInvoke(System.Delegate, System.Object, Boolean, System.Delegate)+0x44
        002DE514 73B893DD WindowsBase_ni!System.Windows.Threading.DispatcherOperation.InvokeImpl()+0x5d
        002DE540 73B89368 WindowsBase_ni!System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(System.Object)+0x38
        002DE548 719D5731 mscorlib_ni!System.Threading.ExecutionContext.runTryCode(System.Object)+0x51
        002DE9DC 719D5627 mscorlib_ni!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)+0x67
        002DE9F8 719C0255 mscorlib_ni!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)+0x45
        002DEA10 73B892A3 WindowsBase_ni!System.Windows.Threading.DispatcherOperation.Invoke()+0x63
        002DEA48 73B83BA7 WindowsBase_ni!System.Windows.Threading.Dispatcher.ProcessQueue()+0x127
        002DEB24 73B83E93 WindowsBase_ni!System.Windows.Threading.Dispatcher.WndProcHook(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)+0x63
        002DEB70 73B8668E WindowsBase_ni!MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)+0xbe
        002DEBBC 73B865BA WindowsBase_ni!MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object)+0x7a
        002DEBCC 73B864AA WindowsBase_ni!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Boolean)+0x8a
        002DEBF0 73B8639A WindowsBase_ni!System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Boolean, System.Delegate)+0x4a
        002DEC38 73B84504 WindowsBase_ni!System.Windows.Threading.Dispatcher.WrappedInvoke(System.Delegate, System.Object, Boolean, System.Delegate)+0x44
        002DEC58 73B83661 WindowsBase_ni!System.Windows.Threading.Dispatcher.InvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Boolean)+0x91
        002DEC9C 73B835B0 WindowsBase_ni!System.Windows.Threading.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority, System.Delegate, System.Object)+0x40
        002DECC0 73B85CFC WindowsBase_ni!MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)+0xdc
        002DEE58 73B83CA4 WindowsBase_ni!System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame)+0xc4
        002DEEA8 73B83379 WindowsBase_ni!System.Windows.Threading.Dispatcher.PushFrame(System.Windows.Threading.DispatcherFrame)+0x49
        002DEEB4 73B8331C WindowsBase_ni!System.Windows.Threading.Dispatcher.Run()+0x4c
        002DEEC0 6F86E37E PresentationFramework_ni!System.Windows.Application.RunDispatcher(System.Object)+0x1e
        002DEECC 6F86D67F PresentationFramework_ni!System.Windows.Application.RunInternal(System.Windows.Window)+0x6f
        002DEEF0 6F8549D6 PresentationFramework_ni!System.Windows.Application.Run(System.Windows.Window)+0x26
        002DEF00 6F854999 PresentationFramework_ni!System.Windows.Application.Run()+0x19

    The code snipped is below.

    <ComboBox Width="200"
             x:Name="cmbEntityTypes"
             SelectionChanged="cmbEntityTypes_SelectionChanged"
             ItemsSource="{Binding ElementName=thisUserControl, Path=EntityTypes}">
    <ComboBox.ItemTemplate>
    <DataTemplate>
    <TextBlock>
    <TextBlock.Text>
    <MultiBinding Converter="{StaticResource LocalizationPrefixMultiConverter}"
                 ConverterParameter="EntityCombo">
    <Binding Path="EntityDisplayName" />
    <Binding Path="CurrentCulture"
            Source="{x:Static l:LocalizationManagers.Instance}" />
    <Binding Source="ClientSearch" />
    </MultiBinding>
    </TextBlock.Text>
    </TextBlock>
    </DataTemplate>
    </ComboBox.ItemTemplate>
    </ComboBox>

    I already saw a post related to this kind of error, but was not useful

    Thanks

    kiran

    Thursday, June 27, 2013 9:25 PM

All replies

  • Could you please show us the source-code of event handler "cmbEntityTypes_SelectionChanged"?
    Thursday, June 27, 2013 10:11 PM
  • Hi krian,

    We are changing the issue type to "General Discussion" because the currently posted information is not enough for retrieving a solution. If you have more time to look at the issue and provide more detailed information, please feel free to change the issue type back to "Question". If the issue has been resolved, we will appreciate you sharing the solution because it might be a good reference for other community members encountering similar questions.

    Thanks for your support and understanding.

    Regards,  


    Lisa Zhu [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, July 08, 2013 11:37 AM
    Moderator