Hi,
I have been struggle for quite àsome time to find a way to retrieve byte array data from sql server and get them as image source for a content view. this is my code :
try
{
foreach (var i in prod2)
{
var l = new LieuxImDTO();
l.Adresse = i.Adresse;
l.Nom = i.Nom;
l.DateCreat = i.DateCreat;
l.Id = i.Id;
l.ImageCouv = i.ImageCouv;
l.Operateur = i.Operateur;
l.OwnerId = i.OwnerId;
l.Reference = i.Reference;
l.Type = i.Type;
if (i.ImageCouv !=null)
{
await Shell.Current.DisplayAlert("EasyManager", "Binaire existant" + i.ImageCouv.Length, "Ok");
//This help me to really notice that there are data coming back from the server
}
byte[] imageArray = i.ImageCouv;
MemoryStream memory = new MemoryStream(imageArray);
l.MyImage.Source = ImageSource.FromStream(() => (Stream)memory);
lim.Add(l);
}
}
catch (Exception ex)
{
await Shell.Current.DisplayAlert("EasyManager", ex.Message, "Ok");
//Here the exception is : Object reference not set to an instance of an object
return null;
}
So could some body help me in getting an issue ? I am not really experienced in Net Maui.
Lendcap