Big news, it seems that Microsoft is fixing the issues we’ve found in our App for AppSource. Both the functions on the TempBlob and the Language table will be added back!
But also, let’s continue where we left off with the previous episodes because there are more challenges that won’t be fixed. Let’s see if we can fix some reference problems.
Before we do that, please allow me to repeat that despite these breaking changes Business Central remains by far the best customizable ERP system in the cloud.
For this blog post I’m going to fix the errors in the ForNAV Modern Object Designer as Extention. Benefit is that you can do this yourself too. Just download it from http://www.fornav.com, convert it using the fornav converter against spring and than connect it to the Docker. (end of advertizing ForNAV)
After connecting the extension to Fall we see that the codeunit NavExtensionInstallationMgt is missing.
However… this is not true, and very confusing.
Reason for this, is that Microsoft RENAMED a codeunit (they actually renamed a bunch). Now in the old days this was NOT DONE, even though in this case C/Side would have handled the rename for us because C/Side works at compile time with object ID’s. This is because C/Side was developed in the late ’80ies early ’90ies when memory was expensive.
Visual Studio Code works with object names. So how do we figure out the new name for this codeunit???
The obvious answer here would be to install the ForNAV Modern Object Explorer but hey, we are fixing this now right? So let’s go nerdy and hack into SQL and see what’s going on there.
In C/Side we can see that the Codeunit ID is 2500. But Fall does not ship C/Side.
Let’s see what we can find in the SQL Server database.
If you run Docker you can still access SQL via Management studio. An SA account is created with the same password as your NAV user. The SQL does not have an instance, so just connect to the IP address of the container.
The default name of the database is Financialsw1 which I think is funny and a remainder of our temporary product name. If you want you can also relate it back to Navision Financials.
First place to look would be the Object Table. So let’s run a query.
Select * from [Object]
No results, which makes sense because there is no more C/Side and all code is in an Extension.
SELECT [Object Name], * FROM [NAV App Object Metadata] where [Object ID] = 2500
So let’s see what we can find in the NAV App Object Metadata table
Here it is, and now it is called “Extension Installation Impl”. So let’s try that!
So we’ve found the codeunit’s new name. Yeah! Let’s change it and see what happens.
One of the functions started working, but one did not, and the codeunit still does not compile.
The reason for this is the protection level of the codeunit, and a broken contract. But how do we investigate that?
If you try Go To Definition on the object, you still get a “D/AL” file with no code, and it seems like Microsoft is not shipping the AL code in the App file on the Docker Container for the System app. Also we don’t know yet if it is in the system app.
Back to SQL Server
select * from [NAV App] where [Package ID] = '6418C5AF-4672-43DA-AD73-FF140FBBD537'
From the previous query we know that the App the object belongs to has ID 6418C5AF-4672-43DA-AD73-FF140FBBD537.
If we query that app in the NAV App table we can see it is system.
Now the next thing we need to do is clone the GitHub from https://github.com/microsoft/ALAppExtensions. This will get us the sourcecode, but Go To Definition does not work.
I’ll make it easy for you, the code is in https://github.com/microsoft/ALAppExtensions/tree/master/Modules/System/Extension%20Management/src
Codeunit 2500 has a property called Access which is set to Internal. Even if my extension is set to OnPrem I cannot access this function.
In my case, the fix is easy. Just clone the code from CU 2500. It’s a fix I hate but IMHO unavoidable in this case.
When you now run the MOD (Modern Object Designer) and filter on Object ID = 2500 you can see why I like this thing so much…
Now I should be able to export the object from the MOD but when I try I get this error?
And for a good reason, look at the variables!
Remember, we don’t have a Windows Client anymore? So we cannot run DotNet on client either.
For this I need more time to figure out a solution but I would also ask Microsoft to please enhance the compiler. I should not be able to compile and publish this extension against FALL release.