on 07-19-2016 7:57 AM
We created a com-visible DLL in .Net3.5 Visual Studio 2012 Environment, integrated it in Microsoft Dynamics NAV 2009R2. Everything works fine except the Print-Button. It doesn't cause any visible Error just the NAV-Client reports an Application-Crash and asks to be closed or debugged.
All other buttons in Toolbar work fine (Export, Paging,...).
I placed a simple Button on the WPF-Form, calling the PrintDialog and printing the ReportDocument on my own and all works as expected.
Anyone had same Issue before?
Greets
Peter Porz
What version of CR for VS are you using?
It's possibly due to a PrintControl dll needs to be registered/accessed etc.
Or could be it cannot find or does not have access to the list of installed printers.
Try running VS by selecting Run as Administrator and see what happens.
Otherwise use Process Monitor or DebugDiag to see where the exception is being thrown.
Don
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The Version used is up-to-date (CRforVS 13.0.17) and Visual Studio is startet "as administrator".
I also linked Visual Studio debugger to NAV-Client, debugging the self created DLL. All seems to work fine, until the DLL is disposed.
I dont't think that any other registration is missing, because I can print with the DLL, referenced in a .NET-Executable.
I tried using DebugDiag after creating a dump-File from VS after NAV crashed. So I decided to start debugging the NAV-Client, Visual Studio startet showing me the disassembly. I safed dump-File and analysed in DebugDiag. I don't know if this is the correkt way of using it. The result showed no errors.
I forgot to write, that print preview is working fine.
I meant the version of CR reports, they need to be updated.
To use DebugDiag set it for a crash on your EXE, I believe if you set it up through devenv.exe it will only capture VS crashing and not the application you are running in debug mode.
Also, Debug dll's are not always the same as release mode dll's in VS, so run the EXE after building in release mode and double clicking the EXE.
There may be a problem using a COM DLL this way. CR doesn't support this scenario because of COM-Interop issues, you can't double hop, problems with passing object though the interopt and keeping them in focus. Same issue we had when the RDC which is a CR COM report engine.
It may simply be a problem with WPF app's. Our WPF viewer is relatively new and may not be able to handle this configuration.
Don
By using DebugDiag the right way, I could get following Information:
System.NullReferenceException
Stack Trace
SAPBusinessObjects.WPF.Viewer.ReportAlbum.PrintReport()
SAPBusinessObjects.WPF.Viewer.CrystalReportsViewer.PrintReport_Executed(System.Object, System.Windows.Input.ExecutedRoutedEventArgs)
System.Windows.Input.CommandBinding.OnExecuted(System.Object, System.Windows.Input.ExecutedRoutedEventArgs)
System.Windows.Input.CommandManager.ExecuteCommandBinding(System.Object, System.Windows.Input.ExecutedRoutedEventArgs, System.Windows.Input.CommandBinding)
System.Windows.Input.CommandManager.FindCommandBinding(System.Windows.Input.CommandBindingCollection, System.Object, System.Windows.RoutedEventArgs, System.Windows.Input.ICommand, Boolean)
System.Windows.Input.CommandManager.FindCommandBinding(System.Object, System.Windows.RoutedEventArgs, System.Windows.Input.ICommand, Boolean)
System.Windows.Input.CommandManager.OnExecuted(System.Object, System.Windows.Input.ExecutedRoutedEventArgs)
System.Windows.UIElement.OnExecutedThunk(System.Object, System.Windows.Input.ExecutedRoutedEventArgs)
System.Windows.Input.ExecutedRoutedEventArgs.InvokeEventHandler(System.Delegate, System.Object)
System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate, System.Object)
System.Windows.RoutedEventHandlerInfo.InvokeHandler(System.Object, System.Windows.RoutedEventArgs)
System.Windows.EventRoute.InvokeHandlersImpl(System.Object, System.Windows.RoutedEventArgs, Boolean)
System.Windows.UIElement.RaiseEventImpl(System.Windows.DependencyObject, System.Windows.RoutedEventArgs)
System.Windows.UIElement.RaiseEvent(System.Windows.RoutedEventArgs, Boolean)
System.Windows.Input.RoutedCommand.ExecuteImpl(System.Object, System.Windows.IInputElement, Boolean)
System.Windows.Input.RoutedCommand.ExecuteCore(System.Object, System.Windows.IInputElement, Boolean)
MS.Internal.Commands.CommandHelpers.CriticalExecuteCommandSource(System.Windows.Input.ICommandSource, Boolean)
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.Object)
System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate, System.Object)
System.Windows.RoutedEventHandlerInfo.InvokeHandler(System.Object, System.Windows.RoutedEventArgs)
System.Windows.EventRoute.InvokeHandlersImpl(System.Object, System.Windows.RoutedEventArgs, Boolean)
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.Object)
System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate, System.Object)
System.Windows.RoutedEventHandlerInfo.InvokeHandler(System.Object, System.Windows.RoutedEventArgs)
System.Windows.EventRoute.InvokeHandlersImpl(System.Object, System.Windows.RoutedEventArgs, Boolean)
System.Windows.UIElement.RaiseEventImpl(System.Windows.DependencyObject, System.Windows.RoutedEventArgs)
System.Windows.UIElement.RaiseTrustedEvent(System.Windows.RoutedEventArgs)
System.Windows.UIElement.RaiseEvent(System.Windows.RoutedEventArgs, Boolean)
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, Boolean ByRef)
MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object)
System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32)
MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)
One more Information, answering the question why we use the WPF-control:
We used the WinForm-Version until last week without having any Problems. QS reported Problems concerning the allignment of characters. In one text we had several characters which were raised or lowered.
So we tried using the WPF-control which solved this Problem.
If somebody already found a solution for this initial Error, we could switch back to WinForm.
I attached the rpt (renamed as .txt because the allowed File types) showing the raised and lowered characters. It depends on the zoomfactor and is just appending in WinForm. If it ist printed with this zoomfactor, the error also occurs on Paper.
Example Screenshot to demonstrate the error is also attached.
Hi Peter,
I don't see the shift so I need to know what printer are you using and have you/they updated it to the most current version?
Is this a Windows or WEB app?
Can you download the app I attached to KBA 2163438, use the same report and set the printer mode to POC and see if that works for you.
Don
Did you change the print mode in the app to PrintOutputController?
If you print the report from Crystal Designer do you see the same thing?
Check the version of USP10.dll you have installed, it shoudl be u sing the 1.4 version from our folder:
C:\Program Files (x86)\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0\win32_x86
Don
Yes, I tried changing the print mode. but it didn't help.
The version of the usp10.dll 1.422.3790.1830
I tried using my DLL on a Win 2008r2 Server, which didn't show the shift with the same installed Printer.
On our development maschines we all get this error.
Could this bevahiour be caused by the version of the used TrueTypeFont Trebuchet MS. On Win10 it seems to be a different Version of this font.
Unfortunately this is a Windows issue, nothing we can do about fixing their Font interpreter...
We are looking at using a newer version of USP10 but it's going to cause a lot of regression formatting issues right now, DEV has already tried updating it and had to stop due to too many problems.
Possibly in some future patch this may get fixed...
Don
Hi Peter,
OK so this appears to be an issue with the COM Visible dll then, possibly look at the resources and permissions.
I can't duplicate the problem you see in my WPF app simply previewing your report so it suggests it's your dll causing the problem.
If you create a new app and simply preview your report and print and zoom do you see the problem?
Don
Hi Don,
thanks for all your Support.
We managed to get the WPF-Control to print without error by replacing the toolbar-button with a custom print button which uses the reportdocument.PrintToPrinter()-Method.
One little Problem remains, as we get some non-printing control characters just in preview but not in print
I don't know, why those squares appear.
Hi Peter,
Odd in both cases because the Viewers Print button in the backend is using P2P API to do the printing...
As for the characters it's likely your PC that is the cause, I don't see the same problem.
Try this, create or add this to your project... This is a Windows.Form viewer app and not a WPF so not sure how to do this for WPF, or if it's capable but....
Add a ListBox and call it myceLocale.
Then in the public frmMain() add this:
CrystalDecisions.ReportAppServer.CommonControls.CeLocale myceLocale;
Then you need this and you need to click on the language before the report is loaded:
private void lstCeLocale_SelectedIndexChanged(object sender, EventArgs e)
{
//this is the routine to set the default language locale for the report. Must be done before the report is loaded.
CrystalDecisions.ReportAppServer.CommonControls.CeLocale myceLocale = (CrystalDecisions.ReportAppServer.CommonControls.CeLocale)lstCeLocale.SelectedItem;
try
{
rpt.ReportClientDocument.LocaleID = (CrystalDecisions.ReportAppServer.DataDefModel.CeLocale)myceLocale;
}
catch (Exception ex)
{
MessageBox.Show("ERROR: " + ex.Message);
}
}
Now when you preview it will use what ever language you selected, try different values.
And add this on the View report event/button check box required:
// this gets the locale when set before the report was opened and sets the viewer to the same language
if (chkSameAsCELocale.Checked)
{
int x = (int)rpt.ReportClientDocument.LocaleID;
crystalReportViewer1.SetProductLocale(x);
}
If you still see the bad characters it could be coming from your data or it simply did not paste in properly.
Can you or do you have a database field you can paste that string value into? Rather than using Static characters, because that can cause problems on how the Font Glyphs are interpreted.
Don
Hi Peter,
Few questions:
- What are we trying to print?
- Are these Crystal Reports?
- Is the NAV client where you create reports?
- What is a COM- visible DLL?
The forum section we are currently in is for issues related to SAP Crystal Reports developer version for MS Visual Studio only.
Regards,
Vinit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
We try to print Crystal Report .rpt-Files located on the client maschine. The reports where created by Crystal Report Designer, in most cases an older version (begining with 8.5 or 9).
A COM-visible DLL is a function library, which ist registered on the Windows System to be used by other Software (for example Crystal Report User Function Libs).
User | Count |
---|---|
84 | |
10 | |
9 | |
8 | |
6 | |
6 | |
6 | |
5 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.