on 10-09-2013 10:45 AM
Hi,
I get the WPF viewer crashes my applications when i click on the print button (cr toolbar) right after open the report.
I use CR 13.0.7 with Visual Studio 2010.
Beschreibung:
Stopped working
Problemsignatur:
Problemereignisname: CLR20r3
Problemsignatur 01: ew.exe
Problemsignatur 02: 5.9.0.0
Problemsignatur 03: 52550735
Problemsignatur 04: SAPBusinessObjects.WPF.Viewer
Problemsignatur 05: 13.0.7.1136
Problemsignatur 06: 523993aa
Problemsignatur 07: 547
Problemsignatur 08: 0
Problemsignatur 09: System.NullReferenceException
Betriebsystemversion: 6.0.6002.2.2.0.272.7
Gebietsschema-ID: 1031
I need help!
André
We recently upgraded to 13.0.6 and found selecting the print button causes an app crash.
I then upgraded to 13.0.7 and that crashes as well.
It is all of our reports that are affected and we do have a default printer.
I then reverted back to 13.0.1 and that works.
the viewer dll is SAPBusinessObjects.WPF.Viewer.dll.
Colin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'd like take this to an earlier Discussion here:
https://scn.sap.com/thread/1833376
In that Discussion, Mandeep Jassal - the Program Manager for CRVS says on march 23, 2011:
the scenario to host the WPF viewer in WinForms is not fully tested
I just pinged him and got back a confirmation that this is still on his "to-do" list. Unfortunately, these things have to get prioritized in relation to other issues, etc., and WPF viewer in WinForms is just not percolating up the list...
- Ludek
Hi Colin,
we replaced the Crystal Reports WPF viewer with the Crystal Reports WinForms viewer using in our Win32 application and so the crash when printing don't occur anymore.
According the SAP Support this scenario is supported as long as .NET full framework is used and not a client profile.
André
Well, I don't want to argue the difference between a bug and an enhancement. But I believe by definition, if a feature is not in the project scope, then adding it later on is an enhancement. And WPF in Winforms was not in the project scope (at least that is what I am told).
As for being able to do anything. Best you can do is create a phone case and talk to a support tech. If you can convince him he should be reporting this as a bug, he will do so. Then it is up to Program Management and R&D to decide if they will accept this as a bug. And even then they do accept it as a bug, they may decline the fix for reasons such as; possible introduction of instabilities, not enough ROI, etc., etc. Uphill fight all the way. Been there, done that...
- Ludek
Ludek,
I too am hoping that this issue can be resolved. I understand what you are saying about WPF in Winforms not originally being on the project scope. However we are only talking about using the print button. Everything else seems to be working fine as I am using 13.0.7 in an ElementHost control. (I have my own WPF usercontrol which I use 13.0.7 within - my usercontrol is then hosted in a ElementHost control in a WinForms application)
When it comes down to it the issue probably is a simple thing to fix.
As Colin mentioned the print button was previously working fine. That is why we chose to stick with the Crystal Reports solution rather than changing it out.
Regards,
Greg
Hi guys we use the wpf viewer and now hide the print button then use our own button to call the print directly on the report document. A bit messy but works.
using (PrintDialog dialog = new PrintDialog())
{
dialog.AllowCurrentPage = true;
dialog.AllowSelection = true;
dialog.AllowSomePages = true;
dialog.AllowPrintToFile = true;
if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) {
reportDocument.PrintToPrinter(
dialog.PrinterSettings,
new System.Drawing.Printing.PageSettings(dialog.PrinterSettings);
false);
}
}
I got a similar issue yesterday testing an unrelated issue. Turned out I did not have a default printer driver. Can you please check on that. (I'm in discussions right now to see if I can get this escalated for a fix...)
Please let me know irrespective...
- Ludek
Senior Support Engineer AGS Product Support, Global Support Center Canada
Follow us on Twitter
Got Enhancement ideas? Try the SAP Idea Place
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hmm - strange as I just created a WPF project and did a quick xps print (the image did not have an actual printer driver, but I can configure that if need be).
Questions;
Do you see the same issue when printing to xps?
What is the OS?
Are you printing from the .NET IDE or a compiled exe? Does the issue occur in both instances (IDE / EXE)?
Other than xps, what other printer driver have you tried?
Are you able to export to PDF file format?
How big is the report? How many images?
What is the database and how are you connecting to it?
- Ludek
With clicking the print toolbar button (default CR13 toolbar) in my application, by Crystal Reports default it should open a dialog to choose a printer for printing. But instead the application crashes.
The issue occurs only in the compiled EXE. Generate the report in the EXE and export to PDF file or RPT file works correctly. Open the RPT file with crw32.exe or IDE and printing (or navigating in the group tree) works correctly.
Printing to XPS is the same issue. I also tried the printers 'KONICA-MINOLTA Magicolor 4650' and 'OKI_B4350', without success.
The issue occurs both on Windows 7, Windows Server 2008 R1 and Windows XP.
The issue occurs only with SP 6 and SP 7 of CR13 (uninstall CR13.0.7 an install CR13.0.5 or previous version and there is no crash when clicking on the print toolbar button).
My applications uses different reports with either Microsoft Access (MDB) or TTX (Field definition) as datasources.
All Reports uses ADO connections. The issue occurs with all of these reports.
The issue occurs both a report with only 1 page (2 little images/logos), and a report with 20 pages (7 bigger images on the pages 1 and 2), and a report with 400 pages (1 little image/logo).
The RPT file size for the report wirh 20 pages is 296 KB.
André
Hello Ludek,
I am also experiencing this crash when using the print button within the CR WPF viewer for Visual Studio 2010. I'm using the latest build 13.0.7.
I believe this has been happening ever since I upgraded from 13.0.5. I definitely have a default printer set. It also happens for me if I save a report (to .rpt) and then open the report and attempt to print it. Either way it crashes.
Object reference not set to an instance of an object.
System.NullReferenceException: Object reference not set to an instance of an object.
at SAPBusinessObjects.WPF.Viewer.ReportAlbum.PrintReport()
at SAPBusinessObjects.WPF.Viewer.CrystalReportsViewer.PrintReport_Executed(Object sender, ExecutedRoutedEventArgs e)
at System.Windows.Input.CommandBinding.OnExecuted(Object sender, ExecutedRoutedEventArgs e)
at System.Windows.Input.CommandManager.ExecuteCommandBinding(Object sender, ExecutedRoutedEventArgs e, CommandBinding commandBinding)
...
Hello Greg
I have the same questions for you as I had for Andre;
Do you also see the issue with a saved data report?
if you do, can you attach the report here?
To attach a report, rename it to .txt. Then click on "Use Advanced Editor" and upload.
Oh, one more question; is this happening with every report?
- Ludek
Message was edited by: Ludek Uher
Ludek,
I see the error in 2 cases: (pro grammatically & with a saved report) Yes it is happening with every report.
1. Pro-grammatically creating the report document and setting it to the viewer. Using the Print button then causes an error.
Here is my code to create the report and set it to the CR WPF viewer.
// stream in the data
using (System.Data.DataSet sdds = DataLoader.createObject(rcp.sddsDL))
{
m_reportDocument.SetDataSource(sdds);
}
// pass global parameters
if (m_reportDocument.ParameterFields.Find("serverName", null) != null)
m_reportDocument.SetParameterValue("serverName", rcp.serverName);
m_reportDocument.SetParameterValue("serverNow", rcp.serverNow);
m_reportDocument.SetParameterValue("serverTimeZone", TimeZoneEx.timeZoneName(rcp.serverTimeZone, rcp.serverNow));
if (m_reportDocument.ParameterFields.Find("reportTimeZone", null) != null)
m_reportDocument.SetParameterValue("reportTimeZone", "CXtra Local Time");
if (m_reportDocument.ParameterFields.Find("selectionDesc0", null) != null)
m_reportDocument.SetParameterValue("selectionDesc0", m_crp.selectionDesc0);
// force creation of report on this non-UI thread
m_reportDocument.ExportToStream(CrystalDecisions.Shared.ExportFormatType.Text).Dispose();
// call back to UI thread
this.BeginInvoke((MethodInvoker)delegate()
{
m_userControl2.crViewer.ViewerCore.ReportSource = m_reportDocument;
});
2. Saving a report as a .rpt file and opening it back up in the viewer. Pressing the print button will cause the same error.
Report .rpt file attached. (renamed to .txt)
Works fine for me...
Let's do this to simplify things a bit; print to xps. Does that result in the same error? (BTW, I did use xps and an HP printer drivers for the test.)
Now, here is my code:
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Imports CrystalDecisions.ReportSource
Imports CrystalDecisions.Windows
Class MainWindow
Public Sub New()
' This call is required by the designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
Dim crReportDocument As New CrystalDecisions.CrystalReports.Engine.ReportDocument
crReportDocument.Load("C:\TESTS\WPF Printer\conformance.rpt")
'MyExportFormats.
'crReportDocument.ExportToStream(CrystalDecisions.Shared.ExportFormatType.Text).Dispose()
CrystalReportsViewer1.ViewerCore.ReportSource = crReportDocument
End Sub
If you create a simple app like the one above on the saved data report, can you print from it?
- Ludek
Ludek,
Sorry for the delay. You know how projects can go ... I was working on another issue.
So your example above works for me. However when I use the WPF control within an elementhost control I get the "object reference not set to an instance of an object" when clicking on the print button.
System.NullReferenceException was unhandled
Message=Object reference not set to an instance of an object.
Source=SAPBusinessObjects.WPF.Viewer
StackTrace:
at SAPBusinessObjects.WPF.Viewer.ReportAlbum.PrintReport()
at SAPBusinessObjects.WPF.Viewer.CrystalReportsViewer.PrintReport_Executed(Object sender, ExecutedRoutedEventArgs e)
at System.Windows.Input.CommandBinding.OnExecuted(Object sender, ExecutedRoutedEventArgs e)
at System.Windows.Input.CommandManager.ExecuteCommandBinding(Object sender, ExecutedRoutedEventArgs e, CommandBinding commandBinding)
at System.Windows.Input.CommandManager.FindCommandBinding(CommandBindingCollection commandBindings, Object sender, RoutedEventArgs e, ICommand command, Boolean execute)
at System.Windows.Input.CommandManager.FindCommandBinding(Object sender, RoutedEventArgs e, ICommand command, Boolean execute)
at System.Windows.Input.CommandManager.OnExecuted(Object sender, ExecutedRoutedEventArgs e)
at System.Windows.UIElement.OnExecutedThunk(Object sender, ExecutedRoutedEventArgs e)
at System.Windows.Input.ExecutedRoutedEventArgs.InvokeEventHandler(Delegate genericHandler, Object target)
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.RaiseEvent(RoutedEventArgs args, Boolean trusted)
at System.Windows.Input.RoutedCommand.ExecuteImpl(Object parameter, IInputElement target, Boolean userInitiated)
at System.Windows.Input.RoutedCommand.ExecuteCore(Object parameter, IInputElement target, Boolean userInitiated)
at System.Windows.Input.CommandManager.TransferEvent(IInputElement newSource, ExecutedRoutedEventArgs e)
at System.Windows.Input.CommandManager.OnExecuted(Object sender, ExecutedRoutedEventArgs e)
at System.Windows.UIElement.OnExecutedThunk(Object sender, ExecutedRoutedEventArgs e)
at System.Windows.Input.ExecutedRoutedEventArgs.InvokeEventHandler(Delegate genericHandler, Object target)
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.RaiseEvent(RoutedEventArgs args, Boolean trusted)
at System.Windows.Input.RoutedCommand.ExecuteImpl(Object parameter, IInputElement target, Boolean userInitiated)
at System.Windows.Input.RoutedCommand.ExecuteCore(Object parameter, IInputElement target, Boolean userInitiated)
at MS.Internal.Commands.CommandHelpers.CriticalExecuteCommandSource(ICommandSource commandSource, Boolean userInitiated)
at System.Windows.Controls.Primitives.ButtonBase.OnClick()
at System.Windows.Controls.Button.OnClick()
at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
at System.Windows.UIElement.OnMouseLeftButtonUpThunk(Object sender, MouseButtonEventArgs e)
at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
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.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
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.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
at System.Windows.Input.InputManager.ProcessStagingArea()
at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
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 MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at WindowsFormsApplication2.Program.Main() in c:\users\greg\documents\visual studio 2010\Projects\WindowsFormsApplication2\WindowsFormsApplication2\Program.cs:line 18
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
Here is my project code:
public Form1()
{
InitializeComponent();
SAPBusinessObjects.WPF.Viewer.CrystalReportsViewer crviewer = new SAPBusinessObjects.WPF.Viewer.CrystalReportsViewer();
elementHost1.Child = crviewer;
// //Add any initialization after the InitializeComponent() call.
ReportDocument doc = new ReportDocument();
doc.Load("C:\\Users\\Greg\\Documents\\Desktop\\conformance.rpt");
doc.ExportToStream(CrystalDecisions.Shared.ExportFormatType.Text).Dispose();
crviewer.ViewerCore.ReportSource = doc;
}
User | Count |
---|---|
85 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.