microsoft / AL

Home of the Dynamics 365 Business Central AL Language extension for Visual Studio Code. Used to track issues regarding the latest version of the AL compiler and developer tools available in the Visual Studio Code Marketplace or as part of the AL Developer Preview builds for Dynamics 365 Business Central.
MIT License
719 stars 242 forks source link

Issue with Loading Projects after Downloading Symbols in Erroneous Network #7695

Closed zabcik closed 2 months ago

zabcik commented 3 months ago

Hello,

In our network, there's a high probability of symbols becoming corrupted due to issues with our Firewall and SSL VPN configurations. This leads to the following bug. I wrote this as bug, because this error may occurs on any erronouns network.

1. Describe the bug When attempting to load projects after downloading symbols in our network, an error occurs in the AL Language, displaying":

Invalid reference module: Unexpected character encountered while parsing number: ". Path 'Codeunits[30].Methods[3].Id', line 1, position 13248718.

2. To Reproduce Download symbols in a corporate network environment with potential Firewall and SSL VPN issues - our team identified cause. Or simulate network TCP tampering issue - see picture Clumsy. Or manually corrupt .app file like HTTP transfer should do - replace same bytes. Verify that application symbols .app file integrity check failed in SymbolReference.json - see picture 7zip. Attempt to load project in the AL Language.

3. Expected behavior

4. Actual behavior After long loading no-sense error occurs:

Invalid reference module: Unexpected character encountered while parsing number: ". Path 'Codeunits[30].Methods[3].Id', line 1, position 13248718.

It is hard to understand what's wrong. What to do. What file cause this error. Developer should repeat downloading symbol and belive that it download all applications symbols correctly. In the worst case, another corrupted file will be downloaded. It is about probability.

5. Versions:

6. Additional Info:

In our corporate network, due to the use of Firewall and SSL VPN, packet corruption occurred, which TCP checksum couldn't detect. Firewall inspect http, https on port 443 and SSL VPN is using port 443 too, so VPN is controlled by Firewall.

This resulted in the download of slightly corrupted .app file, which is essentially an archive. The issue primarily arose when a file named SymbolReference.json was corrupted within the archive, causing the symbol assembly process to fail completely.

I'm reporting this as a bug because even outside our corporate network, it's possible for a file to be downloaded corrupted. Therefore, checksum checks are performed after downloading files, or file integrity checks are done before usage.

Problems („Invalid reference module“, „Missing objects“): image

7zip – archive integrity check (corrupted „Base Application“ symbols - data error "SymbolReference.json"): image

Clumsy – simulates network errors (inject issue Tamper): image

BazookaMusic commented 3 months ago

While there is value to such a check, this is a new feature and not a bug with the AL extension. The error could be better by pointing to the invalid module so I'll mark this bug for triage.

For implementing a checksum check and re-downloading the symbols if the file is corrupted though, I would suggest making an entry in aka.ms/bcideas describing the scenario. We use the votes to guide the prioritization of features.

zabcik commented 3 months ago

Hello @BazookaMusic,

Thank you for responding.

I agree with you that clearer error information is sufficient. The current error message has resulted in many wasted hours for our developers. Nobody knew what the issue was for a long time.

Implementing a feature to automatically re-download symbols if the file is corrupted is not neccesary.

thloke commented 3 months ago

Accepting with the scope of making the error message actually actionable.

JesperSchulz commented 2 months ago

The fix for this issue has been checked in to the master branch. It will be available in the bcinsider.azurecr.io/bcsandbox-master Docker image starting from platform build number 25.0.18370.0 and VS Code Extension Version 14.0.985779.

If you don’t have access to these images you need to become part of the Ready2Go program: aka.ms/readytogo

For more details on code branches and docker images please read: https://blogs.msdn.microsoft.com/nav/2018/05/03/al-developer-previews-multiple-releases-and-github/ https://freddysblog.com/2020/06/25/working-with-artifacts/