Annotation Layers in ArcGIS Runtime SDK for .NET

653
7
03-11-2020 09:27 PM
JamieBurmeister
New Contributor

I'm trying to add the following Esri.ArcGISRuntime.Mapping.AnnotationLayer to my Esri.ArcGISRuntime.Mapping.Map but I get a LoadError on Loaded.

Layer Source: https://maps.cern.ch/arcgis/rest/services/General/General/MapServer/45
Layer Type: Esri.ArcGISRuntime.Mapping.AnnotationLayer
Layer Display Name: Voirie_texte
Exception:

Esri.ArcGISRuntime.ArcGISRuntimeException: Invalid response    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)    at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)    at System.Runtime.CompilerServices.TaskAwaiter.GetResult()    at Adapt.Presentation.Esri.LayerConfigPersister.<ConfigureLayer>d__15.MoveNext() in C:\Users\Laura\RiderProjects\AdaptSource\src\Adapt.Presentation.WPF\Adapt\Presentation\ESRI\LayerConfigPersister.cs:line 120

Any and all help appreciated.

0 Kudos
7 Replies
MichaelBranscomb
Esri Frequent Contributor

Hi,

What's the call stack include if you enable native debugging and reference the symbol files? (see https://community.esri.com/community/developers/native-app-developers/arcgis-runtime-sdk-for-net/blo...)

Thanks

Mike

