Hello,
Welcome to Microsoft Q&A!
We can't access a closed Stream , to avoid this we can create a new MemoryStream
and copy the original data to it .
Modify your code as below
public MainViewModel(ICropper cropper)
{
CropCommand = new Command(async () =>
{
Stream cropped = await cropper.Crop();
using (var ms = new MemoryStream())
{
cropped.CopyTo(ms);
imgbyte = ms.ToArray();
MemoryStream newM = new MemoryStream(imgbyte); //add this line
ResultPhotoSource = ImageSource.FromStream(() => newM);
}
});
}
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.