Al: failed with code PackageValidationFailed

Created on 20 Apr 2018  路  18Comments  路  Source: microsoft/AL

Is there anyway to get the validation error from Business Central?

What I've done:

  • Created a extension, it is in the range of 81000. It contains, all types of objects.
  • I've developed it against the latest BC Docker. No problems there, I can run it without problems there.
  • When I try to upload it to our Business Centrel Trial created friday, it fails with this error message:

"Publish operation failed with code PackageValidationFailed. Details: Package validation failed. Please contact Administrator for more information. "

As my old teacher in Assembly said, "Programmers are not allowed to do wrong". But the truth is that we are only humans. :-D How can I see what's missing or wrong???

question

Most helpful comment

The PackageValidationError is because of a known issue in the processing of the validation rules in the Extension Management Regional Service. The issue has been resolved and is currently schedule to be deployed to prod tenatnthis week. The issue occurs when the subscription attribute contains the object name. You can move past this PackageValidationError by making a small code change to use the object id.
For example:
[EventSubscriber(ObjectType::Codeunit, Codeunit::MyEventCodeunit, 'OnMyEvent', '', true, true)]
If they change the attribute to use the object ID, then it鈥檒l avoid the null reference exception.
[EventSubscriber(ObjectType::Codeunit, 50100, 'OnMyEvent', '', true, true)]
This happens in production tenant deployment because the validation rules are running when the extension is uploaded through the Extension Management page. For sandbox deployments where the Partners tipically deploy directly from VSCode, the validation rules are not run on deployment.

All 18 comments

Same issue !

  • Range 8052510
  • New AL syntaxes used in my code (Caption / Label / Translation file)
  • .app signed with SignTool

I tried to compile the .app file with two differents versions of AL Extension (0.12.17720 and 0.15.18771)

Please try enabling the PerTenantCop code analyzer by using these settings:

"al.enableCodeAnalysis": false,
    "al.codeAnalyzers": [
        "${PerTenantExtensionCop}"
    ]

Once enabled see if you are receiving any errors from the analyzer and follow the instructions to fix them.

In the meanwhile there is ongoing work to improve the error messages returned from the validation status so in the future you should be able to see more granular information.

I just try by enabling PerTenantCop.

The errors I have is concerning the id of my *extensions objects. And an object wich is missing a matching permission set I think this is the same probleme than the issue #1880

1880 has been fixed - please retry your app on a latest Docker container or reset your online sandbox to make sure it get's provisioned on the latest bits.

I did download the Next BC Docker. Took the VSIX file from that one, now I don't have any errors at all, I published it to the dockers, both current and next without any problems. BUT I still can't publish it to BC Trial. Is there any updates to BC and I need to create a new one? Or is there a way to force the update to the BC?

I would recommend to follow these steps:
1) Go to your production tenant. Go to the System Information page and confirm that the version number is: 12.0.21576.0 or newer
2) Download AL Language from the VS Code Marketplace. That ensures that you have a version matching the online tenant.
3) Ensure that app.json has the correct IdRange setting set. It needs to be within 50K-99K and cover the range of your objects
4) Open your project and enable the PerTenantCop by using these settings:

"al.enableCodeAnalysis": true,
    "al.codeAnalyzers": [
        "${PerTenantExtensionCop}"
    ]

5) Fix any issues reported by the compiler and PerTenantCop. No need to publish to a local docker container, just make sure the package gets created when pressing Ctrl + Shift + B
6) Upload to your production tenant

If it still results in a package validation failure, please provide your tenant name and we will investigate further on our side.

Hi,
My version number is 12.0.21229. How can I update it ..?

Mine as well (SE Dynamics NAV 12.0 (21229)). How do we upgrade it?

Hi,
I did create a brand new trial. I created a new O365 SE. From there a new Business Central Trial. Still my version is 12.0.21229.. Are you sure that you published 12.0.21576.0 or am I doing something wrong here?

21229 should also be fine, the only difference between that and 21576 is individual hotfixes not related to this scenario. Have you followed all the other steps from my last post?

I also get this issue.
Please help me for checking!

Version: US Dynamics NAV 12.0 (21229)
Link: Sandbox

