Build Error - Access to rad.json denied
Opened an existing extension project that I have loaded many times previously on my local test database. Amended version number in app.json and got the error described in issue 4849. I found that error does not appear as long as I don't open the app.json. Changed an object and found that pressing F5 will still build the extension & publish it, but won't open the client. I left VSCode open and manually opened the client, tested the change was OK and went back to VSCode to do the next change.
Made the second change. This time, pressing
[Error - 14:17:29] Please report this issue to https://github.com/microsoft/al/issues including information on how to reproduce it, if possible.
Processing of message 'al/createPackage' failed with error: 'Access to the path 'd:\Development\AL\my project name\ .vscode\rad.json' is denied.'
Details:
System.UnauthorizedAccessException: Access to the path 'd:\Development\AL\Chamberlains J000446.vscode\rad.json' is denied.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize)
at Microsoft.Dynamics.Nav.CodeAnalysis.RelativeFileSystem.CreateFile(String path) in F:\a\185\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\Compilation\RelativeFileSystem.cs:line 69
at Microsoft.Dynamics.Nav.CodeAnalysis.ObjectChangeManager.Serialize(String path, IFileSystem fileSystem) in F:\a\185\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\ObjectChange\ObjectChangeManager.cs:line 86
at Microsoft.Dynamics.Nav.EditorServices.Protocol.LanguageServer.Extensions.CreatePackageRequestHandler.
VS Code version: Version: 1.33.0 (system setup) Commit: 0dd516dd412d42323fc3464531b1c715d51c4c1a Date: 2019-04-04T15:14:46.685Z Electron: 3.1.6 Chrome: 66.0.3359.181 Node.js: 10.2.0 V8: 6.6.346.32 OS: Windows_NT ia32 10.0.17134
AL Extension is: Name: AL Language Id: ms-dynamics-smb.al Description: AL development tools for Dynamics 365 Business Central Version: 3.0.115791 Publisher: Microsoft VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=ms-dynamics-smb.al
Hi @MajorBarf, what do you mean by "pressing"?
Concerning the issue mentioned in #4849, it is only a warning given by VS Code and not an error, so it should not prevent you from doing anything.
Sorry, "pressing will" should read "pressing F5 will". I did actually type that in when I did the report & I can see it when I edit the text, but it seems that it gets removed when it is being displayed!
OK, #4849 maybe showing up as just a warning but while it was being displayed, it wouldn't let me build my extension. I had to close VS Code to get rid of it. And because of this problem with rad,json I have to restart VS Code after each occasion I have used F5. And the client won't launch so I can't use the debugger. It was all working before I loaded the VS Code update, after I load the update I get all these problems in my way. Very frustrating.
Don't you by chance have another instance of VsCode opened for the same project? Can you maybe check your running processes? Also can you delete the the rad file? If you can just delete it. If you are not using Alt Ctrl F5 or Alt F5 you can just delete it (if you can and it is not locked by the OS).
@kalberes Thanks for replying. There are definitely no other instances running. I deleted the rad.json as you suggested and that seems (fingers crossed) to have sorted it.
To add to the mystery, I switched to another project and didn't get the same problem with that one. That led me to compare the files and I found that the launch.json in each one as subtly different. In the project that was working, it had "server": "http://localhost" and a separate entry for "port:" and in the project that was not working it had "server"; "http://localhost:7249" with no "port:" entry. When I then tried to amend the launch.json on the problem project, it said that the file was protected and did I want to overwrite it. I did so and the project then launched without complaining about rad.json.
It hasn't done that before so something seems to have protected that folder. The problem project was the one that was open when VS code was upgraded so possibly it is something in the upgrade that does that. Maybe it recreates the json files during the upgrade while it has enhanced access permissions and that blocks access when it has finished?
Anyway, solution is: Delete the rad.json file and let it recreate.