This is a migrated thread and some comments may be shown as answers.

PrintQueueException in RadDiagramPrintPreview

3 Answers 192 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
Manuel
Top achievements
Rank 1
Manuel asked on 27 Nov 2015, 02:57 PM

Our centralized logging system detected the following exception in one of our customers machines. It's not systematic or frequent: it just randomly happens on that machine: 

System.Printing.PrintQueueException: PrintTicket provider failed to merge and validate PrintTicket. Win32 error: The data is invalid.
at MS.Internal.Printing.Configuration.PTProvider.MergeAndValidatePrintTicket(MemoryStream basePrintTicket, MemoryStream deltaPrintTicket, PrintTicketScope scope, ConflictStatus& conflictStatus)
at System.Printing.PrintTicketManager.MergeAndValidatePrintTicket(PrintTicket basePrintTicket, PrintTicket deltaPrintTicket, PrintTicketScope scope)
at System.Printing.PrintQueue.MergeAndValidatePrintTicket(PrintTicket basePrintTicket, PrintTicket deltaPrintTicket)
at Telerik.Windows.Controls.Diagrams.Extensions.PrintSettingsViewModel.MergeAndValidatePrintTicket(PrintTicket originalTicket, PrintTicket modificationTicket)
at Telerik.Windows.Controls.Diagrams.Extensions.RadDiagramPrintPreview.DoPrint(String title)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.Controls.Primitives.ButtonBase.OnClick()
at System.Windows.Controls.Button.OnClick()
at Telerik.Windows.Controls.RadButton.OnClick()
at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
at System.Windows.UIElement.OnMouseUpThunk(Object sender, MouseButtonEventArgs e)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
at System.Windows.Input.InputManager.ProcessStagingArea()
at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler).

 

And here is the code causing the issue:

var printPreviewWindow = new Telerik.Windows.Controls.RadWindow();
var printPreview = new RadDiagramPrintPreview { Diagram = selectedDiagram.diagram };
printPreviewWindow.Content = printPreview;
printPreviewWindow.ResizeMode = ResizeMode.NoResize;
printPreviewWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner;
printPreviewWindow.Width = 800;
printPreviewWindow.Height = 600;
printPreviewWindow.Owner = _owner;
printPreviewWindow.ShowDialog();

 

They are on a quite old version of our product using Telerik 2014.3.1021.40 (.NET 4.0 and Microsoft Windows NT 6.2.9200.0 64 bit).

Our latest version includes Telerik 2015.3.930.40: as far as you guys know, the new version solves that issue?

 

Thank you,

Regards,

 

Manuel

 

3 Answers, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 02 Dec 2015, 09:54 AM
Hi Manuel,

Unfortunately we are not aware of similar issue previously reported or fixed in our Diagram. Looking at the stack trace and the system method MergeAndValidatePrintTicket it seems like an issue which is out of our control's scope. However, we would like to investigate it further but for this purpose we need an isolation that we can reproduce on our side.

Regards,
Petar Mladenov
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Manuel
Top achievements
Rank 1
answered on 03 Dec 2015, 04:39 PM

Hi Petar,

thank you for your response.

Looking at the official documentation, it seems that a PrintQueueException may be related to a configuration issue (o.s. side) or to insufficient privileges. So I agree: it's not something under your control.

However I think that the exception should be managed by the RadDiagramPrintPreview control (or one of its dependencies). The only viable alternative I have to prevent an unhandled exception to crash my application is to put the"printPreviewWindow.ShowDialog()" code into a try..catch: a terrible hack affecting both usability (the entire printPreviewWindow will be closed) and maintainability (what will happen if you decide to put the print call into a different thread? My solution will be no more effective --> regression).

Sounds reasonable?

0
Petar Mladenov
Telerik team
answered on 07 Dec 2015, 11:58 AM
Hi Manuel,

We agree with you that our code could be improved in this direction. We logged a feature request you can track in our feedback portal. We really appreciate your feedback and it will help us make our diagram framework bulleproof.

Regards,
Petar Mladenov
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Diagram
Asked by
Manuel
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Manuel
Top achievements
Rank 1
Share this question
or