The Map is slow when the site is in production
We have implemented this in our site and the map si too slow when we are removing and adding Markers,
In our local, it works fine,
We are using .Net 8
The app is not a full Blazor App, we are using components for that and the site is built with Umbraco.
I hope someone has some ideas as I have run out of ideas.
https://github.com/user-attachments/assets/93a23cc2-5a36-4127-b24a-0a29f103f978
It is Blazor server? What if you do with AdvancedMarkerPerforms? Any console errors? What if you host in simple linux?
Please share production url.
Hi @valentasm1
- It is Blazor Server
- I'll try AdvancedMarkerPerforms
- We don't have any console errors, only warning logs
- We are using Windows Server, for the cloud, and our hosting You can check it here: https://temp.nationalcorporatehousing.com/search?city=Chicago&beds=1
Could you try info window without image. Also i highly suggest dont use marker. It is obsolete and you will get into problems in future. You advanced marker. There enough demos and functionality is almost the same.
Also try use AdvancedMarkerElementList It is a bit strange but once you will get used it will be easy. It will run one roundtrip to js.
I'm testing, but I always get a null reference error, I'll try with MarkerList
Do you have call stack?
@valentasm1
If you mean if we have several maps on the same page, then yes, but for example, the map on that page have a pagination and he page size is 9 markers per page
No. I mean exception callstack. It shows where exceptions comes from. https://learn.microsoft.com/en-us/dotnet/api/system.exception.stacktrace?view=net-8.0
Oh, sorry, this is what i get in the call stack, please let me know if you had an idea
System.NullReferenceException
HResult=0x80004003
Message=Object reference not set to an instance of an object.
Source=GoogleMapsComponents
StackTrace:
at GoogleMapsComponents.Serialization.OneOfConverterFactory.OneOf2JsonConverter2.Write(Utf8JsonWriter writer, OneOf2 value, JsonSerializerOptions options)
at System.Text.Json.Serialization.JsonConverter1.TryWrite(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state) at System.Text.Json.Serialization.Metadata.JsonPropertyInfo1.GetMemberAndWriteJson(Object obj, WriteStack& state, Utf8JsonWriter writer)
at System.Text.Json.Serialization.Converters.ObjectDefaultConverter1.OnTryWrite(Utf8JsonWriter writer, T value, JsonSerializerOptions options, WriteStack& state) at System.Text.Json.Serialization.JsonConverter1.TryWrite(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state)
at System.Text.Json.Serialization.JsonConverter1.WriteCore(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state) at System.Text.Json.Serialization.Metadata.JsonTypeInfo1.Serialize(Utf8JsonWriter writer, T& rootValue, Object rootValueBoxed)
at System.Text.Json.Serialization.Metadata.JsonTypeInfo1.SerializeAsObject(Utf8JsonWriter writer, Object rootValue) at System.Text.Json.Serialization.Metadata.JsonTypeInfo1.Serialize(Utf8JsonWriter writer, T& rootValue, Object rootValueBoxed)
at System.Text.Json.JsonSerializer.WriteString[TValue](TValue& value, JsonTypeInfo1 jsonTypeInfo) at System.Text.Json.JsonSerializer.Serialize[TValue](TValue value, JsonSerializerOptions options) at GoogleMapsComponents.Helper.SerializeObject(Object obj) at GoogleMapsComponents.Helper.<>c__DisplayClass8_0.<MakeArgJsFriendly>b__0(Object arg) at System.Linq.Enumerable.SelectArrayIterator2.MoveNext()
at System.Text.Json.Serialization.Converters.IEnumerableDefaultConverter2.OnWriteResume(Utf8JsonWriter writer, TCollection value, JsonSerializerOptions options, WriteStack& state) at System.Text.Json.Serialization.JsonCollectionConverter2.OnTryWrite(Utf8JsonWriter writer, TCollection value, JsonSerializerOptions options, WriteStack& state)
at System.Text.Json.Serialization.JsonConverter1.TryWrite(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state) at System.Text.Json.Serialization.JsonConverter1.TryWriteAsObject(Utf8JsonWriter writer, Object value, JsonSerializerOptions options, WriteStack& state)
at System.Text.Json.Serialization.JsonConverter1.TryWrite(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state) at System.Text.Json.Serialization.Converters.ArrayConverter2.OnWriteResume(Utf8JsonWriter writer, TElement[] array, JsonSerializerOptions options, WriteStack& state)
at System.Text.Json.Serialization.JsonCollectionConverter2.OnTryWrite(Utf8JsonWriter writer, TCollection value, JsonSerializerOptions options, WriteStack& state) at System.Text.Json.Serialization.JsonConverter1.TryWrite(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state)
at System.Text.Json.Serialization.JsonConverter1.WriteCore(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state) at System.Text.Json.Serialization.Metadata.JsonTypeInfo1.Serialize(Utf8JsonWriter writer, T& rootValue, Object rootValueBoxed)
at System.Text.Json.JsonSerializer.WriteString[TValue](TValue& value, JsonTypeInfo1 jsonTypeInfo) at System.Text.Json.JsonSerializer.Serialize[TValue](TValue value, JsonSerializerOptions options) at Microsoft.JSInterop.JSRuntime.InvokeAsync[TValue](Int64 targetInstanceId, String identifier, CancellationToken cancellationToken, Object[] args) at Microsoft.JSInterop.JSRuntime.<InvokeAsync>d__161.MoveNext()
at System.Threading.Tasks.ValueTask1.get_Result() at GoogleMapsComponents.Helper.<MyInvokeAsync>d__101.MoveNext()
at GoogleMapsComponents.JsObjectRef.<CreateMultipleAsync>d__11.MoveNext()
at GoogleMapsComponents.JsObjectRef.<CreateMultipleAsync>d__8.MoveNext()
at GoogleMapsComponents.Maps.Extension.AdvancedMarkerElementList.<CreateAsync>d__2.MoveNext()
at NationalHome.Web.Components.Maps.MarkerMap.<AddMarkers>d__39.MoveNext() in D:\Projects\NationalHome\src\NationalHome.Web\Components\Maps\MarkerMap.razor.cs:line 81
This exception was originally thrown at this call stack: GoogleMapsComponents.Helper.SerializeObject(object) GoogleMapsComponents.Helper.MakeArgJsFriendly.AnonymousMethod__0(object) GoogleMapsComponents.JsObjectRef.CreateMultipleAsync(Microsoft.JSInterop.IJSRuntime, string, System.Collections.Generic.Dictionary<System.Guid, object>) GoogleMapsComponents.JsObjectRef.CreateMultipleAsync(Microsoft.JSInterop.IJSRuntime, string, System.Collections.Generic.Dictionary<string, object>) GoogleMapsComponents.Maps.Extension.AdvancedMarkerElementList.CreateAsync(Microsoft.JSInterop.IJSRuntime, System.Collections.Generic.Dictionary<string, GoogleMapsComponents.Maps.AdvancedMarkerElementOptions>) NationalHome.Web.Components.Maps.MarkerMap.AddMarkers(System.Collections.Generic.List<NationalHome.Core.Models.MapItemViewModel>) in MarkerMap.razor.cs
@jmc18 I get this error if I don't have Content set in my AdvancedMarkerElementOptions, like your example. Try setting it and it should work.
I think you are right. Added fix and will release with next upcoming realese.