Select to view content in your preferred language

RouteTask.CreateAsync fails on Windows: "Directions resource file version does not match"

785
3
Jump to solution
12-13-2022 11:45 AM
FelicityRhone
New Contributor III

We have a Xamarin Forms app using the ArcGIS Runtime version 100.15, running on Windows, iOS, and Android. We're using a routing task, and it works fine on iOS and Android. On Windows (19043) however, the routing task creation throws the following exception:

Esri.ArcGISRuntime.ArcGISRuntimeException: Unknown error: Directions resource file version does not match
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() + 0x21
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task) + 0x70
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task) + 0x38
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task) + 0x17
at System.Runtime.CompilerServices.TaskAwaiter.GetResult() + 0xb
at Esri.ArcGISRuntime.Tasks.NetworkAnalysis.RouteTask.<CreateAsync>d__11.MoveNext() + 0x15a
--- End of stack trace from previous location where exception was thrown ---

It worked in the Runtime version 100.8 and stopped working when we updated to 100.9. In 100.9 the error message we got was a little different:

Esri.ArcGISRuntime.ArcGISRuntimeException: Not found: Cannot load network analyst resources

   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() + 0x21
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task) + 0x70
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task) + 0x38
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task) + 0x17
   at System.Runtime.CompilerServices.TaskAwaiter.GetResult() + 0xb
   at Esri.ArcGISRuntime.Tasks.NetworkAnalysis.RouteTask.<CreateAsync>d__11.MoveNext() + 0x177
--- End of stack trace from previous location where exception was thrown ---

At some point the error message changed to the one above but it still fails anyway.

I've tried a couple different routing urls, https://route.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World and https://sampleserver6.arcgisonline.com/arcgis/rest/services/NetworkAnalysis/SanDiego/NAServer/Route and both have the same error.

The tricky thing is that the issue doesn't occur in a debug build, or in a local release build - only when we build on our build server. In that way it feels a little reminiscent of this other issue we had during the 100.9 upgrade but a similar solution (directly referencing the "Esri.ArcGISRuntime.runtimes.win" nuget package) hasn't done the trick.

Could anyone provide a suggestion of what might be going wrong based on the error message?

0 Kudos
1 Solution

Accepted Solutions
FelicityRhone
New Contributor III

Looking at the more detailed build output I could see that in a good build there was a step:

"Copying file from "C:\Users\[user]\.nuget\packages\esri.arcgisruntime\100.15.0\resources\network_analyst\strings.bin" to "[outputfolder]\bin\x64\Release\RuntimeCoreNet\resources\network_analyst\strings.bin".

In a bad build there was no attempt to copy that file over...
Since I could see which nuget package it was meant to come from, I tried added an 
explicit reference to the Esri.ArcGISRuntime nuget package in our UWP project (previously it was only explicitly referenced in the shared project), and that did the trick. I'm not sure why that wasn't necessary for iOS and Android or why it worked locally but at least it works now!

View solution in original post

0 Kudos
3 Replies
MichaelBranscomb
Esri Frequent Contributor

The error message appears to be referring to the directions resource file `Esri.ArcGISRuntime.100.15.0\resources\network_analyst\strings.bin` which should automatically be copied to your project output folder when building e.g. `\arcgis-runtime-samples-dotnet\output\UWP\x64\debug\RuntimeCoreNet\resources\network_analyst\strings.bin`.

0 Kudos
FelicityRhone
New Contributor III

Thanks! I do see that file for the (working) local build output, but the '[...]\bin\x64\Release\RuntimeCoreNet\resources\' folder on our production build server only contains the 'shaders' folder - the 'network_analyst' folder is missing. I'm still investigating why...

0 Kudos
FelicityRhone
New Contributor III

Looking at the more detailed build output I could see that in a good build there was a step:

"Copying file from "C:\Users\[user]\.nuget\packages\esri.arcgisruntime\100.15.0\resources\network_analyst\strings.bin" to "[outputfolder]\bin\x64\Release\RuntimeCoreNet\resources\network_analyst\strings.bin".

In a bad build there was no attempt to copy that file over...
Since I could see which nuget package it was meant to come from, I tried added an 
explicit reference to the Esri.ArcGISRuntime nuget package in our UWP project (previously it was only explicitly referenced in the shared project), and that did the trick. I'm not sure why that wasn't necessary for iOS and Android or why it worked locally but at least it works now!

0 Kudos