BC20.2 ControlAddIn Variable - error AL0157: 'VariableName' is not a valid variable type
1. Describe the bug Compilation error when declaring a variable of type ControlAddIn Same as issue - https://github.com/microsoft/AL/issues/7055 but on the current released version - 20.2.41144.41423 2. To Reproduce Steps to reproduce the behavior:
- Go to '...'
codeunit 50100 "PTE ControlAddIn Mgt"
{
var
t: ControlAddIn OAuthControlAddIn; // this errors out
trigger OnRun()
begin
end;
}
3. Expected behavior This was not an issue in previous versions
4. Actual behavior Compile error
5. Versions:
- AL Language:
- Visual Studio Code:
- Business Central: 20.2.41144.41423
- List of Visual Studio Code extensions that you have installed:
Hi @catadumitru, what version of the AL extension you are using, the one from marketplace or the one coming from docker container? If it is the one from marketplace, we haven't yet released the updated version, this will happen next week.
This is the AL extension from the container as I first noticed this from a build pipeline.
Builds on 20.2 with the above code fail.
Thank you, we will verify.
Also, our appsource app cannot be installed on the new cloud version because of this issue.
We also have this issue with our current Extensions. All of them use Control addin as a variable to encapsulate the handling of it to a codeunit and now they cannot be installed from AppSource witht he error message from the title in the current 20.2 version.
We will check exactly what is happening because I remember we revert the change as it is mentioned here https://github.com/microsoft/AL/issues/7055#issuecomment-1137216978.
We have Codeunits that
- have global variables of
ControlAddIntype, - copy them from Pages'
ControlAddIns passed to an initialisation function in the Codeunit, and - do stuff with them afterwards in that Codeunit.
Thus I guess that
ControlAddInis a reference type- whatever we were doing with it is OK, maybe because we reassign the global reference to point at a valid
ControlAddIninstantiated by the Page, rather than the one instantiated (or not?) by the Codeunit
So I would think then that
- our existing code will work again in the next version?
- to avoid doing this, in case it again becomes an error later, we will have to pass the
ControlAddIns to all functions in such Codeunits that need them, instead of 'storing' them as a global in the Codeunit... which seems a best practice anyway.
Do I understand correctly? Thanks!
We are experiencing the same problem in an SaaS enviroment (version 20.2.41144.41547) when we try to install our extensions, this is pretty critical as we´re blocked with that customer.
Hi @nndobrev Can you please let us know in which version this is/was expected to be fixed? I just tested it with the current SaaS version and still get the error.
Version in which we had the initial problem on friday: Version: GB Business Central 20.2 (Platform 20.0.41086.41862 Application 20.2.41144.41547
Version I tested with just now: Version: GB Business Central 20.2 (Platform 20.0.41086.42065 + Application 20.2.41144.41547)
In both cases the installation from AppSource fails with the following error:
Deployment failed. Errors: App ID : 5716c909-a743-461e-ac12-d99759152986 Message : { Extension compilation failed
src_Base_Module/NETVPSControlAddInShell.Codeunit.al(46,15): error AL0157: 'NetronicVSControlAddIn' is not a valid variable type } - Job Id : 5d74f919-06cf-4d05-bc42-53eb830ab9b6
The same applies to all our other extensions in appsource. This currently renders our complete product line (3 extensions) uninstallable/unusable in version BCv20.2
Looking forward to your feedback. I left the same comment in #7055 to follow up on both threads. Thank you very much.
Our pipeline is also failing with the same error message on BC 20.2.41144.42196. Tested the same code on older version (20.1.39764.41791) it ran fine without an error.
error AL0157: 'CustomControlAddin' is not a valid variable type
Hello everyone,
Heads up! The hotfix is rolling out right now. The updated version is Platform 20.0.41086.42208.
Best, Nikolay
Hi @nndobrev I can confirm that the mentioned version was rolled out to our environment today and I could successfully install all our extensions again.
We are happy to hear that @SHermann73. @catadumitru can you please confirm as well in order for us to close this issue.
We fixed the problem before the new version was rolled out marking the problematic procedures as obsolete.
we also fixed our code by refactoring, so we can trust the test made by @SHermann73