The request for path failed with code 422. Reason: Value cannot be null. Parameter name: element
I am trying to publish my extension to the Microsoft Cloud Sandbox but I get the following error:
Microsoft (R) AL Compiler version 0.16.19969
Copyright (C) Microsoft Corporation. All rights reserved
[2018-07-17 08:16:01.11] Authenticating...
[2018-07-17 08:16:02.07] Sending request to https://api.businesscentral.dynamics.com/v1.0/sandbox/dev/apps?SchemaUpdateMode=synchronize
[2018-07-17 08:16:14.16] The request for path /v1.0/sandbox/dev/apps?SchemaUpdateMode=synchronize failed with code 422. Reason: Value cannot be null.
Parameter name: element
I have already tried to remove the translation file but no result. (Same error :https://github.com/Microsoft/AL/issues/1656) Is there a way to see more detailed errors?
It looks similar to the underlying issue described in #2368 and #2367. Your error should then come from an event subscriber you have in your extension.
Can you try commenting out your event subscriber methods in order to find which one creates the error so that we can reproduce the issue?
I found the subscriber that is causing it, but I don't see what is wrong. Deploys fine on NAV2018 CU6.
[EventSubscriber(ObjectType::Table, Database::Item, 'OnAfterDeleteEvent', '', true, true)]
local procedure OnAfterDeleteEvent(var Rec: Record Item; RunTrigger:Boolean);
begin
Message('test');
end;
I found it, apparently you cannot name your functions like events (Usually I don't do this I must have been confused). So this fails: [EventSubscriber(ObjectType::Table, Database::Item, 'OnAfterDeleteEvent', '', true, true)] local procedure OnAfterDeleteEvent(var Rec: Record Item; RunTrigger:Boolean); But this works: [EventSubscriber(ObjectType::Table, Database::Item, 'OnAfterDeleteEvent', '', true, true)] local procedure OnAfterDeleteEvent_T27(var Rec: Record Item; RunTrigger:Boolean);
If it helps: I just downloaded Microsoft's AppMonetizationDemo from the PartnerSource, to have a look at it, and I get the same error when I try to deploy it, unmodified, to our Sandbox.
(AL Language version: 0.16.19969).
I am getting the same error
For Microsoft's AppMonetizationDemo from the PartnerSource, the issue is on the two events inside StripeIntegration codeunit but I do not know how to resolve it. I do not see anything wrong.
[EventSubscriber(ObjectType::Table,Database::Customer, 'OnBeforeSayHelloWorld', '', false, false)]
procedure CheckAccessLevel_OnBeforeSayHelloWorldCustomer(var Rec : Record Customer;var Handled : Boolean)
[EventSubscriber(ObjectType::Table,Database::Vendor,'OnBeforeSayHelloWorld','',false,false)]
procedure CheckAccessLevel_OnBeforeSayHelloWorldVendor(var Rec : Record Vendor;var Handled : Boolean)
Help please.
Can you try renaming 2 of the 3 instances of the procedure OnBeforeSayHelloWorld (event publishers) to have distinct names? I believe you are hitting a bug we just became aware of and are fixing in our master branch. As long as all publishers in the same assembly (project) have distinct names, you should not hit it.
This restriction will be fixed once an updated platform is available and publisher name uniqueness will only be required in the context of each object rather than the entire extension assembly.
I tried on our latest master using an event subscriber whose name is the same as an event and it worked:
[EventSubscriber(ObjectType::Table, Database::Item, 'OnAfterDeleteEvent', '', true, true)]
local procedure OnAfterDeleteEvent(var Rec: Record Item; RunTrigger:Boolean);
Concerning the second one, I tried publishing an extension containing two events publishers with the same name (in two different objects) and this works as well.
Closing the issue. Please feel free to open a new one if you can still reproduce it on our latest versions.