I did, but then the error saying from the compiler says.

Field 'Document Type' has an ID of [1]. It must be between 50000 and 50099.

But it is from my own tables, and there shouldn't be any ID checks. I guess that is fixed with a later release. But I did a try last week renumbering all the fields, it is 196 fields, and I still got the same error when I tried to upload the extension to my BC.

Same issue with the compiler: wants ID's between 50000 and 50099.

I also have, for the only table I've created (8052510) a missing matching permission set issue on it. I've created a PermissionSet.xml in which I put:

<PermissionSet RoleID="SUPER" RoleName="This role has all permissions.">
    <Permission>
        <ObjectType>Table</ObjectType>
        <ObjectID>8052510</ObjectID> <!-- My table -->
        <ReadPermission>1</ReadPermission>
        <InsertPermission>1</InsertPermission>
        <ModifyPermission>1</ModifyPermission>
        <DeletePermission>1</DeletePermission>
        <ExecutePermission>1</ExecutePermission>
        <SecurityFilter />
    </Permission>
</PermissionSet>

But compilation failed too.

You can only use range 50K - 99K for per tenant extensions. If you want to use the ISV range it needs to be an AppSource app.

All fields in tables need to be within 50k-99K range as well.

Is that a demand, that all fieldsID in own tables also need to be in that range? Or is it a temporary demand? As I said, I have 196 fields to renumber and when I did try that it didn't work either.

I'm a bit confused aswell, you are saying between 50K-99K. In my World that is between 50000-99000 not 50000-50099 as the error says.

It would be nice when you get rid of the ID's, ;-) No real use for them anymore...

Same Issue!!!

in my case, i use a sandbox ver. GB Dynamics NAV 12.0 (21229) and set the enableCodeAnalysis also.
and i created an extention with tables, pages, codeunit and report.

when i published through the VS code, it works perfectly. but when i uploaded it in the extension management page, it failed with below message.
"Publish operation failed with code PackageDeployFailed. Details: The extension failed to be deployed successfully. View the error details for more information and then deploy again. "

where can i find and see the details??

so i tried to upload one by one increasing revision #.
case1 - one table extension and one page extension => uploaded.
case2 - case1 + one table extension and two page extensions => uploaded.
case3 - case2 + one report => uploaded.
case4 - case3 + one codeunit = > failed.

content of the codeunit is here

` codeunit 50100 DXKSalesHeaderEvent
{
    [EventSubscriber(ObjectType::Table, database::"Sales Header", 'OnAfterInitRecord', '', false, false)]
    local procedure OnAfterInitRecord(var SalesHeader: Record "Sales Header")
    var
        customer: Record Customer;
    begin
        if not customer.get(SalesHeader."Sell-to Customer No.") then exit;

        SalesHeader."DXK Bank Account" := customer."DXK Bank Account";
    end;
}`

i think it is nothing special.
give me any advice

thank you.

The PackageValidationError is because of a known issue in the processing of the validation rules in the Extension Management Regional Service. The issue has been resolved and is currently schedule to be deployed to prod tenatnthis week. The issue occurs when the subscription attribute contains the object name. You can move past this PackageValidationError by making a small code change to use the object id.
For example:
[EventSubscriber(ObjectType::Codeunit, Codeunit::MyEventCodeunit, 'OnMyEvent', '', true, true)]
If they change the attribute to use the object ID, then it鈥檒l avoid the null reference exception.
[EventSubscriber(ObjectType::Codeunit, 50100, 'OnMyEvent', '', true, true)]
This happens in production tenant deployment because the validation rules are running when the extension is uploaded through the Extension Management page. For sandbox deployments where the Partners tipically deploy directly from VSCode, the validation rules are not run on deployment.

HI D!

It looks like that was the issue, got 2 subscribers with object name. Change it to ID and it seams to work.

Thanks a lot! 5 star as always D!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kine picture kine  路  3Comments

SteveKrisjanovsD365 picture SteveKrisjanovsD365  路  3Comments

worldofthenavcraft picture worldofthenavcraft  路  3Comments

ghost picture ghost  路  3Comments

malue19 picture malue19  路  3Comments