0 Kudos
JamieBurmeister
New Contributor
>    Esri.ArcGISRuntime.dll!Esri.ArcGISRuntime.Mapping.Map.InitLoadable.AnonymousMethod__0(object s, System.EventArgs e)    Unknown
     Esri.ArcGISRuntime.dll!Esri.ArcGISRuntime.Internal.LoadableObjectHandler<System.__Canon>.OnLoadEnded()    Unknown
     Esri.ArcGISRuntime.dll!Esri.ArcGISRuntime.Internal.LoadableObjectHandler<RuntimeCoreNet.GeneratedWrappers.CoreMap>.RuntimeCoreNet.GeneratedWrappers.ICoreCallback_Loadable_DoneLoading.DoneLoading(RuntimeCoreNet.GeneratedWrappers.CoreError loadError)    Unknown
     Esri.ArcGISRuntime.dll!RuntimeCoreNet.GeneratedWrappers.CoreMap.onPrivateCoreLoadable_DoneLoading(System.IntPtr loadError)    Unknown
     [Native to Managed Transition]    
     runtimecore.dll!std::_Func_impl_no_alloc<<lambda_810e53070115a1e048bfb9eaf8a6e643>,void,void *,Esri_runtimecore::Common::Error const &>::_Do_call()    Unknown
     runtimecore.dll!std::_Func_impl_no_alloc<<lambda_32601c908543cacb3556b7ea268514e6>,void,Esri_runtimecore::Common::Loadable &,Esri_runtimecore::Common::Error const &>::_Do_call()    Unknown
     runtimecore.dll!Esri_runtimecore::Common::Loadable::set_load_status_and_error_without_check_(enum Esri_runtimecore::Common::Load_status,class Esri_runtimecore::Common::Error const &)    Unknown
     runtimecore.dll!Esri_runtimecore::Geo_model::Map::set_load_status_and_error_(enum Esri_runtimecore::Common::Load_status,class Esri_runtimecore::Common::Error)    Unknown
     runtimecore.dll!Esri_runtimecore::Geo_model::Basemap::set_load_status_and_error_(class Esri_runtimecore::Common::Loadable const &)    Unknown
     runtimecore.dll!<lambda>(void)()    Unknown
     runtimecore.dll!Esri_runtimecore::Common::Signal_detail::`anonymous namespace'::dispatch_to_node()    Unknown
     runtimecore.dll!Esri_runtimecore::Common::Signal_detail::`anonymous namespace'::dispatch_notification()    Unknown
     runtimecore.dll!Esri_runtimecore::Common::Loadable::set_load_status_and_error_without_check_(enum Esri_runtimecore::Common::Load_status,class Esri_runtimecore::Common::Error const &)    Unknown
     runtimecore.dll!<lambda>(void)()    Unknown
     runtimecore.dll!Esri_runtimecore::Common::Signal_detail::`anonymous namespace'::dispatch_to_node()    Unknown
     runtimecore.dll!Esri_runtimecore::Common::Signal_detail::`anonymous namespace'::dispatch_notification()    Unknown
     runtimecore.dll!Esri_runtimecore::Common::Loadable::set_load_status_and_error_without_check_(enum Esri_runtimecore::Common::Load_status,class Esri_runtimecore::Common::Error const &)    Unknown
     runtimecore.dll!Esri_runtimecore::Common::Loadable::set_load_status_and_error_(enum Esri_runtimecore::Common::Load_status,class Esri_runtimecore::Common::Error)    Unknown
     runtimecore.dll!Esri_runtimecore::Geo_model::Service_feature_table::handle_query_data_elements_response_(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)    Unknown
     runtimecore.dll!Esri_runtimecore::Geo_model::Service_feature_table::handle_response_(class std::shared_ptr<class Esri_runtimecore::Common::Request> const &,unsigned char const *,unsigned __int64,class std::shared_ptr<class Esri_runtimecore::Common::Client_reference> const &)    Unknown
     runtimecore.dll!Esri_runtimecore::Common::Request_delegator::handle_response(unsigned __int64,unsigned char const *,unsigned __int64,class std::shared_ptr<class Esri_runtimecore::Common::Client_reference> const &)    Unknown
     runtimecore.dll!Esri_runtimecore::Common::Request::handle_response(unsigned char const *,unsigned __int64,class std::shared_ptr<class Esri_runtimecore::Common::Client_reference> const &)    Unknown
     runtimecore.dll!RT_Request_handleResponse ()    Unknown
     RuntimeCoreNet.dll!CoreRT_Request_handleResponse ()    Unknown
     [Managed to Native Transition]    
     Esri.ArcGISRuntime.dll!RuntimeCoreNet.GeneratedWrappers.CoreRequest.HandleResponse(byte[] data, RuntimeCoreNet.GeneratedWrappers.CoreClientReference userDefinedError)    Unknown
     Esri.ArcGISRuntime.dll!Esri.ArcGISRuntime.Internal.RequestRequiredHandler.IssueRequestAndRespond(RuntimeCoreNet.GeneratedWrappers.CoreRequest request)    Unknown
     [Resuming Async Method]    
     System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<System.Threading.Tasks.VoidTaskResult>.AsyncStateMachineBox<Esri.ArcGISRuntime.Internal.RequestRequiredHandler.<IssueRequestAndRespond>d__18>.ExecutionContextCallback(object s)    Unknown
     System.Private.CoreLib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state)    Unknown
     System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<System.Threading.Tasks.VoidTaskResult>.AsyncStateMachineBox<Esri.ArcGISRuntime.Internal.RequestRequiredHandler.<IssueRequestAndRespond>d__18>.MoveNext(System.Threading.Thread threadPoolThread)    Unknown
     System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<System.Threading.Tasks.VoidTaskResult>.AsyncStateMachineBox<Esri.ArcGISRuntime.Internal.RequestRequiredHandler.<IssueRequestAndRespond>d__18>.MoveNext()    Unknown
     System.Private.CoreLib.dll!System.Runtime.CompilerServices.TaskAwaiter.OutputWaitEtwEvents.AnonymousMethod__12_0(System.Action innerContinuation, System.Threading.Tasks.Task innerTask)    Unknown
     System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.ContinuationWrapper.Invoke()    Unknown
     System.Private.CoreLib.dll!System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(System.Action action, bool allowInlining)    Unknown
     System.Private.CoreLib.dll!System.Threading.Tasks.Task.RunContinuations(object continuationObject)    Unknown
     System.Private.CoreLib.dll!System.Threading.Tasks.Task<System.__Canon>.TrySetResult(System.__Canon result)    Unknown
     System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<System.Net.Http.HttpResponseMessage>.SetResult(System.Net.Http.HttpResponseMessage result)    Unknown
     [Completed] System.Net.Http.dll!System.Net.Http.HttpClient.FinishSendAsyncUnbuffered(System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> sendTask, System.Net.Http.HttpRequestMessage request, System.Threading.CancellationTokenSource cts, bool disposeCts)    Unknown
     System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<System.Net.Http.HttpResponseMessage>.AsyncStateMachineBox<System.Net.Http.HttpClient.<FinishSendAsyncUnbuffered>d__71>.ExecutionContextCallback(object s)    Unknown
     System.Private.CoreLib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state)    Unknown
     System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<System.Net.Http.HttpResponseMessage>.AsyncStateMachineBox<System.Net.Http.HttpClient.<FinishSendAsyncUnbuffered>d__71>.MoveNext(System.Threading.Thread threadPoolThread)    Unknown
     System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<System.__Canon>.AsyncStateMachineBox<System.Net.Http.HttpClient.<FinishSendAsyncUnbuffered>d__71>.MoveNext()    Unknown
     System.Private.CoreLib.dll!System.Runtime.CompilerServices.TaskAwaiter.OutputWaitEtwEvents.AnonymousMethod__12_0(System.Action innerContinuation, System.Threading.Tasks.Task innerTask)    Unknown
     System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.ContinuationWrapper.Invoke()    Unknown
     System.Private.CoreLib.dll!System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(System.Action action, bool allowInlining)    Unknown
     System.Private.CoreLib.dll!System.Threading.Tasks.Task.RunContinuations(object continuationObject)    Unknown
     System.Private.CoreLib.dll!System.Threading.Tasks.Task<System.__Canon>.TrySetResult(System.__Canon result)    Unknown
     System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<System.Net.Http.HttpResponseMessage>.SetResult(System.Net.Http.HttpResponseMessage result)    Unknown
     [Completed] Esri.ArcGISRuntime.dll!Esri.ArcGISRuntime.Http.ArcGISHttpClientHandler.ArcGISClientHandlerInternal.SendAsync(System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken)    Unknown
     System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<System.Net.Http.HttpResponseMessage>.AsyncStateMachineBox<Esri.ArcGISRuntime.Http.ArcGISHttpClientHandler.ArcGISClientHandlerInternal.<SendAsync>d__14>.ExecutionContextCallback(object s)    Unknown
     System.Private.CoreLib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state)    Unknown
     System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<System.Net.Http.HttpResponseMessage>.AsyncStateMachineBox<Esri.ArcGISRuntime.Http.ArcGISHttpClientHandler.ArcGISClientHandlerInternal.<SendAsync>d__14>.MoveNext(System.Threading.Thread threadPoolThread)    Unknown
     System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<System.__Canon>.AsyncStateMachineBox<Esri.ArcGISRuntime.Http.ArcGISHttpClientHandler.ArcGISClientHandlerInternal.<SendAsync>d__14>.MoveNext()    Unknown
     System.Private.CoreLib.dll!System.Runtime.CompilerServices.TaskAwaiter.OutputWaitEtwEvents.AnonymousMethod__12_0(System.Action innerContinuation, System.Threading.Tasks.Task innerTask)    Unknown
     System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.ContinuationWrapper.Invoke()    Unknown
     System.Private.CoreLib.dll!System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(System.Action action, bool allowInlining)    Unknown
     System.Private.CoreLib.dll!System.Threading.Tasks.Task.RunContinuations(object continuationObject)    Unknown
     System.Private.CoreLib.dll!System.Threading.Tasks.Task.FinishStageThree()    Unknown
     System.Private.CoreLib.dll!System.Threading.Tasks.Task.FinishStageTwo()    Unknown
     System.Private.CoreLib.dll!System.Threading.Tasks.Task.FinishSlow(bool userDelegateExecute)    Unknown
     System.Private.CoreLib.dll!System.Threading.Tasks.Task.ExecuteWithThreadLocal(ref System.Threading.Tasks.Task currentTaskSlot, System.Threading.Thread threadPoolThread)    Unknown
     System.Private.CoreLib.dll!System.Threading.Tasks.Task.ExecuteEntryUnsafe(System.Threading.Thread threadPoolThread)    Unknown
     System.Private.CoreLib.dll!System.Threading.Tasks.Task.ExecuteFromThreadPool(System.Threading.Thread threadPoolThread)    Unknown
     System.Private.CoreLib.dll!System.Threading.ThreadPoolWorkQueue.Dispatch()    Unknown
     System.Private.CoreLib.dll!System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()    Unknown
     [Native to Managed Transition]    
     kernel32.dll!00007ffb48677bd4()    Unknown
     ntdll.dll!00007ffb497aced1()    Unknown
