Event bug?

Juhl
Member Posts: 724
Hi all
I have stumbled on a potential bug, or at least a annoying thing regarding Event Subscription.
If I create a OnAfterValidate subscription of a field in a table, and put my code in it. All is good, and code is executed.
If I then change the name of the field I am subscribing to, then the field name in the subscriber function is NOT updated, like normal table field names, used for example in the code of the function. This is updated as normal.
Fair enough, BUT the biggest problem is, that my codeunit compiles without error, even though the field name in the function properties doesn't exist.
Bug or just Bad ? Discovered it before going to production this time, but by accident!
NAV 2017 CU10
I have stumbled on a potential bug, or at least a annoying thing regarding Event Subscription.
If I create a OnAfterValidate subscription of a field in a table, and put my code in it. All is good, and code is executed.
If I then change the name of the field I am subscribing to, then the field name in the subscriber function is NOT updated, like normal table field names, used for example in the code of the function. This is updated as normal.
Fair enough, BUT the biggest problem is, that my codeunit compiles without error, even though the field name in the function properties doesn't exist.
Bug or just Bad ? Discovered it before going to production this time, but by accident!
NAV 2017 CU10
Follow me on my blog juhl.blog
0
Best Answers
-
I think it is not a bug. It is not even bad.
If you think about it, how this is implemented: the publisher-subscriber binding is generated in memory, when NST loads the metadata, not when objects are compiled. Therefore compiler simply does not really need to know if publisher exists at compilation time.
DEV Env helps creating subscribers by looking at publisher signature and creating the same parameters in subscriber definition, but it does not place hard link/reference in the compiled code. Therefore if you change publisher name the subscriber is still valid - when the NST load the metadata there will be no publishers for it - that's all.
Slawek
Slawek Guzek
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-035 -
Hi all,
Yes that's annoying, but not a bug (at least for me).
The link is broken even if you rename a parameter (for example Rec ==> SalesHeader).
You can check broken subscribers in the event subscriptions page.5
Answers
-
I think it is not a bug. It is not even bad.
If you think about it, how this is implemented: the publisher-subscriber binding is generated in memory, when NST loads the metadata, not when objects are compiled. Therefore compiler simply does not really need to know if publisher exists at compilation time.
DEV Env helps creating subscribers by looking at publisher signature and creating the same parameters in subscriber definition, but it does not place hard link/reference in the compiled code. Therefore if you change publisher name the subscriber is still valid - when the NST load the metadata there will be no publishers for it - that's all.
Slawek
Slawek Guzek
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-035 -
I see your point Slawek.
But still I miss some kind of validation process or a way to check for subscribers with no publisher. Just like when we compile all object to see if all adds up.
One could write a check procedure, if I had the time :-)
Thanks får your input.Follow me on my blog juhl.blog0 -
Hi all,
Yes that's annoying, but not a bug (at least for me).
The link is broken even if you rename a parameter (for example Rec ==> SalesHeader).
You can check broken subscribers in the event subscriptions page.5
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