Xamarin.forms: [Android, PCL] - ImageLoaderSourceHandler: no se pudo recuperar la imagen o los datos de la imagen no eran válidos

Creado en 13 feb. 2018  ·  3Comentarios  ·  Fuente: xamarin/Xamarin.Forms

Descripción

  • En Android, usando los formularios más recientes y un proyecto PCL ... un ImageCell XAML con un ImageSource codificado may timeout y devuelve un error.

  • Parece funcionar como se esperaba con las soluciones estándar de .NET o compartidas

  • Solo probado en simulación

<ImageCell
    ImageSource="https://www.xamstatic.com/dist/images/pages/platform/visual-studio-icon-uHIZMvQl.png"
    Text="{Binding Name}"
    Detail="{Binding Job}">
</ImageCell>
Image Loading: Error getting stream for https://www.xamstatic.com/dist/images/pages/platform/visual-studio-icon-uHIZMvQl.png: System.Threading.Tasks.TaskCanceledException: A task was canceled.
...
[0:] ImageLoaderSourceHandler: Could not retrieve image or image data was invalid: Uri: https://www.xamstatic.com/dist/images/pages/platform/visual-studio-icon-uHIZMvQl.png

Pasos para reproducir

  1. Usando el repositorio a continuación, cargue la muestra de PCL
  2. Correr
  3. Debería ver una lista de ImageCell con el icono de Visual Studio
  4. Verifique la salida en busca de error y tiempo de espera
  5. ¿No ocurrió el error? Desinstale la aplicación y vuelva a intentarlo.

Comportamiento esperado

Todas las imágenes se cargan, como lo hacen en las soluciones estándar .NET y compartidas.


Comportamiento real

Enlace al registro de salida completo

[0:] Image Loading: Error getting stream for https://www.xamstatic.com/dist/images/pages/platform/visual-studio-icon-uHIZMvQl.png: System.Threading.Tasks.TaskCanceledException: A task was canceled.
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00026] in <657aa8fea4454dc898a9e5f379c58734>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <657aa8fea4454dc898a9e5f379c58734>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <657aa8fea4454dc898a9e5f379c58734>:0 
  at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <657aa8fea4454dc898a9e5f379c58734>:0 
  at System.Net.Http.HttpClientHandler+<SendAsync>d__63.MoveNext () [0x00528] in <35658e59c86d40bdbb2ef0bb34b4f0c7>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <657aa8fea4454dc898a9e5f379c58734>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0001a] in <657aa8fea4454dc898a9e5f379c58734>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <657aa8fea4454dc898a9e5f379c58734>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <657aa8fea4454dc898a9e5f379c58734>:0 
  at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in <657aa8fea4454dc898a9e5f379c58734>:0 
  at System.Net.Http.HttpClient+<SendAsyncWorker>d__49.MoveNext () [0x000ca] in <35658e59c86d40bdbb2ef0bb34b4f0c7>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <657aa8fea4454dc898a9e5f379c58734>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0001a] in <657aa8fea4454dc898a9e5f379c58734>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <657aa8fea4454dc898a9e5f379c58734>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <657aa8fea4454dc898a9e5f379c58734>:0 
  at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <657aa8fea4454dc898a9e5f379c58734>:0 
  at Xamarin.Forms.Forms+AndroidPlatformServices+<GetStreamAsync>d__16.MoveNext () [0x0003e] in D:\agent\_work\2\s\Xamarin.Forms.Platform.Android\Forms.cs:448 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <657aa8fea4454dc898a9e5f379c58734>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0001a] in <657aa8fea4454dc898a9e5f379c58734>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <657aa8fea4454dc898a9e5f379c58734>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <657aa8fea4454dc898a9e5f379c58734>:0 
  at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in <657aa8fea4454dc898a9e5f379c58734>:0 
  at Xamarin.Forms.UriImageSource+<GetStreamAsyncUnchecked>d__23.MoveNext () [0x00224] in D:\agent\_work\2\s\Xamarin.Forms.Core\UriImageSource.cs:174 
[0:] ImageLoaderSourceHandler: Could not retrieve image or image data was invalid: Uri: https://www.xamstatic.com/dist/images/pages/platform/visual-studio-icon-uHIZMvQl.png

Información básica

Enlace de reproducción

https://github.com/mattregul/XF_ImageCellIssue

regression Android bug

Comentario más útil

¡UPS! No se puede encontrar esa página.

esta url funciona mejor (en el momento de escribir): https://doumer.me/resolve-image-loading-error-in-xamarin-forms

Todos 3 comentarios

Tuve el mismo problema y descubrí que se debía al hecho de que cargué una imagen desde una URL SSL como tú. Aquí hay una solución al problema https://doumer.me/2018/03/29/resolve-image-loading-error-in-xamarin-forms/
Lo resolví cambiando la configuración de SSL y TLS.

¡UPS! No se puede encontrar esa página.

esta url funciona mejor (en el momento de escribir): https://doumer.me/resolve-image-loading-error-in-xamarin-forms

La URL de la imagen en la reproducción original parece totalmente rota en este punto. No puedo hacer que se cargue en un navegador, netstandard o PCL.

Dicho esto, acabo de encontrar otra URL y no pudo cargar imágenes en 2.5
Luego actualicé la muestra de PCL a 3.1 y todas las imágenes cargadas allí

Si mi evaluación parece incorrecta, avíseme y adjunte una reproducción 3.1.

¿Fue útil esta página
0 / 5 - 0 calificaciones