Open LuisRguezEsriSpain opened 1 year ago
@LuisRguezEsriSpain Would you be able to share a small sample that reproduces the issue?
I share a small sample.
Thank you. Were you only seeing this on Android, or only on certain Android devices? I see the basemaps both on Windows and on my Android:
Hi Morten,
I only see Thumbnails on certain Android devices.
Por example:
It looks like it is hitting this fallback:
That data should be coming from here: https://github.com/Esri/arcgis-maps-sdk-dotnet-toolkit/blob/8e5bc024f51beea413b3f11541ed662854e38323/src/Toolkit/Toolkit/UI/Controls/BasemapGallery/BasemapGalleryItem.cs#L100
Since I can't reproduce, would you be able to debug what is happening on your specific Android devices and see why the thumbnails fail to load?
Hi Morten,
This is the debug's result.
at RuntimeCoreNet.GeneratedWrappers.CoreImage.GetEncodedBuffer() at Esri.ArcGISRuntime.UI.RuntimeImage.GetEncodedBufferAsync(CancellationToken cancellationToken) at PoCDrones.BasemapGallery.BasemapGalleryItem.LoadImage() in C:\LuisRodriguez\Proyectos\ENAIRE\200_2\Incidencia\PoCDrones\PoCDrones\BasemapGallery\BasemapGalleryItem.cs:line 107
this.Thumbnail.Source.AbsoluteUri: "https://www.arcgis.com/sharing/rest/content/items/983b312ebd9b4d15a02e00f50acdb1c1/info/thumbnail/thumbnail1607564423352.jpeg"
Thank you for the detailed screenshots. InvalidProgramException
sounds like something went wrong in .NET or the compilation: https://learn.microsoft.com/en-us/dotnet/api/system.invalidprogramexception?view=net-7.0
Is your .NET up to date? Any chance you could also try with the latest .NET 8?
Hi Morten,
I don't see how to create a ArcGIS Maps SDK .NET MAUI project using .NET.
I also don't see a way to change an existing project's .NET Framework.
.NET 8 shipped as final yesterday. If you update your visual studio to latest, you should now see it in your dropdown (before this you needed the preview release)
Hi Morten,
I've installed the latest versión of visual studio.
I've also installed ArcGIS_Maps_SDK_DotNet_Templates_200_3_0.vsix.
In project propertiens I cannot choose either "Target Android Framework" or "Minimum Target Android Framework".
In addition to this issue I have others issues:
@LuisRguezEsriSpain are you able to build a normal .NET MAUI app targeting .NET 8? Most of the settings you refer too are easiest set in the .csproj file directly.
@dotMorten I've done this workaround in BasemapGalleryItem class and work properly:
private async Task LoadImage()
{
IsLoadingThumbnail = true;
try
{
await (Thumbnail?.LoadAsync() ?? Task.CompletedTask);
if (Thumbnail?.LoadStatus == LoadStatus.Loaded)
{
var stream = await Thumbnail.GetEncodedBufferAsync();
var buffer = new byte[stream.Length];
await stream.ReadAsync(buffer, 0, (int)stream.Length);
ThumbnailData = buffer;
#if WINDOWS_XAML
ThumbnailBitmap = await Thumbnail.ToImageSourceAsync();
#endif
}
_hasLoaded = true;
}
catch (Exception ex)
{
await LoadImageAux();
}
finally
{
IsLoadingThumbnail = false;
}
}
private async Task LoadImageAux()
{
try
{
HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, Thumbnail.Source);
HttpClient client = new HttpClient(new HttpClientHandler());
var response = await client.SendAsync(request, HttpCompletionOption.ResponseHeadersRead).ConfigureAwait(false);
var content = response.EnsureSuccessStatusCode();
var streamRes = await content.Content.ReadAsStreamAsync();
byte[] buffer = new byte[16 * 1024];
using (MemoryStream ms = new MemoryStream())
{
int read;
while ((read = await streamRes.ReadAsync(buffer, 0, buffer.Length)) > 0)
{
ms.Write(buffer, 0, read);
}
ThumbnailData = ms.ToArray();
}
}
catch (Exception ex2)
{
}
}
I am developing an application with MAUI.
When I run de app by using "Samsung Galaxy Tab A SM-T510" and "Samsung Galaxy Tab A SM-T580", Toolkit Basemap Gallery widget doesn't display the Thumbnails properly.
After creating a Esri Case, Esri recommend me submit a new Issue.