【发布时间】:2013-10-01 14:13:52
【问题描述】:
环境 Win XP , Outlook 2003
我有一个 WPF 组件,它使用
Interop.MAPI打开 Outlook 通讯录用户将选择多个收件人并选择确定,然后关闭通讯录。
关闭弹出窗口后,我会注意到等待光标出现,几秒钟后我收到错误消息,然后我的应用程序 (WPF) 被终止。
我花了好几个小时才弄清楚还是没有运气,我从事件查看器中复制了以下异常。
我发现通讯录模块没有问题 因为相同的地址簿在不同的模块中使用 很好。
在我打开通讯录并读取选定名称的方法中,Catch 块从未到达。
异常信息:System.AccessViolationException 堆: 在 MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG 参考) 在 System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame) 在 System.Windows.Threading.Dispatcher.PushFrame(System.Windows.Threading.DispatcherFrame) 在 System.Windows.Window.ShowHelper(System.Object) 在 System.Windows.Window.Show() 在 System.Windows.Window.ShowDialog() 在 xxxxx.Frw.Base.Client.UI.DialogService.ShowDialog(xxxxx.Frw.Base.Client.UI.BaseViewModel) 在 xxxxx.Frw.Base.Client.UI.DialogService.ShowDialog(xxxxx.Frw.Base.Client.UI.BaseViewModel, System.Windows.Controls.UserControl) 在 xxxxx.Frw.Region.Reu.Client.UI.ViewModels.ReportHeaderViewModel.ShowDistributionList() 在 xxxxx.Frw.Region.Reu.Client.UI.ViewModels.ReportHeaderViewModel.b__1(System.Object) 在 xxxxx.Frw.Base.Client.UI.Commands.RelayCommand.Execute(System.Object) 在 MS.Internal.Commands.CommandHelpers.CriticalExecuteCommandSource(System.Windows.Input.ICommandSource, 布尔值) 在 System.Windows.Controls.Primitives.ButtonBase.OnClick() 在 System.Windows.Controls.Button.OnClick() 在 System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(System.Windows.Input.MouseButtonEventArgs) 在 System.Windows.UIElement.OnMouseLeftButtonUpThunk(System.Object, System.Windows.Input.MouseButtonEventArgs) 在 System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(System.Delegate, 系统.对象) 在 System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate, 系统.对象) 在 System.Windows.RoutedEventHandlerInfo.InvokeHandler(System.Object, System.Windows.RoutedEventArgs) 在 System.Windows.EventRoute.InvokeHandlersImpl(System.Object,System.Windows.RoutedEventArgs,布尔值) 在 System.Windows.UIElement.ReRaiseEventAs(System.Windows.DependencyObject, System.Windows.RoutedEventArgs、System.Windows.RoutedEvent) 在 System.Windows.UIElement.OnMouseUpThunk(System.Object,System.Windows.Input.MouseButtonEventArgs) 在 System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(System.Delegate, 系统.对象) 在 System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate, 系统.对象) 在 System.Windows.RoutedEventHandlerInfo.InvokeHandler(System.Object, System.Windows.RoutedEventArgs) 在 System.Windows.EventRoute.InvokeHandlersImpl(System.Object,System.Windows.RoutedEventArgs,布尔值) 在 System.Windows.UIElement.RaiseEventImpl(System.Windows.DependencyObject, System.Windows.RoutedEventArgs) 在 System.Windows.UIElement.RaiseTrustedEvent(System.Windows.RoutedEventArgs) 在 System.Windows.UIElement.RaiseEvent(System.Windows.RoutedEventArgs, 布尔值) 在 System.Windows.Input.InputManager.ProcessStagingArea() 在 System.Windows.Input.InputManager.ProcessInput(System.Windows.Input.InputEventArgs) 在 System.Windows.Input.InputProviderSite.ReportInput(System.Windows.Input.InputReport) 在 System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr, System.Windows.Input.InputMode,Int32, System.Windows.Input.RawMouseActions,Int32,Int32,Int32) 在 System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr, MS.Internal.Interop.WindowMessage, IntPtr, IntPtr, Boolean ByRef) 在 System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr,Int32,IntPtr,IntPtr,布尔 ByRef) 在 MS.Win32.HwndWrapper.WndProc(IntPtr,Int32,IntPtr,IntPtr,布尔 ByRef) 在 MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object) 在 System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32) 在 MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(System.Object, System.Delegate、System.Object、Int32、System.Delegate) 在 System.Windows.Threading.Dispatcher.InvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan、System.Delegate、System.Object、Int32) 在 MS.Win32.HwndSubclass.SubclassWndProc(IntPtr,Int32,IntPtr,IntPtr) 在 MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG 参考) 在 System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame) 在 System.Windows.Threading.Dispatcher.PushFrame(System.Windows.Threading.DispatcherFrame) 在 System.Windows.Application.RunDispatcher(System.Object) 在 System.Windows.Application.RunInternal(System.Windows.Window) 在 System.Windows.Application.Run(System.Windows.Window) 在 xxxxx.Frw.Main.Client.UI.App.Main()
【问题讨论】:
标签: c# wpf access-violation mapi outlook-2003