Event subscriber crash not caught by NAV

EvR
Member Posts: 178
Hi all,
One of my event subscribers in NAV2016 is causing an unhandled exception.

As soon as the event is fired, I'm getting this exception in the client:

The NST event viewer:
Type: System.NullReferenceException
Message: Object reference not set to an instance of an object.
StackTrace:
at Microsoft.Dynamics.Nav.EventSubscription.NavEventScope.CallEventSubscriber(NavEventSubscription subscriber, NavCodeunit subscriberCodeunitInstance, Object[] parameters)
at Microsoft.Dynamics.Nav.EventSubscription.NavEventScope.ProcessCallToAllSubscribers(NavApplicationObjectBase callerApplicationObject, PrepareParametersCallBack prepareParameters)
at Microsoft.Dynamics.Nav.Runtime.NavRecord.ValidateField(Action`1 fieldEvent, NCLMetaField metaField, Boolean isUserInput)
at Microsoft.Dynamics.Nav.Runtime.NavRecord.Validate(NCLMetaField metaField, NavValue newValue, NavRecord callerRecord, Boolean isUserInput)
at Microsoft.Dynamics.Nav.Runtime.NavRecord.Validate(NCLMetaField metaField, NavValue newValue, NavRecord callerRecord)
at Microsoft.Dynamics.Nav.BusinessApplication.Codeunit60015.CreateServItemLines_Scope.OnRun()
at Filter.InvokeWithFilter(NavMethodScope )
at Microsoft.Dynamics.Nav.BusinessApplication.Codeunit60015.CreateServItemLines(INavRecordHandle ServRegHeader, INavRecordHandle vRecServHeader)
at Microsoft.Dynamics.Nav.BusinessApplication.Codeunit60015.WizardFinish_Scope.OnRun()
at Filter.InvokeWithFilter(NavMethodScope )
at Microsoft.Dynamics.Nav.BusinessApplication.Codeunit60015.WizardFinish(INavRecordHandle vRecServRegHeader)
at Microsoft.Dynamics.Nav.BusinessApplication.Codeunit60015.OnInvoke(Int32 memberId, Object[] args)
at Microsoft.Dynamics.Nav.BusinessApplication.Page60015.FinishWizard_Scope.OnRun()
at Filter.InvokeWithFilter(NavMethodScope )
at Microsoft.Dynamics.Nav.BusinessApplication.Page60015.FinishWizard()
at Filter.InvokeWithFilter(NavMethodScope )
at Microsoft.Dynamics.Nav.BusinessApplication.Page60015.Finish_a45_OnAction()
Source: Microsoft.Dynamics.Nav.Ncl
HResult: -2147467261
If I remove the subscriber, the issue is gone. As soon as I manually re-create it, it crashes again.
There is no code behind the validate of the field. And no real code in the subscriber (it even crashes with 'IF TRUE THEN;').
Any ideas?
One of my event subscribers in NAV2016 is causing an unhandled exception.

As soon as the event is fired, I'm getting this exception in the client:

The NST event viewer:
Type: System.NullReferenceException
Message: Object reference not set to an instance of an object.
StackTrace:
at Microsoft.Dynamics.Nav.EventSubscription.NavEventScope.CallEventSubscriber(NavEventSubscription subscriber, NavCodeunit subscriberCodeunitInstance, Object[] parameters)
at Microsoft.Dynamics.Nav.EventSubscription.NavEventScope.ProcessCallToAllSubscribers(NavApplicationObjectBase callerApplicationObject, PrepareParametersCallBack prepareParameters)
at Microsoft.Dynamics.Nav.Runtime.NavRecord.ValidateField(Action`1 fieldEvent, NCLMetaField metaField, Boolean isUserInput)
at Microsoft.Dynamics.Nav.Runtime.NavRecord.Validate(NCLMetaField metaField, NavValue newValue, NavRecord callerRecord, Boolean isUserInput)
at Microsoft.Dynamics.Nav.Runtime.NavRecord.Validate(NCLMetaField metaField, NavValue newValue, NavRecord callerRecord)
at Microsoft.Dynamics.Nav.BusinessApplication.Codeunit60015.CreateServItemLines_Scope.OnRun()
at Filter.InvokeWithFilter(NavMethodScope )
at Microsoft.Dynamics.Nav.BusinessApplication.Codeunit60015.CreateServItemLines(INavRecordHandle ServRegHeader, INavRecordHandle vRecServHeader)
at Microsoft.Dynamics.Nav.BusinessApplication.Codeunit60015.WizardFinish_Scope.OnRun()
at Filter.InvokeWithFilter(NavMethodScope )
at Microsoft.Dynamics.Nav.BusinessApplication.Codeunit60015.WizardFinish(INavRecordHandle vRecServRegHeader)
at Microsoft.Dynamics.Nav.BusinessApplication.Codeunit60015.OnInvoke(Int32 memberId, Object[] args)
at Microsoft.Dynamics.Nav.BusinessApplication.Page60015.FinishWizard_Scope.OnRun()
at Filter.InvokeWithFilter(NavMethodScope )
at Microsoft.Dynamics.Nav.BusinessApplication.Page60015.FinishWizard()
at Filter.InvokeWithFilter(NavMethodScope )
at Microsoft.Dynamics.Nav.BusinessApplication.Page60015.Finish_a45_OnAction()
Source: Microsoft.Dynamics.Nav.Ncl
HResult: -2147467261
If I remove the subscriber, the issue is gone. As soon as I manually re-create it, it crashes again.
There is no code behind the validate of the field. And no real code in the subscriber (it even crashes with 'IF TRUE THEN;').
Any ideas?
0
Answers
-
Someone say me that Events in 2016 don't works fine. The solution maybe restarts the services after any modification in objects.
0 -
Nope. Restarting the service makes no difference. Recompiling the entire application doesn't either.
And I'm very much allergic to comments like 'Someone, somewhere, once told me that technology x doesn't work'0 -
I agree - and I can add some facts :-)
I know of one bug related to modifications of object (there can be some I don't know about off cause :-) ):
In NAV 2016/2017 (some or all?) table events stopped to be fired on a table if it had flowfields to another table which was changed. It is quite easy to reproduce.
It was fixed in NAV 2016 CU16 and NAV 2017 CU4.
It is bug ID 203304: "Events stop being triggered after compiling other objects".
It did not trigger an exception, the trigger just stopped calling subscribers... So I dont belive it is related to what you are seeing.
Anyway, if you use table triggers, please make sure to platform upgrade or at least compile all codeunits or restarting the service after changing tables...0 -
importing objects (typically from a dev database to production) without recompiling can cause this problem - do a F11 recompileDavid Machanick
http://mibuso.com/blogs/davidmachanick/0 -
It was an object that has been in the database for ages, and the subscriber has always worked before.
A complete database re-compile was the first thing I tried after restarting the service. Still no idea what caused it.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