code change · featureAL Developmentofficial - Microsoftreviewed - checked by Opus

#144 Avoid Public Event publisher

A new community knowledge article with samples advises declaring event publishers local or internal instead of public, because the access modifier controls who may raise an event, not who may subscribe. Sample files of four existing Microsoft-layer articles drop their incidental public modifier.

Pull request · merged into main on 2026-09-02 by pri-kise · 7 files (+148 -4), 7 AL · feature · tier official · reviewed (checked by Opus)

What changed

  • Publisher access modifiers govern who may raise the event, not who may subscribe
  • A public publisher becomes a caller contract that cannot be narrowed after release
  • Use local when only the declaring object raises it, internal behind a public facade
  • New community article with good and bad samples
  • Four publishers in existing Microsoft-layer sample files lose their incidental public modifier

AL objects touched

  • community/knowledge/events/declare-event-publishers-local-or-internal.bad.al: added, not in the BC? snapshot yet
  • community/knowledge/events/declare-event-publishers-local-or-internal.good.al: added, not in the BC? snapshot yet
  • community/knowledge/events/declare-event-publishers-local-or-internal.md: added, not in the BC? snapshot yet
  • microsoft/knowledge/events/avoid-raising-events-inside-try-functions.bad.al: modified, not in the BC? snapshot
  • microsoft/knowledge/events/avoid-raising-events-inside-try-functions.good.al: modified, not in the BC? snapshot
  • microsoft/knowledge/security/commitbehavior-attribute-scopes-explicit-commits.bad.al: modified, not in the BC? snapshot
  • microsoft/knowledge/security/commitbehavior-attribute-scopes-explicit-commits.good.al: modified, not in the BC? snapshot

Context

  • Systems: development
  • From the description: “the access modifier governs who may raise the event, not who may subscribe”

Source: metadata of a merged pull request in microsoft/BCQuality (bcquality): title, labels, changed paths and counts, with a summary in our words. No source text and no description beyond one short quote (D10, D61).