AL crash with Dynamics NAV 2018 CU5

Been out on a customer project last couple of weeks, so didn't have time to work on my own project. But this weekend is one of our many Spring holidays - Whitsun, which comes with Monday off. And the wife is working. So a little time to work on my AL project.

Just needed to start by updating my development environment to the latest cumulative update for NAV 2018 - CU05. Using Docker that didn't take much time, neither did installing the new AL extension 0.12.20065 to Visual Studio Code.

But right when I open my project in VS Code this happens:

Unhandled Exception: System.AggregateException: One or more errors occurred. ---> System.IO.FileLoadException: Could not load file or assembly 'Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) ---> System.IO.FileLoadException: Could not load file or assembly 'Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
   --- End of inner exception stack trace ---
   at Microsoft.Dynamics.Nav.EditorServices.Protocol.MessageProtocol.MessageWriter..ctor(Stream outputStream, IMessageSerializer messageSerializer)
   at Microsoft.Dynamics.Nav.EditorServices.Protocol.Channel.StdioServerChannel.Initialize(IMessageSerializer messageSerializer) in C:\Agent\_work\47\s\source\Prod\Microsoft.Dynamics.Nav.EditorServices.Protocol\Channel\StdioServerChannel.cs:line 27
   at Microsoft.Dynamics.Nav.EditorServices.Protocol.Channel.ChannelBase.Start(MessageProtocolType messageProtocolType, ProtocolEndpointCompletionSource completionSource) in C:\Agent\_work\47\s\source\Prod\Microsoft.Dynamics.Nav.EditorServices.Protocol\Channel\ChannelBase.cs:line 40
   at Microsoft.Dynamics.Nav.EditorServices.Protocol.MessageProtocol.ProtocolEndpoint.<Start>d__4.MoveNext() in C:\Agent\_work\47\s\source\Prod\Microsoft.Dynamics.Nav.EditorServices.Protocol\MessageProtocol\ProtocolEndpoint.cs:line 27
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at Prod.EditorServices.Host.Program.Main(String[] args) in C:\Agent\_work\47\s\source\Prod\Microsoft.Dynamics.Nav.EditorServices.Host\Program.cs:line 103
[Info  - 22:19:39] Connection to server got closed. Server will restart.

AL crashed!

But luckily Microsoft had already picked up on this error. Marco Mels reports it here.

Open the Microsoft.Dynamics.Nav.EditorServices.Host.exe.config file in C:\Users\<userid>\.vscode\extensions\Microsoft.al-0.12.20065\bin. Then find the line with newVersion="10.0.0.0" and change it to newVersion="9.0.0.0". The file then looks like this:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
  </startup>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed" />
        <bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="9.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
      </dependentAssembly>
    </assemblyBinding>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.IdentityModel.Clients.ActiveDirectory" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-3.19.1.3001" newVersion="3.19.1.3001" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

After the change, save the file and reopen Visual Studio Code, and it works again.

Comment List
Anonymous
Related
Recommended