Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics NAV (Archived)

NAV 2013 has stopped working when print report

Posted on by 640

Dear all,

I am using NAV 2013 Build 36076.

When I print my customized report, NAV has stopped working.

When I try to print the same document again, this issue did not happen.

Do you have any idea to solve this issue? Thank you.

The event viewer said like below.

Type: System.DivideByZeroException
Message: Attempted to divide by zero.
StackTrace:
at Microsoft.Dynamics.Nav.Client.WinClient.ExceptionHandler.<>c__DisplayClass6.<DoRethrowWithCatchException>b__4()
at Microsoft.Dynamics.Nav.Client.WinClient.NavClientErrorHandler.ExecuteAndCatchExceptions(Func`1 execute)
at Microsoft.Dynamics.Nav.Client.WinClient.ExceptionHandler.DoExecute(Func`1 execute)
at Microsoft.Dynamics.Nav.Client.WinClient.ExceptionHandler.DoRethrowWithCatchException(Exception exception, Boolean designMode)
Source: Microsoft.Dynamics.Nav.Client.WinClient
HResult: -2147352558
----------------------------------
Type: System.DivideByZeroException
Message: Attempted to divide by zero.
StackTrace:
at System.Drawing.Printing.PageSettings.get_HardMarginX()
at Microsoft.Dynamics.Nav.Common.Printing.ReportRenderer.ReportPrintPage(Object sender, PrintPageEventArgs printPageEventArguments)
at System.Drawing.Printing.PrintDocument.OnPrintPage(PrintPageEventArgs e)
at System.Drawing.Printing.PrintDocument._OnPrintPage(PrintPageEventArgs e)
at System.Drawing.Printing.PrintController.PrintLoop(PrintDocument document)
at System.Drawing.Printing.PrintController.Print(PrintDocument document)
at System.Drawing.Printing.PrintDocument.Print()
at Microsoft.Dynamics.Nav.Common.Printing.ReportRenderer.PrintReport(Boolean showPrintStatus)
at Microsoft.Dynamics.Nav.Common.Printing.ReportRenderer.ReportPageReadyPrintDirectly(DataSetRequest reportRequest, Boolean isFirstPage, ReportExecutionHandler reportExecutionHandler)
at Microsoft.Dynamics.Nav.Common.Printing.ReportHandler.ReportPageReadyPrintDirectly(DataSetRequest reportRequest, ReportExecutionItem reportExecutionItem, Boolean isFirstPage, ReportExecutionHandler reportExecutionHandler)
at Microsoft.Dynamics.Nav.Common.Printing.ReportHandler.ReportPageReady(DataSetRequest reportRequest, ReportExecutionHandler reportExecutionHandler, IService service, IReportCallbackHandler reportCallbackHandler)
at Microsoft.Dynamics.Nav.Client.ServiceClientCallback.<>c__DisplayClass23.<ReportPageReady>b__22()
at Microsoft.Dynamics.Nav.Client.ServiceClientCallback.<>c__DisplayClass1.<RunClientRequest>b__0()
at Microsoft.Dynamics.Nav.Client.ServerInvocationManager.<>c__DisplayClass2.<WaitForServerResponse>b__0()
at Microsoft.Dynamics.Nav.Client.ServerInvocationManager.DoClientRequestAndCatch(Action clientRequest, Action`1 sendToServerIfNotFaulted)
at Microsoft.Dynamics.Nav.Client.ServerInvocationManager.WaitForServerResponse(IAsyncResult asyncResult, ThreadCallbackContext threadEventContext)
at Microsoft.Dynamics.Nav.Client.ServerInvocationManager.CallServer[T](CallServerMethod`1 callServerMethod, ServerCallOptions options)
at Microsoft.Dynamics.Nav.Client.ServerInvocationHandler.CallServer[T](CallServerMethod`1 callServerMethod, ServerCallOptions options)
at Microsoft.Dynamics.Nav.Client.ConnectionStateManager.CallServer[T](CallServerMethod`1 callServerMethod, ServerCallOptions options)
at Microsoft.Dynamics.Nav.Client.ConnectionStateManager.CallServer[T](CallServerMethod`1 callServerMethod)
at Microsoft.Dynamics.Nav.Client.ServerInvocationHandler.CallServer[T](CallServerMethod`1 callServerMethod)
at Microsoft.Dynamics.Nav.Client.ServiceConnection.CallServer[T](CallServerMethod`1 callServerMethod)
at Microsoft.Dynamics.Nav.Client.ServiceConnectionBase.ActionField(NavRecordState& state, NavDataSet recDataSet, Int32 controlId)
at Microsoft.Dynamics.Nav.Client.ServiceConnection.Microsoft.Dynamics.Nav.Client.IService.ActionField(NavRecordState& , NavDataSet , Int32 )
at Microsoft.Dynamics.Nav.Client.DataBinder.NstDataAccess.ActionMethod(Int32 controlId)
at Microsoft.Dynamics.Nav.Client.Actions.InvokePageTriggerAction.InvokeTrigger(LogicalControl logicalControl, UISession uiSession)
at Microsoft.Dynamics.Nav.Client.Actions.InvokePageTriggerAction.InvokeCore(Boolean async, LogicalControl logicalControl, Object state, UISession uiSession)
at Microsoft.Dynamics.Framework.UI.LogicalAction.InvokeCoreWithErrorHandling(Boolean async, LogicalControl logicalControl, Object state, UISession uiSession)
at Microsoft.Dynamics.Framework.UI.LogicalAction.DoInvoke(LogicalControl logicalControl, UISession uiSession)
at Microsoft.Dynamics.Framework.UI.ActionControl.Invoke()
at Microsoft.Dynamics.Framework.UI.Windows.ActionsHelper.<>c__DisplayClassa.<ModalitySafeInvoke>b__8()
at Microsoft.Dynamics.Framework.UI.Windows.ActionsHelper.ModalitySafe(Action action)
at Microsoft.Dynamics.Framework.UI.Windows.ActionsHelper.ModalitySafeInvoke(ActionControl actionControl)
at Microsoft.Dynamics.Framework.UI.Windows.ActionControlAdapterBase.DefaultInvokeAction(LogicalControlAdapter adapter, ActionControl actionControl)
at Microsoft.Dynamics.Framework.UI.WinForms.ProcessShortcutHelper.ProcessShortcutKeyInActionControl(ActionControl control)
at Microsoft.Dynamics.Framework.UI.WinForms.ProcessShortcutHelper.ProcessShortcutKey(LogicalControl control)
at Microsoft.Dynamics.Framework.UI.WinForms.ProcessShortcutHelper.ProcessShortcutKeyInChildren(LogicalControl control)
at Microsoft.Dynamics.Framework.UI.WinForms.ProcessShortcutHelper.ProcessShortcutKey(LogicalControl control)
at Microsoft.Dynamics.Framework.UI.WinForms.ProcessShortcutHelper.ProcessShortcutKeyInChildren(LogicalControl control)
at Microsoft.Dynamics.Framework.UI.WinForms.ProcessShortcutHelper.ProcessShortcutKey(LogicalControl control)
at Microsoft.Dynamics.Framework.UI.WinForms.ProcessShortcutHelper.ProcessShortcutKeyInChildren(LogicalControl control)
at Microsoft.Dynamics.Framework.UI.WinForms.ProcessShortcutHelper.ProcessShortcutKey(LogicalControl control)
at Microsoft.Dynamics.Framework.UI.WinForms.ProcessShortcutHelper.ProcessShortcutKeyInChildren(LogicalControl control)
at Microsoft.Dynamics.Framework.UI.WinForms.ProcessShortcutHelper.ProcessShortcutKeyAll(LogicalControl control)
at Microsoft.Dynamics.Framework.UI.WinForms.ProcessShortcutHelper.ProcessShortcutKeyInLogicalControlsFromCurrentControl(Boolean execute)
at Microsoft.Dynamics.Framework.UI.WinForms.LogicalFormAdapter.ProcessKey(Keys keyData)
at Microsoft.Dynamics.Framework.UI.WinForms.LogicalFormAdapter.BusinessForm_PreviewProcessCmdKey(Object sender, HandledPreviewKeyDownEventArgs e)
at Microsoft.Dynamics.Framework.UI.WinForms.Controls.BusinessForm.OnPreviewProcessCmdKey(HandledPreviewKeyDownEventArgs e)
at Microsoft.Dynamics.Framework.UI.WinForms.Controls.BusinessForm.ProcessCmdKey(Message& msg, Keys keyData)
at System.Windows.Forms.Control.ProcessCmdKey(Message& msg, Keys keyData)
at System.Windows.Forms.Control.ProcessCmdKey(Message& msg, Keys keyData)
at Microsoft.Dynamics.Framework.UI.WinForms.Controls.DirectionalLayoutPanel.ProcessCmdKey(Message& msg, Keys keyData)
at System.Windows.Forms.Control.ProcessCmdKey(Message& msg, Keys keyData)
at Microsoft.Dynamics.Framework.UI.WinForms.Controls.DirectionalLayoutPanel.ProcessCmdKey(Message& msg, Keys keyData)
at System.Windows.Forms.Control.ProcessCmdKey(Message& msg, Keys keyData)
at Microsoft.Dynamics.Framework.UI.WinForms.Controls.DirectionalLayoutPanel.ProcessCmdKey(Message& msg, Keys keyData)
at System.Windows.Forms.Control.ProcessCmdKey(Message& msg, Keys keyData)
at Microsoft.Dynamics.Framework.UI.WinForms.Controls.DirectionalLayoutPanel.ProcessCmdKey(Message& msg, Keys keyData)
at System.Windows.Forms.Control.ProcessCmdKey(Message& msg, Keys keyData)
at Microsoft.Dynamics.Framework.UI.WinForms.Controls.DirectionalLayoutPanel.ProcessCmdKey(Message& msg, Keys keyData)
at System.Windows.Forms.Control.ProcessCmdKey(Message& msg, Keys keyData)
at System.Windows.Forms.Control.ProcessCmdKey(Message& msg, Keys keyData)
at Microsoft.Dynamics.Framework.UI.WinForms.Controls.BusinessGridView.ProcessCmdKey(Message& msg, Keys keyData)
at System.Windows.Forms.Control.PreProcessMessage(Message& msg)
at System.Windows.Forms.Control.PreProcessControlMessageInternal(Control target, Message& msg)
at System.Windows.Forms.Application.ThreadContext.PreTranslateMessage(MSG& msg)
Source: System.Drawing
HResult: -2147352558

*This post is locked for comments

  • pearl_jo Profile Picture
    pearl_jo 640 on at
    RE: NAV 2013 has stopped working when print report

    Hi Chris,

    Thank you for your response.

    What is the relation between issue margin with OnInitReport, OnPreReport, OnOpenPage?

    OnInitReport : I just initialized the parameter value of report.

    OnPreReport : There is validation not to preview report and get setup.

    OnOpenPage : no code.

  • Suggested answer
    CDsilva Profile Picture
    CDsilva 4,184 on at
    RE: NAV 2013 has stopped working when print report

    Hi,

    Have you written any code on OnInitReport,OnPreReport, OnOpenPage for the request page of your report ?

  • pearl_jo Profile Picture
    pearl_jo 640 on at
    RE: NAV 2013 has stopped working when print report

    Hi Zaid,

    Thank you for your response.

    When I attempt to print second time, there is no error.

    So, there is no problem with C/AL Code in report.

    I thought that the margin is the cause of this issue..

    I cannot debug the process since this issue is not always happen.

    It is an intermittent issue.

  • Suggested answer
    Zaid Tariq Profile Picture
    Zaid Tariq 2,266 on at
    RE: NAV 2013 has stopped working when print report

    Hi,

    This seems to be a generic error. Please check the code and verify that you are not dividing a value by zero. The best way is to identify through debugger.

    If you are calling another codeunit do something like IF MYCodeUnit.RUN THEN to handle this error.

    Thanks

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans