-
-
Notifications
You must be signed in to change notification settings - Fork 313
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Avalonia MapControl Hangs App if no Internet Connection #2226
Comments
I don't see this if I start the Avalonia desktop sample on Windows without internet. If can still use the app, switch samples, and if I open for instance the Atlas sample I can see all the items and can pan and zoom. Could it be related to some of the layers you use? Can you selectively turn layers off the see if the problem remains? |
@pauldendulk Thanks for taking a look at this. It was a good idea to check the layers. The offending layer is the Bing maps tile layer: var tileLayer = new Mapsui.Tiling.Layers.TileLayer(
BruTile.Predefined.KnownTileSources.Create(
BruTile.Predefined.KnownTileSource.BingRoads,
ApiKeys.BingMapsKey));
map.Layers.Add(tileLayer); When this is commented out the application doesn't hang. I should also add it appears it is caught in a polling loop trying to download tiles. Sometimes it's possible to click away from the control so the application hasn't completely hanged/blocked the UIThread. It is just doing something that takes all resources. Here is the full init code is below code: var map = new Mapsui.Map()
{
BackColor = new Mapsui.Styles.Color(0xFF, 0xFF, 0xFF, 0xFF)
};
map.Navigator.Limiter = new ViewportLimiterKeepWithinExtent();
// Add the map tiles layer (actual mapping data)
var tileLayer = new Mapsui.Tiling.Layers.TileLayer(
BruTile.Predefined.KnownTileSources.Create(
BruTile.Predefined.KnownTileSource.BingRoads,
ApiKeys.BingMapsKey));
map.Layers.Add(tileLayer);
// Add the pins layer
this.pins.Clear();
this.pinsLayer = new WritableLayer
{
Name = "Pins Layer",
Style = new VectorStyle
{
Fill = new Brush(new Mapsui.Styles.Color(0xF4, 0x64, 0x11, 0xFF)),
Outline = new Pen(Mapsui.Styles.Color.White, 1)
}
};
map.Layers.Add(this.pinsLayer); |
I can not reproduce the problem so far. There is probably a real issue underneath but I need to reproduce it in order to fix it. Please help me to reproduce it. It created a minimal sample based on the code you pasted above. Please check it out to see if you can reproduce it. If not, what else could play a role? https://github.com/pauldendulk/ReproduceMapsuiIssueWithNoInternet In order to reproduce it I just turn off my wifi. That may not be the circumstance under which this happens. Perhaps it only occurs when the status of internet is still unclear (silently hanging). How does it behave in your app when you just turn off wifi? |
This issue might be related: #1889 |
@robloo I created a minimal sample trying to reproduce it but failed. Could you look into the difference with your situation? |
Thanks for taking a deeper look at this. I think I'll try to run using Mapsui code directly in the app being tested. That will let me step through and debug better to see where the problem might be. I'll try to do this within the next week or so. |
Some thoughts:
|
Mapsui Version
4.1.0
Mapsui Platform
Avalonia 11.1
Device
Windows 10 Pro
Describe the bug
If no internet connection is available to load map tiles, the MapControl will fail to initialize properly and essentially hangs the application.
To Reproduce
TBD
Expected behavior
This situation should fail gracefully and the MapControl should just be non-functional or not show with a blank map layer. It can retry behind the scenes but should never cause an application hang.
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
This is worked-around on the app side for now by pinging for an internet connection before instantiating the MapControl. This is inherently unreliable though and is best handled within Mapsui or Brutile itself.
The text was updated successfully, but these errors were encountered: