locked
WPF application throws exceptions when debugging unmanaged code. RRS feed

  • Question

  • Hi.
     
    I'm trying to run the following WPF application in Visual studio 2008:


    <Window x:Class="WpfApplication2.Window1"

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

    Title="Window1" Height="300" Width="300">

    <Grid>

    <Grid.RowDefinitions>

    <RowDefinition Height="78*" />

    <RowDefinition Height="184*" />

    </Grid.RowDefinitions>

    <Menu Grid.Row="0" Name="menu1">

    <MenuItem Header="First menu item" >

    <MenuItem Header="First menu item child" />

    </MenuItem>

    <MenuItem Header="Second menu item"/>

    </Menu>

    </Grid>

    </Window>

    The Project is set to debug unmanaged code (in the project settings).
    This application doesn't have a code behind but whenever i choose a menu item
    and afterwards click on the client area, it throws the following exception:

    First-chance exception at 0x767e42eb in WpfApplication2.exe:
    0x0000071A: The remote procedure call was cancelled.

    If i remove the unmanaged code debugging condition, the exception isn't thrown.
    There is no furture information about this exception and i can continue with the application.

    Is this a bug in WPF or am i doint something wrong?

    Thanks, Yoel

    Thursday, July 17, 2008 2:53 PM

All replies

  • I cannot reproduce this problem, could you please post the stack trace of that first chance exception?

    Thanks
    Monday, July 21, 2008 10:06 AM
  • Hey,

    Here is the stack trace:

    > kernel32.dll!767e42eb()  
      [Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll] 
      kernel32.dll!767e42eb()  
      kernel32.dll!767ec56f()  
      rpcrt4.dll!77ce0696()  
      rpcrt4.dll!77cc412e()  
      rpcrt4.dll!77cc4106()  
      rpcrt4.dll!77cc436b()  
      rpcrt4.dll!77d4fe3b()  
      winsta.dll!76473a70()  
      winsta.dll!76473ac1()  
      winsta.dll!76473a2e()  
      rpcrt4.dll!77ce690e()  
      rpcrt4.dll!77cc43c7()  
      rpcrt4.dll!77cc442e()  
      rpcrt4.dll!77cc4850()  
      rpcrt4.dll!77cc475d()  
      rpcrt4.dll!77cc4685()  
      rpcrt4.dll!77cc45ec()  
      rpcrt4.dll!77cc4711()  
      winsta.dll!764747b4()  
      winsta.dll!76474b75()  
      winsta.dll!76474b33()  
      winsta.dll!76474aa2()  
      winsta.dll!764749b9()  
      [Managed to Native Transition] 
      PresentationCore.dll!System.Windows.Interop.HwndTarget.Dispose() + 0x1b0 bytes 
      PresentationCore.dll!System.Windows.Interop.HwndSource.Dispose(bool disposing) + 0xdc bytes 
      PresentationCore.dll!System.Windows.Interop.HwndSource.Dispose() + 0xf bytes 
      PresentationFramework.dll!System.Windows.Controls.Primitives.Popup.PopupSecurityHelper.DestroyWindow(System.Windows.Interop.HwndSourceHook hook, System.Windows.AutoResizedEventHandler onAutoResizedEventHandler) + 0x88 bytes 
      PresentationFramework.dll!System.Windows.Controls.Primitives.Popup.DestroyWindow() + 0x7b bytes 
      PresentationFramework.dll!System.Windows.Controls.Primitives.Popup.HideWindow.AnonymousMethod(object sender, System.EventArgs args) + 0x1f bytes 
      WindowsBase.dll!System.Windows.Threading.DispatcherTimer.FireTick(object unused) + 0x2e bytes 
      WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate callback = {Method = Cannot evaluate expression because a native frame is on top of the call stack.}, object args = null, bool isSingleParameter = true) + 0x4a bytes 
      WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.TryCatchWhen(object source = {System.Windows.Threading.Dispatcher}, System.Delegate callback, object args, bool isSingleParameter, System.Delegate catchHandler = null) + 0x3f bytes 
      WindowsBase.dll!System.Windows.Threading.DispatcherOperation.InvokeImpl() + 0x104 bytes 
      WindowsBase.dll!System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(object state) + 0x28 bytes 
      mscorlib.dll!System.Threading.ExecutionContext.runTryCode(object userData) + 0x43 bytes 
      mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) + 0xa7 bytes 
      mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) + 0x92 bytes 
      WindowsBase.dll!System.Windows.Threading.DispatcherOperation.Invoke() + 0x48 bytes 
      WindowsBase.dll!System.Windows.Threading.Dispatcher.ProcessQueue() + 0x102 bytes 
      WindowsBase.dll!System.Windows.Threading.Dispatcher.WndProcHook(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled) + 0x6a bytes 
      WindowsBase.dll!MS.Win32.HwndWrapper.WndProc(System.IntPtr hwnd = 335592, int msg = 50005, System.IntPtr wParam = 0, System.IntPtr lParam = 0, ref bool handled = false) + 0x87 bytes 
      WindowsBase.dll!MS.Win32.HwndSubclass.DispatcherCallbackOperation(object o) + 0x62 bytes 
      WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate callback = {Method = Cannot evaluate expression because a native frame is on top of the call stack.}, object args = {MS.Win32.HwndSubclass.DispatcherOperationCallbackParameter}, bool isSingleParameter = true) + 0x4a bytes 
      WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.TryCatchWhen(object source = {System.Windows.Threading.Dispatcher}, System.Delegate callback, object args, bool isSingleParameter, System.Delegate catchHandler = null) + 0x3f bytes 
      WindowsBase.dll!System.Windows.Threading.Dispatcher.InvokeImpl(System.Windows.Threading.DispatcherPriority priority, System.TimeSpan timeout, System.Delegate method, object args, bool isSingleParameter) + 0x14f bytes 
      WindowsBase.dll!System.Windows.Threading.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority priority, System.Delegate method, object arg) + 0x3d bytes 
      WindowsBase.dll!MS.Win32.HwndSubclass.SubclassWndProc(System.IntPtr hwnd = 335592, int msg = 50005, System.IntPtr wParam = 0, System.IntPtr lParam = 0) + 0x1e0 bytes 
      [Native to Managed Transition] 
      user32.dll!77f6f8d2()  
      user32.dll!77f6f794()  
      user32.dll!77f6f73d()  
      user32.dll!77f70008()  
      [Managed to Native Transition] 
      WindowsBase.dll!System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame frame = {System.Windows.Threading.DispatcherFrame}) + 0x144 bytes 
      WindowsBase.dll!System.Windows.Threading.Dispatcher.PushFrame(System.Windows.Threading.DispatcherFrame frame) + 0x83 bytes 
      WindowsBase.dll!System.Windows.Threading.Dispatcher.Run() + 0x75 bytes 
      PresentationFramework.dll!System.Windows.Application.RunInternal(System.Windows.Window window) + 0x78 bytes 
      PresentationFramework.dll!System.Windows.Application.Run(System.Windows.Window window) + 0x29 bytes 
      PresentationFramework.dll!System.Windows.Application.Run() + 0x16 bytes 
      Elbit.C4ITI.Map.ControlTest.exe!Elbit.C4ITI.Map.ControlTest.App.Main() + 0x4c bytes C#
      mscoree.dll!7900b1b3()  
      kernel32.dll!767e4911()  
      ntdll.dll!77dce4b6()  
      ntdll.dll!77dce489()  


    Thanks.
    Wednesday, July 23, 2008 10:20 AM
  • I still cannot figure out what's going wrong with the stack trace you pasted above, could you please send your test project to me at v-mazho at microsoft dot com for repro?

    Thanks
    Wednesday, July 23, 2008 11:09 AM
  • First chance exceptions generally do not mean there is a problem with your application, they are just a means of notifying you of a potential error condition.  If you can continue your app with no other issues, there is nothing to worry about.  Second chance or unhandled exceptions are the ones to watch out for.  Here's an explanation: http://blogs.msdn.com/davidklinems/archive/2005/07/12/438061.aspx
    Wednesday, July 23, 2008 8:44 PM
  • Thank you both for your response.
    I read about first exceptions and it satisfies me (especially because the application is wrote contained nothing but a menu and afew menu items and no code at all...).

    Yoel.
    Sunday, July 27, 2008 6:33 AM