Select to view content in your preferred language

Empty MapView on some machines

4594
18
Jump to solution
09-20-2021 08:59 AM
AdrianPlatte
Occasional Contributor

I'm having a strange issue that only occurs on some machines: I get an empty MapView.

I've made a .NET Framework 4.8 WPF UserControl library with a WPF user control that hosts a MapView (Esri SDK v100.11) and other standard controls. Then I've created a Windows Forms library with a Windows Forms user control that hosts my WPF control, so I can use it from a Windows Forms application. Then I add the deloyment requeriments listed at https://developers.arcgis.com/net/license-and-deployment/deployment/#runtime-dlls-and-resources-for-... to my binaries.

On some machines, the app works perfect. On some other it shows nothin where the MapView should be. I can see all the other controls included in my WPF User Control. The MapView control must be there, since the logs are showing activity on MapView events (MouseLeftButtonDown, MouseMove, MouseLeftButtonUp, MouseLeave, etc) and also on layers (I use an ArcGISTiledLayer and some FeatureLayers, and I can see their loading is working: LoadStatus changes from NotLoaded to Loading, and finally to Loaded. On these machines I can open a browser and load any of the layer URLs with no problem.

The only other way I found to reproduce the same behaviour (blank or empty MapView) is disconnecting from the arcGIS server or using a fake URL for the layer ArcGISTiledLayer.

I'm pretty sure it's not the code, since I'm testing using the same binaries. I'm starting to think it could be they are in different networks, though I have one exception on that (one machine on the same network as the ArcGIS that shows the same behaviour, but it could be because it's a Windows Server).

BTW, all machines are accessed using Windows Remote Desktop.

0 Kudos
1 Solution

Accepted Solutions
AdrianPlatte
Occasional Contributor

Hello,

Finally, I got it solved. I don't know why, but it looks like this line was causing the problem:

this.m_MapView.Map = new Map(BasemapStyle.ArcGISTopographic);

Just changing it to:

this.m_MapView.Map = new Map();

did the trick.

I still don't know why the issue only happened on some machines, and never in other ones, but I give up in trying to understand it.

Hope that helps,

Adrian

View solution in original post

0 Kudos
18 Replies
dotMorten_esri
Esri Notable Contributor

When you run the app, do you see the "powered by esri" logo in the bottom right corner of where the mapview should be?

Since both WinForms and RemoteDesktop require software rendering, I do wonder if there's an issue with not detecting this correctly. We can verify that by trying to force software rendering with the following line of code when the app starts up (before the mapview is created):
    AppContext.SetSwitch("Switch.Esri.ArcGISRuntime.ForceSoftwareRendering", true);

Which version are you using? (there's been several issues fixed wrt detecting software rendering being required)

0 Kudos
AdrianPlatte
Occasional Contributor

Hello, dotMorten, and thanks for the quick reply.

Yes, I see the "powered by esri" logo in all machines, both the ones that show the map and those that don't. I had that disabled before, but I have commented that line for now to see if it shows.

I've tried forcing software rendering as you explain, before I create my WPF control which contains the MapView, but it keeps showing the empty map on the same machines as before. I've even checked the switch after setting it, by using AppContext.TryGetSwitch() and it confirms to me the switch is enabled.

I'm using SDK version 100.11.2.0.

Thanks, and kind regards,

Adrian

0 Kudos
dotMorten_esri
Esri Notable Contributor

Thanks for confirming. This definitely seems like a new issue I haven't encountered before. Can you share any extra information about the machines where it isn't working? Are they VMs? And do those VMs support DirectX ?
You can try and run the command `dxdiag` (WIN+R) and the click "Save all information" to save a report on the system hardware.

0 Kudos
AdrianPlatte
Occasional Contributor

Yes, they are all virtual machines. I attach 3 dxdiag result files:

DxDiag_WKS_OK.txt is a Windows 10 VM where the map runs perfectly OK, and is in the same sub-net as the ArcGIS server.

DxDiag_WKS_BAD.txt is a Windows 10 VM where the map shows empty. It's on a different sub-net, but I  still can ping the ArcGIS server, and access the layer URLs from a browser.

DxDiag_SRV_BAD.txt is a Windows Server 2016 Standard VM where the map shows empty. Same different sub-net as DxDiag_WKS_BAD.txt, and I can also ping the ArcGIS server and access the layer URLs from a browser.

I'm thinking of the different sub-net as being the cause, but I don't know what to look for. As I said before, I see on my logs that the layers are loading, and also the MapView events (MouseMove, etc) are being fired.

Thanks,

Adrian

0 Kudos
dotMorten_esri
Esri Notable Contributor

Thanks. Things seem to look ok there. What sort of VM software are you using? (VMWare etc) Are they different between the working and non-working one?

Also could you monitor each layer's LoadStatus property, as well as their LayerViewStatus?

https://developers.arcgis.com/net/api-reference/api/netwin/Esri.ArcGISRuntime/Esri.ArcGISRuntime.Map...


mapView.LayerViewStateChanged += MapView_LayerViewStateChanged;

private void MapView_LayerViewStateChanged(object sender, LayerViewStateChangedEventArgs e)
{
Debug.WriteLine("*** LayerViewState : " + e.Layer.Name + " = " + e.LayerViewState.Status + " | " + e.LayerViewState.Error?.Message);
}

0 Kudos
dotMorten_esri
Esri Notable Contributor

Also just to rule WinForms in/out: If you just create a really simple WPF application (without WinForms) with those layers in a MapView, will it work on those machines?

0 Kudos
AdrianPlatte
Occasional Contributor

Hello, dotMorten.

They are all Hyper-V VM machines running on the same Hyper-V server. The only major difference is the subnet where they belong to. Those VMs on a different subnet are the ones unable to show the map.

I have written a simple WPF application with the MapView control on it and added code to load the same base map and feature layers. I've also added code for monitoring layer's LoadStatusChange event and mapView's LayerViewStateChange event. This is what I found:

At all VMs I see logging that shows that baseMap (ArcGISTiledLayer), feature tables and feature layers are evolving from LoadStatus NotLoaded to Loading and then to Loaded.

At the working VM I see logging for the mapView's LayerViewStateChange event that shows that each feature layer's LayerViewState.Status is evolving from NotVisible to Active, or to NotVisible + OutOfScale, and in all of them LayerViewState.Error is null or empty.

But at the non-working VM, I don't see any logging about the mapView's LayerViewStateChange event.

Does that make any sense for you? What else could I do to check access to the ArcGIS server, other than testing the basemap and the feature layer URLs on a browser?

Thanks, and kind regards,

Adrian

0 Kudos
dotMorten_esri
Esri Notable Contributor

If the issue was due to the sub network, I don't think we'd have seen a successful load of the layers. Since they appear to load fine, I'm guessing this isn't a network issue, but could perhaps be confirmed by trying to load some local data instead.

The fact that the layer view state is never changing, seems to indicate to me that the map view never starts up drawing.

0 Kudos
AdrianPlatte
Occasional Contributor

This VMs don't have access to the Internet. I've managed to save Esri's map to a local directory, using instructions from https://developers.arcgis.com/net/offline-maps-scenes-and-data/tutorials/display-an-offline-map-cust... without the very last step that loads the offline map directly from the GenerateOfflineMapJob.Result. I can now copy that directory to the VMs.

How can I load that offline map from the directory into an empty MapView?

Thanks, and kind regards,

Adrian

0 Kudos