Mapsui
Mapsui copied to clipboard
Map crashes and view disappears.
Mapsui Version
<PackageReference Include="Mapsui" Version="5.0.0-beta.4" />
<PackageReference Include="Mapsui.Avalonia" Version="5.0.0-beta.4" />
Mapsui Platform
<PackageReference Include="Avalonia" Version="11.2.0" />
<PackageReference Include="Avalonia.Desktop" Version="11.2.0" />
Device Windows 10
Describe the bug After working for a few minutes the map view becomes blank. when I move the mouse on the blank screen the coordinates are valid but there is no map.
Screenshots / debug out
[Visual]Exception in render loop: 'System.NullReferenceException: Object reference not set to an instance of an object.
at System.Linq.Enumerable.WhereEnumerableIterator1.ToList() at Mapsui.Rendering.VisibleFeatureIterator.IterateLayer(Viewport viewport, ILayer layer, Int64 iteration, Action6 callback)
at Mapsui.Rendering.VisibleFeatureIterator.IterateLayers(Viewport viewport, IEnumerable1 layers, Int64 iteration, Action6 callback)
at Mapsui.Styles.ImageSourceCacheInitializer.GetAllImageSources(Viewport viewport, IEnumerable1 layers, IEnumerable1 widgets)
at Mapsui.UI.Avalonia.MapControl.CommonDrawControl(Object canvas)
at Mapsui.UI.Avalonia.MapControl.MapsuiCustomDrawOperation.Render(ImmediateDrawingContext context)
at Avalonia.Rendering.Composition.Drawing.ServerCompositionRenderData.Render(IDrawingContextImpl context)
at Avalonia.Rendering.Composition.Server.ServerCompositionVisual.Render(ServerVisualRenderContext context, Nullable1 parentTransformedClip) at Avalonia.Rendering.Composition.Server.ServerCompositionContainerVisual.RenderCore(ServerVisualRenderContext context, LtrbRect currentTransformedClip) at Avalonia.Rendering.Composition.Server.ServerCompositionVisual.Render(ServerVisualRenderContext context, Nullable1 parentTransformedClip)
at Avalonia.Rendering.Composition.Server.ServerCompositionContainerVisual.RenderCore(ServerVisualRenderContext context, LtrbRect currentTransformedClip)
at Avalonia.Rendering.Composition.Server.ServerCompositionVisual.Render(ServerVisualRenderContext context, Nullable1 parentTransformedClip) at Avalonia.Rendering.Composition.Server.ServerCompositionContainerVisual.RenderCore(ServerVisualRenderContext context, LtrbRect currentTransformedClip) at Avalonia.Rendering.Composition.Server.ServerCompositionVisual.Render(ServerVisualRenderContext context, Nullable1 parentTransformedClip)
at Avalonia.Rendering.Composition.Server.ServerCompositionContainerVisual.RenderCore(ServerVisualRenderContext context, LtrbRect currentTransformedClip)
at Avalonia.Rendering.Composition.Server.ServerCompositionVisual.Render(ServerVisualRenderContext context, Nullable1 parentTransformedClip) at Avalonia.Rendering.Composition.Server.ServerCompositionContainerVisual.RenderCore(ServerVisualRenderContext context, LtrbRect currentTransformedClip) at Avalonia.Controls.CompositionBorderVisual.ServerBorderVisual.RenderCore(ServerVisualRenderContext ctx, LtrbRect currentTransformedClip) at Avalonia.Rendering.Composition.Server.ServerCompositionVisual.Render(ServerVisualRenderContext context, Nullable1 parentTransformedClip)
at Avalonia.Rendering.Composition.Server.ServerCompositionContainerVisual.RenderCore(ServerVisualRenderContext context, LtrbRect currentTransformedClip)
at Avalonia.Rendering.Composition.Server.ServerCompositionVisual.Render(ServerVisualRenderContext context, Nullable1 parentTransformedClip) at Avalonia.Rendering.Composition.Server.ServerCompositionContainerVisual.RenderCore(ServerVisualRenderContext context, LtrbRect currentTransformedClip) at Avalonia.Rendering.Composition.Server.ServerCompositionVisual.Render(ServerVisualRenderContext context, Nullable1 parentTransformedClip)
at Avalonia.Rendering.Composition.Server.ServerCompositionContainerVisual.RenderCore(ServerVisualRenderContext context, LtrbRect currentTransformedClip)
at Avalonia.Rendering.Composition.Server.ServerCompositionVisual.Render(ServerVisualRenderContext context, Nullable1 parentTransformedClip) at Avalonia.Rendering.Composition.Server.ServerCompositionContainerVisual.RenderCore(ServerVisualRenderContext context, LtrbRect currentTransformedClip) at Avalonia.Rendering.Composition.Server.ServerCompositionVisual.Render(ServerVisualRenderContext context, Nullable1 parentTransformedClip)
at Avalonia.Rendering.Composition.Server.ServerCompositionContainerVisual.RenderCore(ServerVisualRenderContext context, LtrbRect currentTransformedClip)
at Avalonia.Rendering.Composition.Server.ServerCompositionVisual.Render(ServerVisualRenderContext context, Nullable`1 parentTransformedClip)
at Avalonia.Rendering.Composition.Server.ServerCompositionTarget.RenderRootToContextWithClip(IDrawingContextImpl context, ServerCompositionVisual root)
at Avalonia.Rendering.Composition.Server.ServerCompositionTarget.Render()
at Avalonia.Rendering.Composition.Server.ServerCompositor.RenderCore(Boolean catchExceptions)
at Avalonia.Rendering.Composition.Server.ServerCompositor.RenderReentrancySafe(Boolean catchExceptions)
at Avalonia.Rendering.Composition.Server.ServerCompositor.Render(Boolean catchExceptions)
at Avalonia.Rendering.RenderLoop.TimerTick(TimeSpan time)' (RenderLoop #18786722)
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Have you a reproduction sample, has far as I can see it seems that a Layer returns null in the GetFeatures which is invalid because GetFeatures aren't allowed to return null only an empty List like Array.Empty<IFeature> or similar. A reproduction sample would help to find the real cause of this. (Have you implemented a Custom Layer?)
I am going to close this. Please create a new issue if you find something like this in a recent version.