I am using ArcGIS Runtime .NET 10.2.5, and investigating the behaviour of running multiple analysis on different LocalRouteTask instances.
However, either following behaviour will occur frequently:
- exception "AccessViolationException" was thrown (based on the code below) and will kill my test application
- NetworkAnalystException was thrown but could be caught. Subsequent execution on route analysis has no issue.
Note: the following codes were just for reference, as it is supposed to measure time taken to complete 2 analysis on different LocalRouteTask instances. After line X was executed, then then above behaviours will occur.
I am speculating that if more than one LocalRouteTask references the same .geodatabase, and calling SolveAsync() on both tasks simultaneously will cause some issues like above?
public async void ButtonClick(object sender, EventArgs e)
LocalRouteTask routeTask1 = new LocalRouteTask(Constants.NetworkDB);
RouteParameters param1 = await routeTask1.GetDefaultTaskParameters();
LocalRouteTask routeTask2 = new LocalRouteTask(Constants.NetworkDB);
RouteParameters param2 = await routeTask2.GetDefaultTaskParameters();
Task t1 = Task.Run(()=> SolveRoute(routeTask1, param1);
Task t2 = Task.Run(()=> SolveRoute(routeTask2, param2); // line X
public async Task SolveRoute(LocalRouteTask task, RouteParameters param)