Business Central 2024 wave 1 (BC24): Whitespaces in names are internally replaced with an underscore during compilation

Dynamics 365 Business Central

Hi, Readers.
Dynamics 365 Business Central 2024 wave 1 (BC24) is generally available. More details: General availability: Dynamics 365 Business Central 2024 release wave 1 (BC24)

I will continue to test and share some new features that I hope will be helpful.

In this post, I would like to share a new compiler warning (Future Error) in Business Central 2024 release wave 1 (BC24). This is not yet documented in the Business Central 2024 release wave 1 (BC24) release plan. But it is mentioned in AL Language extension changelog Version 13.0

Added warning AL0803 when the names of two events or event subscribers conflict within the same object. Whitespaces in names are internally replaced with an underscore during compilation, such that two different names can collide. For example, “my event” and “my_event” are conflicting names. From runtime 15.0, an error will be reported with AL0757.

https://marketplace.visualstudio.com/items/ms-dynamics-smb.al/changelog

AL0803
White spaces in names are internally replaced with an underscore during compilation, so that two different names can collide. This diagnostic is specific to event and event subscriber methods.

Like other languages, AL methods are a fundamental programming element. A method, also known as a procedure, is a named group of statements that perform an operation or task. 
To declare a method, follow these guidelines:

  • Include a space after a semicolon when declaring multiple arguments.
  • Semicolons can be used at the end of the signature/method header. If you use a snippet, the semicolons aren’t automatically added.
  • Methods are named as variables using Pascal case. However, this isn’t a mandatory rule.
  • There must be a blank line between method declarations. If you format your code using the AL Formatter tool, the autoformatter sets the blank line between procedures.

Example,

local procedure MyProcedure(Customer: Record Customer; Int: Integer)
begin
end;

// space

local procedure MyProcedure2(Customer: Record Customer; Int: Integer)
begin
end;

This is a minor update in this wave, but needs attention. For example,

The name of Method ‘my_event’ conflicts with Method ‘my event’ defined in Codeunit ‘MyCodeunit’ by the extension ‘BC24 Test by YUN ZHU (1.0.0.2)’. Choose another name for one of them. Otherwise, this might cause runtime issues. This warning will become an error when targeting a runtime with version ‘15.0’ or higher.

As mentioned above, this diagnostic is specific to event and event subscriber methods as of now.

But for variables, doing so causes the following error.

The name of GlobalVariable ‘my Int’ conflicts with GlobalVariable ‘my_Int’ defined in Codeunit ‘MyCodeunit’ by the extension ‘BC24 Test by YUN ZHU (1.0.0.2)’. Choose another name for one of them. Otherwise, this might cause runtime issues.

So whether it is in the event and event subscriber methods or not, I personally recommend not appending spaces or other symbols to method names. For example, please refer to the names of standard methods below.

This will become an error from runtime 15.0 (Business Central 2025 release wave 1). Please check the code again.

PS: Some Suggested Abbreviations

AbbreviationText
Absabsence
Accaccount
Accaccounting
Accumaccumulated
Actaction
Activactivity
Addadditional
Addraddress
Adjadjust
Adjdadjusted
Adjmtadjustment
Agrmtagreement
Allocallocation
Allowallowance
Altalternative
Amtamount
Amtsamounts
Ansanswer
Applapplies
Applnapplication
Arrivarrival
Asmassembly
ATOassemble to order
Assgntassignment
Assocassociated
Attmtattachment
Authauthorities
Autoautomatic
Availavailability
Avgaverage
BAba db.
Balbalance
BOMbill of materials
Blnktblanket
Budgbudget
Bufbuffer
Busbusiness
BIMbusiness interaction management
Buybuying
Calccalculate
Calcdcalculated
Calcucalculation
Calcalendar
Capcapacity
CRPcapacity requirements planning
CFcash flow
CFcashflow
ctlgcatalog
Catcategory
CPUCentral Processing Unit
Ctrcenter
Chgchange
Chgschanges
Charcharacter
Charscharacters
Chrgcharge
Chrgscharges
Chkcheck
Classclassification
collcollection
colcolumn
Cmtcomment
Cocompany
Compcomponent
Cmpltncompletion
Compscomponents
Compncomposition
Comprcompression
Concrntconcurrent
Confconfidential
Cnfrmnconfirmation
Conflconflict
Consolconsolidate
Consolidconsolidation
Consumpconsumption
Contcontact
Cntrcontainer
Contrcontract
Contrdcontracted
Ctrlcontrol
Ctrlscontrols
Convconversion
Corcorrection
Correscorrespondence
Correspcorresponding
Cstcost
COGSsold
Crcredit
Cumulcumulate
Currcurrency
Crntcurrent
Custcustomer
CVcustomer/vendor
Dlydaily
Dampdampener
DBMSdatabase management system
Ddate
Defdefinition
Demodemonstration
Deptdepartment
DPdepartment/project
Deprdepreciation
Descdescription
Dtldetail
Dtlddetailed
Dtlsdetails
Devdeviation
Diffdifference
Dimdimension
Dirdirect
Discdiscount
Discrdiscrete
Distrdistribute
Distrddistributed
Distbtrdistributor
Distrndistribution
Docdocument
Duplduplicate
Entrdentered
Enginengineering
Exchexchange
Exclexcluding
Execexecute
Expdexpected
Expedexpedited
Expexpense
Exprexpression
Expirexpiration
Extextended
Explexplode
Exptexport
Fnlfinal
Finfinance
Fiscfiscal
Fnshdfinished
FAfixed asset
Fwdforward
Frtfreight
Gengeneral
GLgeneral ledger
Grgroup
Hdrheader
Histhistory
Holholiday
HRhuman resource
IDidentification
Impimport
Inbndinbound
Inclincluding
Incldincluded
Incmgincoming
ISVindependent software vendor
Industindustry
Infoinformation
Initinitial
IntraIntrastat
Interactinteraction
Integrintegration
Intinterest
IntmInterim
IPinternal protocol
Invtinventory
Invtblinventoriable
Invinvoice
Invdinvoiced
ITitem tracking
Jnljournal
Langlanguage
Ledgledger
Lvllevel
Lnline
Ltlist
LCYlocal currency
Loclocation
Mailmailing
Maintmaintenance
Mgtmanagement
Manmanual
Mfgmanufacturing
Mfrmanufacturer
Matmaterial
Mktgmarketing
Maxmaximum
Measmeasure
Msgmessage
Minminimum
Miscmiscellaneous
Modmodify
Mthmonth
Negnegative
NonInvtblnon-inventoriable
Notifnotification
Nonumber
Nosnumbers
Objobject
Operoperating
Oppopportunity
Ordorder
Ordsorders
Origoriginal
Orgorganization
Outbndoutbound
OutgOutgoing
Outoutput
Outstdoutstanding
Ovhdoverhead
Pmtpayment
Pctpercent
Persnlpersonnel
Physphysical
Picpicture
Plngplanning
Pstdposted
Postposting
Pospositive
Precprecision
Prepmtprepayment
Prodproduct
Prodproduction
ProdOrdproduction order
Projproject
Propproperty
Prspct  prospect
Purchpurchase
Purchpurchases
Purchrpurchaser
PurchOrdpurchase order
Qltyquality
Qtyquantity
Questnquestionnaire
Qtequote
RFradio frequency
Rngrange
Rcptreceipt
Rcdreceived
Recrecord
Recsrecords
Recnclreconcile
Reconreconciliation
Recurrecurring
Refreference
Regregister
Regnregistration
Regdregistered
Relrelation
Relsrelations
Rlshprelationship
Rlserelease
Rlsdreleased
Remremaining
Rmdrreminder
Replreplacement
Rplnshreplenish
Rplnshtreplenishment
Rptreport
Reprepresent
Repdrepresented
Rqstrequest
Reqdrequired
Reqtrequirement
Reqtsrequirements
Reqrequisition
Rsvreserve
Rsvdreserved
Reservreservation
Resolresolution
Resresource
Rspresponse
Respresponsibility
Rtnretain
Rtndretained
Retreturn
Retsreturns
Revalnrevaluation
Revreverse
Rvwreview
Rndround
Rnddrounded
Rndgrounding
Rteroute
Rtngrouting
Routroutine
Salessales & receivables
Safsafety
Schedschedule
Secsecond
Segsegment
Selselect
Selctnselection
Seqsequence
Serserial
SNserial number
Servservice
Shsheet
Shptshipment
Srcsource
Spclspecial
Specspecification
Specsspecifications
Stdstandard
SFfrequency
Stmtstatement
Statstatistical
Statsstatistics
Stkstock
SKUstockkeeping unit
Stmstream
SQLstructured query language
Subcontrsubcontract
Subcontrdsubcontracted
Subcontrgsubcontracting
Subsubstitute
Substsubstitution
Sugsuggest
Sugdsuggested
Sugnsuggestion
Sumsummary
Suspdsuspended
Symptsymptom
Synchsynchronize
Temptemporary
Tottotal
Transactransaction
Transtransfer
Translntranslation
Trkgtracking
Tblshttroubleshoot
Tblshtgtroubleshooting
UOMunit of measure
UTunit test
Unrealunrealized
Unrsvdunreserved
Updupdate
Valnvaluation
Valvalue
VATvalue added tax
Varvariance
Vendvendor
Whsewarehouse
WSweb shop
Wkshworksheet
GLg/l
Pct%
Three-Tier3-tier
OsynchOutlook Synch

END

Hope this will help.

Thanks for reading.

ZHU

コメント

Copied title and URL