NAV crashes when closing page with add-in

ACaignie
Member Posts: 91
Hello,
I have created a javascript add-in that uses leaflet to display map information. This works fine, however from time to time NAV crashes when the page with the add-in is closed. I think there is a problem with an event that is triggered after the page is closed, however I cannot find what it can be.
Does anyone know a way to find the issue?
We are using NAV2017 CU23 (RTC, not web client)
This is (part of) the error that is logged in the event viewer:
Application: Microsoft.Dynamics.Nav.Client.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.AccessViolationException
at System.Windows.Forms.UnsafeNativeMethods+IOleInPlaceActiveObject.TranslateAccelerator(MSG ByRef)
at System.Windows.Forms.WebBrowserBase.PreProcessMessage(System.Windows.Forms.Message ByRef)
at Microsoft.Dynamics.Framework.UI.WinForms.WebBrowserForNavigation.PreProcessMessage(System.Windows.Forms.Message ByRef)
at System.Windows.Forms.Control.PreProcessControlMessageInternal(System.Windows.Forms.Control, System.Windows.Forms.Message ByRef)
at System.Windows.Forms.Application+ThreadContext.PreTranslateMessage(MSG ByRef)
at System.Windows.Forms.Application+ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr, Int32, Int32)
at System.Windows.Forms.Application+ThreadContext.RunMessageLoopInner(Int32, System.Windows.Forms.ApplicationContext)
at System.Windows.Forms.Application+ThreadContext.RunMessageLoop(Int32, System.Windows.Forms.ApplicationContext)
at System.Windows.Forms.Form.ShowDialog(System.Windows.Forms.IWin32Window)
at Microsoft.Dynamics.Framework.UI.WinForms.Controls.BusinessForm.ShowDialog(System.Windows.Forms.Form, System.Windows.Forms.IWin32Window)
at Microsoft.Dynamics.Framework.UI.WinForms.FormPanel.DoModal(Microsoft.Dynamics.Framework.UI.LogicalForm)
at Microsoft.Dynamics.Framework.UI.Windows.LogicalFormAdapterBase.DoModal(Microsoft.Dynamics.Framework.UI.LogicalForm)
at Microsoft.Dynamics.Framework.UI.Windows.ClientSessionBase.OnFormToShow(Microsoft.Dynamics.Framework.UI.LogicalForm, Microsoft.Dynamics.Framework.UI.LogicalControl)
at Microsoft.Dynamics.Framework.UI.WinForms.ClientSession.OnFormToShow(Microsoft.Dynamics.Framework.UI.LogicalForm, Microsoft.Dynamics.Framework.UI.LogicalControl)
at Microsoft.Dynamics.Framework.UI.UISession.ShowDialog(Microsoft.Dynamics.Framework.UI.LogicalForm, Microsoft.Dynamics.Framework.UI.LogicalForm)
Exception Info: System.Reflection.TargetInvocationException
at System.RuntimeMethodHandle.InvokeMethod(System.Object, System.Object[], System.Signature, Boolean)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(System.Object, System.Object[], System.Object[])
at System.Delegate.DynamicInvokeImpl(System.Object[])
at Microsoft.Dynamics.Framework.UI.WinForms.ExceptionWrapper.RunTryCatch(System.Object, System.Delegate, System.Object[])
Thx in advance,
Andy
I have created a javascript add-in that uses leaflet to display map information. This works fine, however from time to time NAV crashes when the page with the add-in is closed. I think there is a problem with an event that is triggered after the page is closed, however I cannot find what it can be.
Does anyone know a way to find the issue?
We are using NAV2017 CU23 (RTC, not web client)
This is (part of) the error that is logged in the event viewer:
Application: Microsoft.Dynamics.Nav.Client.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.AccessViolationException
at System.Windows.Forms.UnsafeNativeMethods+IOleInPlaceActiveObject.TranslateAccelerator(MSG ByRef)
at System.Windows.Forms.WebBrowserBase.PreProcessMessage(System.Windows.Forms.Message ByRef)
at Microsoft.Dynamics.Framework.UI.WinForms.WebBrowserForNavigation.PreProcessMessage(System.Windows.Forms.Message ByRef)
at System.Windows.Forms.Control.PreProcessControlMessageInternal(System.Windows.Forms.Control, System.Windows.Forms.Message ByRef)
at System.Windows.Forms.Application+ThreadContext.PreTranslateMessage(MSG ByRef)
at System.Windows.Forms.Application+ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr, Int32, Int32)
at System.Windows.Forms.Application+ThreadContext.RunMessageLoopInner(Int32, System.Windows.Forms.ApplicationContext)
at System.Windows.Forms.Application+ThreadContext.RunMessageLoop(Int32, System.Windows.Forms.ApplicationContext)
at System.Windows.Forms.Form.ShowDialog(System.Windows.Forms.IWin32Window)
at Microsoft.Dynamics.Framework.UI.WinForms.Controls.BusinessForm.ShowDialog(System.Windows.Forms.Form, System.Windows.Forms.IWin32Window)
at Microsoft.Dynamics.Framework.UI.WinForms.FormPanel.DoModal(Microsoft.Dynamics.Framework.UI.LogicalForm)
at Microsoft.Dynamics.Framework.UI.Windows.LogicalFormAdapterBase.DoModal(Microsoft.Dynamics.Framework.UI.LogicalForm)
at Microsoft.Dynamics.Framework.UI.Windows.ClientSessionBase.OnFormToShow(Microsoft.Dynamics.Framework.UI.LogicalForm, Microsoft.Dynamics.Framework.UI.LogicalControl)
at Microsoft.Dynamics.Framework.UI.WinForms.ClientSession.OnFormToShow(Microsoft.Dynamics.Framework.UI.LogicalForm, Microsoft.Dynamics.Framework.UI.LogicalControl)
at Microsoft.Dynamics.Framework.UI.UISession.ShowDialog(Microsoft.Dynamics.Framework.UI.LogicalForm, Microsoft.Dynamics.Framework.UI.LogicalForm)
Exception Info: System.Reflection.TargetInvocationException
at System.RuntimeMethodHandle.InvokeMethod(System.Object, System.Object[], System.Signature, Boolean)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(System.Object, System.Object[], System.Object[])
at System.Delegate.DynamicInvokeImpl(System.Object[])
at Microsoft.Dynamics.Framework.UI.WinForms.ExceptionWrapper.RunTryCatch(System.Object, System.Delegate, System.Object[])
Thx in advance,
Andy
0
Answers
-
Does your event viewer give any more information than this?
Is the client run with administrator privileges?0 -
System is saying some unhandled exception for this so you need to debug this and figure out, remove your addin and see if its working and if its working then verify your addin as there's something wrong as from NAV'S Protocol OR If something from NAV you have to do to handle that.Thanks
Blog - rockwithnav.wordpress.com/
Twitter - https://twitter.com/RockwithNav
Facebook - https://facebook.com/rockwithnav/0 -
Does your event viewer give any more information than this?
Is the client run with administrator privileges?
0 -
RockWithNAV wrote: »System is saying some unhandled exception for this so you need to debug this and figure out, remove your addin and see if its working and if its working then verify your addin as there's something wrong as from NAV'S Protocol OR If something from NAV you have to do to handle that.
The only object on the page is the add-in, and some actions. Removing the addin makes the page useless, but of course it works then. I would like to debug the addin, but this is a javascript addin running in the RTC. I haven't found a way yet to do this. I can debug it using the web client, but this is a different program0 -
RockWithNAV wrote: »System is saying some unhandled exception for this so you need to debug this and figure out, remove your addin and see if its working and if its working then verify your addin as there's something wrong as from NAV'S Protocol OR If something from NAV you have to do to handle that.
more precisely System.AccessViolationException
Which could be several things, like trying to perform an operation administrative privileges, or access something you don't have permission to.
RockWithNAV is right - always try to use the debugger to find the culprit.0 -
I attached the full event viewer message as images (too long to post, and can't seem to add a txt file). The client is run with normal priviliges
can you try to run it as administrator?
0 -
I attached the full event viewer message as images (too long to post, and can't seem to add a txt file). The client is run with normal priviliges
can you try to run it as administrator?
0 -
RockWithNAV wrote: »System is saying some unhandled exception for this so you need to debug this and figure out, remove your addin and see if its working and if its working then verify your addin as there's something wrong as from NAV'S Protocol OR If something from NAV you have to do to handle that.
more precisely System.AccessViolationException
Which could be several things, like trying to perform an operation administrative privileges, or access something you don't have permission to.
RockWithNAV is right - always try to use the debugger to find the culprit.
Can you explain how I can debug this? It's not a NAV error, and I don't know how to debug a javascript addin using the RTC0 -
If you wish to debug control-addins, I'm fairly sure you could use Visual Studio and select "Attach to Process" under the Debug pane, and select "Microsoft.Dynamics.Nav.Client.exe"
You said you wrote the add-in yourself; does it do anything specific when closed?
I'm somewhat confident, that the issue was due to lack of privileges (why it wouldnt crash with administrative privileges)
0 -
If you wish to debug control-addins, I'm fairly sure you could use Visual Studio and select "Attach to Process" under the Debug pane, and select "Microsoft.Dynamics.Nav.Client.exe"
You said you wrote the add-in yourself; does it do anything specific when closed?
I'm somewhat confident, that the issue was due to lack of privileges (why it wouldnt crash with administrative privileges)
I tried to attach in VS, and the debugger is triggered by the error in NAV. But I can't see how to attach the debugger to the code in JS, as you can do with a C# addin.
Thee addin doesn't do anything when it is closed.
I tried to add this code to the add-in:
window.onerror = function (errMsg, url, line, column, error) {
var suppressErrorAlert = true;
return suppressErrorAlert;
};
but this doesn't prevent the crash. Does anyone know if I could suppress it in another way?
0 -
I'm struggling with the error mention - did you ever find a way around it?0
-
In your Javascript add-in, you can add the line
debugger;
This should act as a breakpoint for your addin
If using the browser, you can debug it in the developer menu (For Google Chrome, the hotkey is f12)0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions