AL icon indicating copy to clipboard operation
AL copied to clipboard

Codeunit with ID 50001 is already declared

Open diveshbora opened this issue 8 years ago • 13 comments

When i compile my solution against On-Premise Version of Business Central Preview 02 i get the below compilation error error AL0264: An application object of type 'Codeunit' with ID '50001' is already declared

On Further investigation, i found that the Code unit is visible in the AL Object Browser as below: image

  • AL Extension Version: 2.0.41470

  • Server Version: FI Dynamics NAV 13.0 (24209)

Seems similar to 1044

diveshbora avatar Sep 10 '18 11:09 diveshbora

Please try regenerating symbols as described in https://docs.microsoft.com/en-us/dynamics-nav/developer/devenv-running-cside-and-al-side-by-side

We will look into how the on-prem preview builds are produced. It looks like we include Built Tools codeunit just at the point of time when symbols are generated.

StanislawStempin avatar Sep 14 '18 10:09 StanislawStempin

Hi @StanislawStempin, same problem here with our installation of October's RTM Business Central OnPremise:

AL Language: 2.0.48254 Business Central: ES Dynamics NAV 13.0 (24630) OnPremise

JavierFuentes avatar Dec 16 '18 10:12 JavierFuentes

Hi again @StanislawStempin, I've just had a problem with Symbols after add in C/SIDE a custom field at User Setup table... the problem has been that downloading Symbols again, the file Microsoft_Application_13.0.24623.0.app ONLY had the User Setup table... the rest of Objects were missing...

I had checked the Enable loading application symbols at server startup checkbox as you can see in this screenshot: image

I've launched finsql with the generatesymbolreference activated: finsql.exe generatesymbolreference=yes... but it didn't work, not even restart the Service...

After that, I've compiled ALL Objects in C/SIDE environment with Force option: image

And finally, I've restarted the Service again....

Then, the Symbols have been downloaded with ALL Objects again (ups!), but my surprise is that the version and the size of the file Application file don't match now....

The last file has a version number lower than original one, but its size is 2Mb higher:

image

Application_Symbols.zip

Can you explain this please?

PD.- By the way, the Codeunit 50001 - Build Tools is no longer in the list of symbols now

Versions: AL Language: 2.0.48254 Business Central: ES Dynamics NAV 13.0 (24630) OnPremise

JavierFuentes avatar Dec 16 '18 20:12 JavierFuentes

I assume that the 24630.0 is a symbol file that was provided by the installer. That is a default application symbol file. You cannot work side by side based on that. If you use the generatesymbolreference flag and not the command only those application objects will be generated symbols for that you have selected. The generatesymbolreference command on the other hand will always generate it for all applicable application objects. What happened here is that you have generated symbols from your own database. That may contain more maybe less than the default one that we release. The version of the symbol file if generated from C/SIDE a will be the appversion from your own database. This is the field value for the $ndo$dbproperty::applicationversion column. More details on working side by side here: https://blogs.msdn.microsoft.com/nav/2018/01/16/generate-symbols-in-a-modern-development-environment-with-microsoft-dynamics-nav-2018/ and here: https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/devenv-running-cside-and-al-side-by-side

kalberes avatar Dec 18 '18 17:12 kalberes

Hi @kalberes, I think I undestand that you say, but the second .app file is about 2Mb higher than the first one and I have not made any change in my Business Central C/SIDE environment at the moment...

I've seen that the second file has some Demo Data Generation objects that are not in the first one.

JavierFuentes avatar Dec 23 '18 20:12 JavierFuentes

Hi! I have a problem similar to the above. BUT i just use AL Coding (ok i started the Dev Env to make code analisis.

I just have

  • Codeunit
  • Tableextensions
  • Pageextensions

And i get the errors An application object of type 'PageExtension' with ID '50101' is already declared and A member with name 'FieldName' is already defined

But if i publish the app, i can do it without problems.... so just my "Problems" window is very busy..

extranrollo avatar May 07 '19 15:05 extranrollo

Escuse me, i forgot this Name: AL Language Version: 3.0.106655

With this docker container: mcr.microsoft.com/businesscentral/onprem:de-ltsc2019

extranrollo avatar May 07 '19 16:05 extranrollo

Hi! I have a problem similar to the above. BUT i just use AL Coding (ok i started the Dev Env to make code analisis. But if i publish the app, i can do it without problems.... so just my "Problems" window is very busy..

I have the exact same problem here. It doesn't occur on a new extensions, but as soon as I build once and then continue programming, everything I touch starts showing up as if it already exists. Builds after that are fine, but it is seriously annoying.

I run AL language version 3.0.126610, but also 3.0.106655 and two versions for NAV 2018 (have only one on per workspace of course). All 4 show this problem, I'm thinking the problem is somewhere else but can't put my finger on it.

bctails avatar Jun 11 '19 20:06 bctails

Found my solution. VS Code seems to have problems with UNC paths.

Short story long: https://www.dynamicstailor.eu/201906/an-application-object-of-type-x-is-already-declared/

@diveshbora @boomerama Does this also fix it for you? And if so, should we mention this as a VS Code bug?

bctails avatar Jun 13 '19 23:06 bctails

This issue has been fixed in the Wave 2 2019 release.

atoader avatar Oct 03 '19 20:10 atoader

This issue has been fixed in the Wave 2 2019 release.

Hi! it is not! I am just working on a "CRONUS" database (released with Wave 2), everything is stored on a local device (no UNC paths) and I am only creating AL objects. And I get a lot of these errors. Please let me know if you need any sampes, thx!

scriddler avatar Oct 07 '19 11:10 scriddler

This error can also be caused, if anything is wrong with the references of the corresponding application object.

I got the same error for a page object. In my case the reason for that was an action pointing to that page object by using RunObject. The action also contained the Image-property using the following form: Image = New(); Of course, the trailing parenthesis are wrong. Believe it or not: These parentheses caused the error in my case. Removing them solved the issue.

That means, if you got the error you’ve to check for every reference in your code where the corresponding object is used.

tsomb avatar Oct 18 '19 08:10 tsomb

@scriddler @tsomb can you please open other issues for the problems you are encountering? Please follow our template and provide adequate information to be able to reproduce the issue.

atoader avatar Nov 11 '19 10:11 atoader