Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@pauldendulk
Copy link
Member

@pauldendulk pauldendulk commented Oct 14, 2025

The things changed in this PR came about while working on and testing the samples. There is one important fix and other minor changes.

  • 🚨Changed event to call OnDataChanged instead of OnFetchRequested to prevent a fetch loop that could happen with a certain timing.
  • 🐛Fixed Y-axis inversion bug in WmsProvider extent calculation.
  • 🐛Restored client rect update in Blazor MapControl for scrolling workaround.
  • Corrected ConfigureAwait usage in InfoLayersSample.
  • Added locking to ShapeFilesDeployer to prevent parallel file deployments.
  • Renamed _layer to _sourceLayer in RasterizingLayer for clarity.
  • Refactored fetchInfo creation into ToFetchInfo method in Map.cs.
  • Add comments about SQLite packages that had to downgraded in Blazor.
  • Improved logging to include full exception and stack trace.
  • Added ConfigureAwait(false) to async tasks in DataFetcher and other places.

@pauldendulk pauldendulk changed the title Fix fetch loop in RasterizingLayer Fix possible fetch loop in RasterizingLayer depending on timing Oct 14, 2025
{
Catch.Exceptions(() =>
{
// The client rect needs updating for scrolling. I would rather do that on the onscroll event but it does not fire on this element.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was removed while trying to fix this issue #3105 but seems to be needed. A bit obscure how this works. It feels like a workaround for how Blazor works.

{
_getFetchableSources = getFetchableSources;
_ = Task.Run(() => AddConsumerAsync(_channel));
_ = Task.Run(() => AddConsumerAsync(_channel).ConfigureAwait(false));
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added some ConfigureAwait(false) just to be sure but it did not make a difference for my current problem.

{
private readonly ConcurrentStack<RasterFeature> _cache;
private readonly ILayer _layer;
private readonly ILayer _sourceLayer;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed fields and methods related to the source layer to sourceLayer, which makes the essential part less visible.

if (_busy) return;

OnFetchRequested();
OnDataChanged(e);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the essential part of this MR. Calling the OnFetchRequested causes a loop. By calling OnDataChanged we avoid this, but there is not an unsupported scenario for when a feature in the IProvider is modified. I don't have a solution for this yet.

var maxPoint = viewport.ScreenToWorld(screenPosition.X + halfSymbolSize, screenPosition.Y + halfSymbolSize);

var extent = new MRect(minPoint.X, minPoint.Y, maxPoint.X, maxPoint.Y);
var extent = new MRect(minPoint.X, maxPoint.Y, maxPoint.X, minPoint.Y); // Note that the Y axis is inverted by ScreenToWorld
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This cause an error in the logs, although I did not see where it broke functionality, but it probably did.

_dataFetcher.ViewportChanged(fetchInfo);
}

private static FetchInfo? ToFetchInfo(Viewport viewport, ChangeType changeType, string? CRS)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not essential, I was trying to understand the code and this change made it a bit easier.

<PackageReference Include="HarfBuzzSharp.NativeAssets.WebAssembly" />
<PackageReference Include="SkiaSharp.NativeAssets.WebAssembly" />

<!-- Had to reference sqlite-net-pcl and SQLitePCLRaw.bundle_green because I get an I/O error with the SourceGear ones. -->
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment should have been in this previous PR: #3188

builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });

Mapsui.Logging.Logger.LogDelegate += (l, m, e) => Console.WriteLine(m + e?.Message);
Mapsui.Logging.Logger.LogDelegate += (l, m, e) => Console.WriteLine(m + e);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logging the entire exception plus stack trace because that is was helped me here

public async Task InitializeTestAsync(IMapControl mapControl)
{
await Task.Delay(1000).ConfigureAwait(true);
await Task.Delay(1000).ConfigureAwait(false);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was just wrong.


public static class ShapeFilesDeployer
{
private static object _lock = new();
Copy link
Member Author

@pauldendulk pauldendulk Oct 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This did not cause a bug but it was weird to see that multiple deploys are done in parallel. Sometimes of the same file. We need to check earlier if a deploy has been done already, because the same files are deployed by different samples.

@pauldendulk pauldendulk added the PR type: 🐛 Fix A bug fix or patch for existing functionality. label Oct 14, 2025
@pauldendulk pauldendulk merged commit d8c6ee8 into main Oct 19, 2025
5 checks passed
@pauldendulk pauldendulk deleted the fix/rasterizinglayer branch October 19, 2025 08:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR type: 🐛 Fix A bug fix or patch for existing functionality.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants