AnsweredAssumed Answered

FeatureLayer.LoadAsync() results in an NullReferenceException

Question asked by m.glasesri-de-esridist Employee on Apr 12, 2018
Latest reply on Apr 13, 2018 by mnielsen-esristaff

Hi,

 

I have a strange behaviour in my two test applications, both based on ArcGIS Runtime 100.2.

Both worked fine for many hours of developing, now I got an exception in both, even I did not change anything in one of these apps.

 

Both a very small and focused and have the same startup:

        public MainWindow()
        {
            InitializeComponent();

            InitializeMap();
        }

        private async void InitializeMap()
        {
            Map map = new Map(Basemap.CreateTopographicVector());
            FeatureLayer featureLayer = new FeatureLayer(new Uri("http://sampleserver6.arcgisonline.com/arcgis/rest/services/Wildfire/FeatureServer/2"));

            await featureLayer.LoadAsync();
            map.OperationalLayers.Add(featureLayer);

            MyMapView.Map = map;
        }

 

Both are now crashing in the same line 13, where the LoadAsync should be executed.

 

System.Net.Http.HttpRequestException occurred
  HResult=0x80131500
  Message=An error occurred while sending the request.
  Source=mscorlib
  StackTrace:
   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 Esri.ArcGISRuntime.Internal.RequestRequiredHandler.<IssueRequestAndRespond>d__15.MoveNext()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
   at CustomGPSProvider.MainWindow.<InitializeMap>d__1.MoveNext() in C:\Users\mag\Documents\Visual Studio 2017\Projects\CustomGPSProvider\CustomGPSProvider\MainWindow.xaml.cs:line 37

Inner Exception 1:
WebException: The request was aborted: The request was canceled.

Inner Exception 2:
NullReferenceException: Object reference not set to an instance of an object.

The StackTrace for the Inner Exception 2 is:

   at System.Net.HttpWebRequest.CheckCacheUpdateOnResponse()
   at System.Net.HttpWebRequest.CheckResubmitForCache(Exception& e)
   at System.Net.HttpWebRequest.DoSubmitRequestProcessing(Exception& exception)
   at System.Net.HttpWebRequest.ProcessResponse()
   at System.Net.HttpWebRequest.SetResponse(CoreResponseData coreResponseData)

 

I have no idea what's wrong.

Any ideas?

 

Max

Outcomes