Dynamics 365 Business Central and PropagateDependencies

More than one year ago (March 2020) I wrote a post explaining a new propagateDependencies app property introduced with version 15.3 in the “hidden” Microsoft.Application app file.

This property permits you to specify whether the dependencies of an extension should be propagated as direct dependencies of extensions that depend on this one.

Unfortunately this property is only quickly documented into this Docs page at the moment and in the last days I had the chance to see partners using it in a wrong way (so opening support requests for errors that instead are not platform errors).

Let me try to explain the problem with a simple example.

Imagine a partner that have:

  • Its partner’s base application (main addon), here called PartnerBase
  • An application 1 (here called App1) that depends on PartnerBase
  • An application 2 (here called App2) that depens from App1
  • An application 3 (here called App3) that depends from App2.

This partners uses “propagateDependencies”: true in the app.json file of all its apps (not good, but that’s the case):

In the PartnerBase app, we define a codeunit with a public method:

App1 is defined as follows:

It has dependency from PartnerBase and it propagates its dependencies.

App2 is defined as follows:

It has dependency from App1 and it propagates dependency too.

From App1 code, we can see objects declared in the PartnerBase app (thanks to dependency propagation) and so we can do something like:

Now let’s check App3. App3 is again defined as follows:

It has dependency from App2 and it propagates dependencies.

What happens if from App3 we want to call methods defined in PartnerBase?

An error is thrown because App3 cannot see objects declared on PartnerBase. Why this if all apps have propagateDependencies = true? Is this an AL extension bug?

NO… this is by design at the moment! The propagateDependencies property, when set to True, progates only the first level dependencies.

My old post mention this but think it was not so clear because mainly related to Microsoft’s Base Application. Dependencies are not automatically propagated on the entire tree, so please remember this on your application design in the future.

@Microsoft Docs Team: please add some notes into the documentation page.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.