POST
|
Is there no one that can help with this problem? All the stuff that I have written appears to be processing correctly, but the black-box Esri stuff returns an exception. Where do I go from here?
... View more
06-12-2019
11:38 AM
|
0
|
0
|
523
|
POST
|
In between when this gets called, and when it throws the exception, CreateCredentialAsync gets called: RouteTask solveRouteTask = await RouteTask.CreateAsync( new Uri("https://route.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World")); I can see that it is actually getting a token, but by the time it gets around to completing this RouteTask.CreateAsync method, the Exception gets thrown:
... View more
06-10-2019
09:37 AM
|
0
|
0
|
523
|
POST
|
Esri.ArcGISRuntime.Http ArcGISHttpClientHandler+ArcGISClientHandlerInternal+<>c__DisplayClass14_1.<SendAsync>b__0 (System.Threading.Tasks.Task`1[TResult] t) System.Threading.Tasks ContinuationResultTaskFromResultTask`2[TAntecedentResult,TResult].InnerInvoke () System.Threading.Tasks Task.Execute () Esri.ArcGISRuntime.Http ArcGISHttpClientHandler+ArcGISClientHandlerInternal+<SendAsync>d__14.MoveNext () System.Runtime.CompilerServices TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) System.Runtime.CompilerServices TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) System.Runtime.CompilerServices TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) System.Runtime.CompilerServices TaskAwaiter`1[TResult].GetResult () Esri.ArcGISRuntime.Http ArcGISHttpClientHandler+ArcGISClientHandlerInternal+<SendAsync>d__14.MoveNext () System.Runtime.CompilerServices TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) System.Runtime.CompilerServices TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) System.Runtime.CompilerServices TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) System.Runtime.CompilerServices ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[TResult].GetResult () System.Net.Http HttpClient+<SendAsyncWorker>d__49.MoveNext () System.Runtime.CompilerServices TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) System.Runtime.CompilerServices TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) System.Runtime.CompilerServices TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) System.Runtime.CompilerServices ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[TResult].GetResult () Esri.ArcGISRuntime.Internal RequestRequiredHandler+<IssueRequestAndRespond>d__14.MoveNext () System.Runtime.CompilerServices TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) System.Runtime.CompilerServices TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) System.Runtime.CompilerServices TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) System.Runtime.CompilerServices ConfiguredTaskAwaitable+ConfiguredTaskAwaiter.GetResult () Esri.ArcGISRuntime.Tasks.NetworkAnalysis RouteTask+<CreateAsync>d__11.MoveNext () System.Runtime.CompilerServices TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) System.Runtime.CompilerServices TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) System.Runtime.CompilerServices TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) System.Runtime.CompilerServices TaskAwaiter`1[TResult].GetResult () gov.ca.fire.CMIP.Fragments CMIPEsriMapFragment+<DoRoute>d__33.MoveNext () C:\Temp\CMIP.Esri\CMIP\CMIP\Fragments\CMIPEsriMapFragment.cs:521 -That error code is 403. HTTP client is "Android."
... View more
06-04-2019
07:12 AM
|
0
|
0
|
523
|
POST
|
So, the exception is getting thrown on this line in the DoRoute method at the top of the try block: RouteTask solveRouteTask = await RouteTask.CreateAsync( new Uri("https://route.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World")); AggregateException.InnerException: MemoryStream.CopyToAsync (System.IO.Stream destination, System.Int32 bufferSize, System.Threading.CancellationToken cancellationToken) Message: "Cannot access a closed Stream." ObjectName: "" Not sure how to interpret that as I don't know what is going on inside RouteTask.CreateAsync...
... View more
06-03-2019
02:18 PM
|
0
|
2
|
523
|
POST
|
Ok, thanks. I shall ruminate this async business over my weekend.
... View more
05-30-2019
04:13 PM
|
0
|
0
|
523
|
POST
|
Well, my [limited] understanding of async methods is that they have to be called/awaited from another async method. With such a scheme, you just go on async-ing the callers forever. I'm not going to make the life cycle methods async. My attitude is that you have to cauterize it somewhere. The technique that I've read about on c# forums is to start a Task and let the async junk run in it's own thread off to the side. This project is 55 source code files not including resources. I'm not at leisure to go dumping it on the internet. Thanks for the advice.
... View more
05-30-2019
03:47 PM
|
0
|
1
|
1166
|
POST
|
Sorry, my bad. There's a lot of gobble-de-gook in here. Map is created in Fragment.OnCreate(): public override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Create your fragment here DrawRoute = false; _myMapView = new MapView(Activity); _myMapView.InteractionOptions = new MapViewInteractionOptions { IsMagnifierEnabled = false//, }; Basemap bm = new Basemap(new Uri("https://services.arcgisonline.com/ArcGIS/rest/services/USA_Topo_Maps/MapServer")); _map = new Map(bm); _myMapView.Map = _map; } -- Drawing in DoRoute(): public async void DoRoute() { InitAuth(); _myMapView.LocationDisplay.IsEnabled = true; // to facilitate taking of the device location var pos = _myMapView.LocationDisplay.Location.Position; // device current location. _myMapView.LocationDisplay.ShowLocation = false; MapPoint circleCenter = new MapPoint(pos.X, pos.Y, SpatialReferences.Wgs84); CFMapPoint youLocation = PointUtilities.ToCFMapPoint(circleCenter); youLocation.NavigateTo = true; youLocation.Icon = Resource.Drawable.you; Stop start = new Stop(circleCenter); Stop stop = new Stop(PointUtilities.ToMapPoint(_mapPoints[0])); _routeStops = new List<Stop> { start, stop }; _routeGraphicsOverlay = new GraphicsOverlay() { Id = Resources.GetText(Resource.String.route_overlay) }; try { RouteTask solveRouteTask = await RouteTask.CreateAsync( new Uri("https://route.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World")); RouteParameters routeParams = await solveRouteTask.CreateDefaultParametersAsync(); routeParams.SetStops(_routeStops); RouteResult solveRouteResult = await solveRouteTask.SolveRouteAsync(routeParams); Route firstRoute = solveRouteResult.Routes.FirstOrDefault(); Activity.RunOnUiThread(() => { Polyline routePolyline = firstRoute.RouteGeometry; SimpleLineSymbol routeSymbol = new SimpleLineSymbol(SimpleLineSymbolStyle.Solid, Color.SlateBlue, 4.0); Graphic routeGraphic = new Graphic(routePolyline, routeSymbol); _routeGraphicsOverlay.Graphics.Add(routeGraphic); _myMapView.GraphicsOverlays.Insert(0, _routeGraphicsOverlay); // adjust the envelope in such case the route goes off the screen if (_markerOverlay.Extent.Width < _routeGraphicsOverlay.Extent.Width * 1.15 || _markerOverlay.Extent.Height < _routeGraphicsOverlay.Extent.Height * 1.15) { EnvelopeBuilder myEnvelopeBuilder = new EnvelopeBuilder(_routeGraphicsOverlay.Extent); myEnvelopeBuilder.UnionOf(_markerOverlay.Extent); myEnvelopeBuilder.Expand(1.15); _myMapView.SetViewpointAsync(new Viewpoint(myEnvelopeBuilder.Extent)); } _taskCompletionSource = null; }); } catch (AggregateException ae) { foreach (var ex in ae.InnerExceptions) ... I'll have to ruminate the other question. Kind of a noob. The original architectural framework came from other noob went "bye-bye." I just refactored for Esri maps, and snuffled for memory leaks and bugs and such.
... View more
05-30-2019
03:11 PM
|
0
|
0
|
1166
|
POST
|
Sorry, here's the rest of it: Task.Run(async () => { if (_map == null) // get a freshy { await _map.LoadAsync(); }... }).ContinueWith(t => { << Exception Stuff >> ... }, TaskContinuationOptions.OnlyOnFaulted);
... View more
05-30-2019
02:31 PM
|
0
|
1
|
1166
|
POST
|
How's this? Well,... there are a lot of files, but here are the relevant excerpts: * Invoker *: <<Activity>> protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Create your application here if (Intent.HasExtra("MapPoints")) _mapPointString = Intent.Extras.GetString("MapPoints"); if (Intent.HasExtra("RelocatePoint")) _relocatePoint = Intent.GetBooleanExtra("RelocatePoint", false); if (Intent.HasExtra("Routing") && Intent.GetBooleanExtra("Routing", true)) { SetContentView(Resource.Layout._esrimap_layout); _mapFrag = FragmentManager.FindFragmentById<CMIPEsriMapFragment>(Resource.Id.esrimap); Task.Run(() => { _mapFrag.DrawRoute = true; _mapFrag.Setup(_mapPointString, _relocatePoint); }).ContinueWith(t => { << Exception Stuff >> ... }, TaskContinuationOptions.OnlyOnFaulted); } else { try {... <<Fragment>> public void Setup(string mapPointsJsonString, bool relocatePoint) {... Task.Run(async () => { if (_map == null) // get a freshy { await _map.LoadAsync(); }... << Exception Stuff >> ... private void OnMapVisible(object sender, DrawStatusChangedEventArgs e) { if (e.Status == DrawStatus.Completed) { if (DrawRoute) { DoRoute(); DrawRoute = false; // Quasi idempotent 😕 } } } * The Meat *: private void InitAuth() { // Get a reference to the (singleton) AuthenticationManager for the app AuthenticationManager authMgr = AuthenticationManager.Current; // Assign the method that AuthenticationManager will call to challenge for secured resources authMgr.ChallengeHandler = new ChallengeHandler(CreateCredentialAsync); } private async Task<Credential> CreateCredentialAsync(CredentialRequestInfo info) { try { // See if authentication is already in process if (_taskCompletionSource != null) { return null; } // Create a new TaskCompletionSource for the login operation. // Passing the CredentialRequestInfo object to the constructor will make it available from its AsyncState property. _taskCompletionSource = new TaskCompletionSource<Credential>(info); await LoginOtherStuff(); // Return the login task, the result will be ready when completed (LoginOtherStuff method gets called). return await _taskCompletionSource.Task; } catch(AggregateException ae) { << Exception Stuff >> ... } } public async Task LoginOtherStuff() { try { // Get the associated CredentialRequestInfo (will need the URI of the service being accessed). CredentialRequestInfo requestInfo = _taskCompletionSource.Task.AsyncState as CredentialRequestInfo; // Create a token credential using the provided username and password. TokenCredential userCredentials = await AuthenticationManager.Current.GenerateCredentialAsync (requestInfo.ServiceUri, Resources.GetText(Resource.String.hotdog), Resources.GetText(Resource.String.fish_taco), // I know, I know... You can't install the app. requestInfo.GenerateTokenOptions); // Set the result on the task completion source. _taskCompletionSource.TrySetResult(userCredentials); } catch (AggregateException ae) { << Exception Stuff >> ... } }
... View more
05-30-2019
02:09 PM
|
0
|
1
|
1166
|
POST
|
env: Xamarin Android on Visual Studio 17 - min API level 21, target - 27, TLS 1.2 settings/ testing on Samsung Galaxy S8 device I've been struggling for some time with an issue where: when loading a map and attempting to draw a route, the route draw fails (just doesn't draw it - pretty sure the route-solve is not throwing any errors). If I back-up in the GUI, and initiate the map/route draw again, the subsequent attempts succeed. I "back-burner"-ed this bug for a couple months to work on other aspects of the app. I observed that the map was "Loaded," but not drawn before the route-solve started, so I thought "Ah ha!" I've switched the code around to wait for the "DrawStatus.Completed" event instead, (and made it quasi-idempotent with a bool switch so the route only gets initiated once). I'm still getting the same result though. First time through, no route. All subsequent attempts are fine (if a little sluggish). Can anyone help with this?
... View more
05-30-2019
10:22 AM
|
0
|
20
|
2116
|
POST
|
Issue likely due to problems on my local network segment. Thank you.
... View more
05-21-2019
08:41 AM
|
0
|
0
|
166
|
POST
|
Hmm.. I don’t think so. I’m set up with Linking: Sdk Assemblies Only. If I’m reading the article correctly, the (GC like) Linker should skip over the Esri libraries. Did I misinterpret what I read? Thanks. JC
... View more
05-16-2019
02:38 PM
|
0
|
0
|
1227
|
POST
|
Hmm.. The steps delineated in that post produced the following error output: 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2053,5): error MSB4018: The "LinkAssemblies" task failed unexpectedly. 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2053,5): error MSB4018: Mono.Linker.MarkException: Error processing method: 'System.Boolean Esri.ArcGISRuntime.Security.ServerInfo::SameDomain(System.Uri,System.Uri)' in assembly: 'Esri.ArcGISRuntime.dll' ---> Mono.Cecil.ResolutionException: Failed to resolve System.String[] System.String::Split(System.Char,System.StringSplitOptions) 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2053,5): error MSB4018: at Mono.Linker.Steps.MarkStep.HandleUnresolvedMethod(MethodReference reference) 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2053,5): error MSB4018: at Mono.Linker.Steps.MarkStep.MarkMethod(MethodReference reference) 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2053,5): error MSB4018: at Mono.Linker.Steps.MarkStep.MarkInstruction(Instruction instruction) 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2053,5): error MSB4018: at Mono.Linker.Steps.MarkStep.MarkMethodBody(MethodBody body) 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2053,5): error MSB4018: at Mono.Linker.Steps.MarkStep.ProcessMethod(MethodDefinition method) 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2053,5): error MSB4018: at Mono.Linker.Steps.MarkStep.ProcessQueue() 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2053,5): error MSB4018: --- End of inner exception stack trace --- 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2053,5): error MSB4018: at Mono.Linker.Steps.MarkStep.ProcessQueue() 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2053,5): error MSB4018: at Mono.Linker.Steps.MarkStep.ProcessPrimaryQueue() 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2053,5): error MSB4018: at Mono.Linker.Steps.MarkStep.Process() 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2053,5): error MSB4018: at MonoDroid.Tuner.MonoDroidMarkStep.Process(LinkContext context) 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2053,5): error MSB4018: at Mono.Linker.Pipeline.Process(LinkContext context) 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2053,5): error MSB4018: at MonoDroid.Tuner.Linker.Process(LinkerOptions options, ILogger logger, LinkContext& context) 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2053,5): error MSB4018: at Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver res) 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2053,5): error MSB4018: at Xamarin.Android.Tasks.LinkAssemblies.Execute() 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2053,5): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2053,5): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() ========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ========== This bit: … in assembly: 'Esri.ArcGISRuntime.dll' ---> Mono.Cecil.ResolutionException: Failed to resolve System.String[] System.String::Split(System.Char,System.StringSplitOptions)… Looks familiar. The part after “Failed to resolve” is the incomprehensible error output -e.Message- from the Exception thrown during execution.. J
... View more
05-16-2019
09:16 AM
|
0
|
3
|
1227
|
POST
|
Hi Mike, Minimum Android version is level 21, Target Android version is level 27. I’m usually running on a Samsung Galaxy S8. I’ve also run the same issues on a Samsung Galaxy Tab 4. The NuGets are Esri.ArcGISRuntime.Tookit v100.4.0, and Esri.ArcGISRuntime.Xamarin.Android v100.5.0. I have not tried loading libraries manually. Might take me a non-trivial expenditure of effort to figure out how to do that in C#. Is that sort of thing not usually done through the Solution Explorer under References? In any event, I’ve surfed around the file system on the device with Android Device Monitor, and looked in the locations mentioned in the Java error dump from the original post. Indeed the libraries in question are not there..
... View more
05-16-2019
07:49 AM
|
0
|
5
|
1227
|
POST
|
Hi Mike, I have already done both of those things, a month ago. John Colaneri Information Technology Services (CalFIRE ITS) California Department of Forestry and Fire Protection
... View more
05-15-2019
05:59 AM
|
0
|
8
|
1227
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:24 AM
|