0 Kudos
JamieBurmeister
New Contributor

Please check out my GitHub repository for ESRI bug reporting here.

This bug is listed as Annotation Display Bug in the bug selection menu.

0 Kudos
JamieBurmeister
New Contributor

Hey Michael Branscomb‌, have you managed to take a look at this one?

Cheers,

Jamie

0 Kudos
MichaelBranscomb
Esri Frequent Contributor

Hi,

Apologies for the delay. 

If you await LoadAsync() with a try/catch or handle the LoadStatusChanged event the LoadError message is `{"Invalid URL."}`. 

The issue is caused by attempting to create an AnnotationLayer from a MapServer/<SublayerId> e.g. `https://maps.cern.ch/arcgis/rest/services/General/General/MapServer/45`,

Instead you need to enable feature access to create the FeatureServer/SublayerId endpoint and use that as the Uri instead e.g. https://github.com/Esri/arcgis-runtime-samples-dotnet/blob/master/src/WPF/ArcGISRuntime.WPF.Viewer/S... 

Thanks

Mike

0 Kudos
JamieBurmeister
New Contributor

I don't understand, the layer displays fine in other display tools. Can you explain what you mean by "enable feature access"?

0 Kudos
MichaelBranscomb
Esri Frequent Contributor

Depending on which workflow you followed to publish the service, you need to enable the `Feature Access` capability:

Setting map service properties—Help | ArcGIS for Desktop 

Configure a map service—ArcGIS Pro | Documentation 

Thanks

Mike

0 Kudos