-
Notifications
You must be signed in to change notification settings - Fork 251
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The AL compiler builds invalid permission XML files when it contains only few permissions #7963
Comments
Cool find, will be fixed in one of the next releases. |
@BazookaMusic is there a timeline, when the fixed AL language is available? |
The entitlement.xml from our extracted app is bigger than 256 bytes. But same error. Does anyone have an idea? You can't start the service tier, nothing.. I my opinion a big bug that needs a fast fix in AL compiler or OnPrem BC. We can't deliver our update to our customers on BC 25.3 on prem. Btw, we are using runtime packages for app delivery. Created a runtime package with the same version (onprem etc), publish, restart, same error. No runtime package, no error. |
I have a fix for this (or more accurately, implemented exactly the same fix proposed by @Thomas-Torggler-EOS), and will be backporting it. Not sure why we haven't encountered this bug before since this codepath hasn't changed in forever. It only affects runtime packages because they're the only ones using this method to read bytes out of the package. |
When the fix is released, it will require a new version of the BC server. The runtime package itself is fine, it's the reading out of the content that's buggy. There is one workaround where if you find the file on disk, you can manually edit it to remove the extra 0x00 characters. |
This will be fixed in BC platform version 25.2.30197.0 |
1. Describe the bug
Permissions (being in XML format or AL format, does not matter) are converted into an "entitlements"-XML file inside the built package. When that package is installed, the BC service extracts this entitlements file and places it into a local cache for the service. This cache is read on service startup.
When there are very few (or even no) permissions in the app, that generated entitlement file might be less than 256 bytes in size. If this is the case, the BC service pads that file with
0x00
resulting in an invalid XML file and causing the service to fail startup.The problem lies in the class
Microsoft.Dynamics.Nav.CodeAnalysis.Packaging.PackageReader
in the methodReadFileAsBytes
. This method allocates a newMemoryStream
as the destination and then copies the source into that destination stream.The problem is, that the result value of that method uses
GetBuffer
instead ofToArray
. The latter would be correct and would only return the bytes that actually have content.GetBuffer
though returns the full underlying buffer, regardless if it contains data or not. This is initially allocated to 256 bytes (filled with0x00
) and thus will always return a buffer of at least 256 bytes, and - if the actual content is smaller - will therefore pad the return with0x00
.2. To Reproduce
3. Expected behavior
If my content is less than 256 bytes it should only return the actual bytes.
4. Actual behavior
If the content is less than 256 bytes it is padded to 256 bytes with
0x00
.For example
entitlements/<appId>.xml
finishes in a series of0x00
.5. Versions:
Internal work item: AB#564414
The text was updated successfully, but these errors were encountered: