StefanMaron / BusinessCentral.LinterCop

Community driven code linter for AL (MS Dynamics 365 Business Central)
https://stefanmaron.com
MIT License
74 stars 31 forks source link

False positive for LC0033 #668

Closed NKarolak closed 2 months ago

NKarolak commented 3 months ago

I've just updated my app platform and application from 23.0 to 24.0, and I've updated the runtime to 13.0 accordingly.

I get the following info LC0033:

The specified runtime version in app.json is falling behind. The project targets application version 24.0 and the current runtime is 13.0. Update the runtime to 13.1 for compatibility with the latest runtime features. AL LC0033

Why does it suggest 13.1?

Arthurvdv commented 3 months ago

Under the hood I'm depending on the same logic as the altool, which suggest with the GetLatestSupportedRuntimeVersion that Platform version 24.0 supports runtime version up to 13.1.

image

If i look into the LatestSupportedRuntimeVersions of the Microsoft.Dynamics.Nav.CodeAnalysis.dll, it could be that there's been a misstake with the latest 13.1 release of the AL Language? image

public static readonly Version Spring2024 = new Version(24, 0);
public static readonly Version Spring2024CU1 = new Version(24, 1);
public static readonly Version Spring2024CU2 = new Version(24, 2);
public static readonly Version Spring2024CU3 = new Version(24, 3);
public static readonly Version Spring2024CU4 = new Version(24, 4);
public static readonly Version Spring2024CU5 = new Version(24, 5);

public static readonly Version RuntimeVersion.Spring2024 = new Version(13, 0);
public static readonly Version RuntimeVersion.Spring2024RV1 = new Version(13, 1);

I've created an issue on the AL repo to investigate: https://github.com/microsoft/AL/issues/7786

Arthurvdv commented 2 months ago

Good and bad news: The good news is that it's not a false positive if you're targeting SaaS, but that's also kinda the bad news.

The current implementation of this rule has now become 'SaaS only' and I'm not sure if this rule can cover both targeting On-Prem and SaaS anymore. There was once a "target":"OnPrem" property in the app.json, but with the Universal Code Initiative I believe this isn't a thing anymore. So I don't think I have any way of knowing if the extension targets a SaaS or On-Prem environment.

I'm thinking of re-branding this rule that it's only SaaS-compatible, where I don't have a solution for On-Prem environment at the moment. This isn't ideally, because during development it shouldn't matter what the target environment is.

An other approach would be to create a own mapping inside the LinterCop itself, where this is sensitive to maintenance.

NKarolak commented 2 months ago

Thanks Arthur. I've followed Microsoft's explanation on that, and to be honest, I still don't understand their explanation 😁

Anyway ... The apps I'm writing are written for the cloud, but can (and will be) installed on-premises as well. As I understood, the correct platform then must be 13.0 due to on-premises. From my perspective, LC0033 should be inactive as long as Microsoft does not provide a function for on-premises.

Arthurvdv commented 2 months ago

For now I'm reverting back to the previous logic of this rule, where the version of the platform and the runtime should be a offset of eleven (with some more logic behind it, then simply subtracting the value of 11).

Arthurvdv commented 2 months ago

The version v0.30.28 of the LinterCop is now the latest release. Could you verify if this is now working as expected? If this is the case, you may close this issue.

NKarolak commented 2 months ago

Thanks Arthur! I no longer receive LC0033 on runtime 13.0. Reducing it to 12.0 will raise it again - it works as expected :-)