Crystal Reports应用程序在Windows XP(WPF)上打印时崩溃

Crystal Reports应用程序在Windows XP(WPF)上打印时崩溃,wpf,printing,crystal-reports,Wpf,Printing,Crystal Reports,此问题发生在使用WPF的版本13.0.4()(32位)上 我正在使用WPF Crystal报表查看器。如果我单击“打印”按钮,应用程序就会崩溃,显示一个窗口,告诉您可以将此信息发送给microsoft 为了避免出现任何其他bug,我开发了一个示例应用程序,其中一个报告只显示一个标签。然后,该问题发生在使用Windows XP service pack 3的计算机上 编辑:我跟踪了以下堆栈跟踪 at System.Windows.Size..ctor(Double, Double) at SAPB

此问题发生在使用WPF的版本13.0.4()(32位)

我正在使用WPF Crystal报表查看器。如果我单击“打印”按钮,应用程序就会崩溃,显示一个窗口,告诉您可以将此信息发送给microsoft

为了避免出现任何其他bug,我开发了一个示例应用程序,其中一个报告只显示一个标签。然后,该问题发生在使用Windows XP service pack 3的计算机上

编辑:我跟踪了以下堆栈跟踪

at System.Windows.Size..ctor(Double, Double)
at SAPBusinessObjects.WPF.Viewer.ReportPaginator.GetPage(Int32)
at System.Windows.Xps.Serialization.Toolbox.GetPage(System.Windows.Documents.DocumentPaginator, Int32)
at System.Windows.Xps.Serialization.NgcDocumentPaginatorSerializer.SerializeObject(System.Object)
at System.Windows.Xps.Serialization.NgcSerializationManager.SaveAsXaml(System.Object)
at System.Windows.Xps.XpsDocumentWriter.SaveAsXaml(System.Object, Boolean)
at System.Windows.Xps.XpsDocumentWriter.Write(System.Windows.Documents.DocumentPaginator)
at System.Windows.Controls.PrintDialog.PrintDocument(System.Windows.Documents.DocumentPaginator, System.String)
at SAPBusinessObjects.WPF.Viewer.PrintControl.Print()
at SAPBusinessObjects.WPF.Viewer.ReportAlbum.PrintReport()
at SAPBusinessObjects.WPF.Viewer.CrystalReportsViewer.PrintReport_Executed(System.Object, System.Windows.Input.ExecutedRoutedEventArgs)
at System.Windows.Input.CommandBinding.OnExecuted(System.Object, System.Windows.Input.ExecutedRoutedEventArgs)
at System.Windows.Input.CommandManager.ExecuteCommandBinding(System.Object, System.Windows.Input.ExecutedRoutedEventArgs, System.Windows.Input.CommandBinding)
at System.Windows.Input.CommandManager.FindCommandBinding(System.Windows.Input.CommandBindingCollection, System.Object, System.Windows.RoutedEventArgs, System.Windows.Input.ICommand, Boolean)
at System.Windows.Input.CommandManager.FindCommandBinding(System.Object, System.Windows.RoutedEventArgs, System.Windows.Input.ICommand, Boolean)
at System.Windows.Input.CommandManager.OnExecuted(System.Object, System.Windows.Input.ExecutedRoutedEventArgs)
at System.Windows.UIElement.OnExecutedThunk(System.Object, System.Windows.Input.ExecutedRoutedEventArgs)
at System.Windows.Input.ExecutedRoutedEventArgs.InvokeEventHandler(System.Delegate, System.Object)
at System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate, System.Object)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(System.Object, System.Windows.RoutedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(System.Object, System.Windows.RoutedEventArgs, Boolean)
at System.Windows.UIElement.RaiseEventImpl(System.Windows.DependencyObject, System.Windows.RoutedEventArgs)
at System.Windows.UIElement.RaiseEvent(System.Windows.RoutedEventArgs, Boolean)
at System.Windows.Input.RoutedCommand.ExecuteImpl(System.Object, System.Windows.IInputElement, Boolean)
at System.Windows.Input.RoutedCommand.ExecuteCore(System.Object, System.Windows.IInputElement, Boolean)
at MS.Internal.Commands.CommandHelpers.CriticalExecuteCommandSource(System.Windows.Input.ICommandSource, Boolean)
at System.Windows.Controls.Primitives.ButtonBase.OnClick()
at System.Windows.Controls.Button.OnClick()

at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(System.Windows.Input.MouseButtonEventArgs)
at System.Windows.UIElement.OnMouseLeftButtonUpThunk(System.Object, System.Windows.Input.MouseButtonEventArgs)
at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(System.Delegate, System.Object)
at System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate, System.Object)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(System.Object, System.Windows.RoutedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(System.Object, System.Windows.RoutedEventArgs, Boolean)
at System.Windows.UIElement.ReRaiseEventAs(System.Windows.DependencyObject, System.Windows.RoutedEventArgs, System.Windows.RoutedEvent)
at System.Windows.UIElement.OnMouseUpThunk(System.Object, System.Windows.Input.MouseButtonEventArgs)
at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(System.Delegate, System.Object)
at System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate, System.Object)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(System.Object, System.Windows.RoutedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(System.Object, System.Windows.RoutedEventArgs, Boolean)
at System.Windows.UIElement.RaiseEventImpl(System.Windows.DependencyObject, System.Windows.RoutedEventArgs)
at System.Windows.UIElement.RaiseTrustedEvent(System.Windows.RoutedEventArgs)
at System.Windows.UIElement.RaiseEvent(System.Windows.RoutedEventArgs, Boolean)
at System.Windows.Input.InputManager.ProcessStagingArea()
at System.Windows.Input.InputManager.ProcessInput(System.Windows.Input.InputEventArgs)
at System.Windows.Input.InputProviderSite.ReportInput(System.Windows.Input.InputReport)
at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr, System.Windows.Input.InputMode, Int32, System.Windows.Input.RawMouseActions, Int32, Int32, Int32)
at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr, MS.Internal.Interop.WindowMessage, IntPtr, IntPtr, Boolean ByRef)
at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
at MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
at System.Windows.Threading.Dispatcher.InvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef)
at System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame)
at System.Windows.Threading.Dispatcher.PushFrame(System.Windows.Threading.DispatcherFrame)
at System.Windows.Application.RunDispatcher(System.Object)
at System.Windows.Application.RunInternal(System.Windows.Window)
at System.Windows.Application.Run(System.Windows.Window)
at System.Windows.Application.Run()
at TestCrystalReports.App.Main()

您是否尝试过在报告的页面设置中删除打印机关联?

我的解决方案 我别无选择,我在Crystal Report Viewer的按钮上放了一个按钮,我调用了ReportDocument的PrintTopPrinter方法,我也遇到了同样的问题。 崩溃与PrintDialog和现有打印机的枚举有关

经过数小时的调试和谷歌搜索,我找到了一个可行的解决方案: 安装(或重新安装).NET framework 3.5 SP1。 这将安装“Microsoft XPS Document Writer”打印机驱动程序


真的不知道为什么,但安装后问题神奇地消失了。

是的,我知道了。问题依然存在