I have a Stream received from a PhotoResult of photoChooserTask_Completed(object sender, PhotoResult e) event handler.
The e.ChosenPhoto itself a Stream so I assign it to Stream stream. And I converted it to byte[] array using the method below:
    public static byte[] ReadImageFile2(Stream mystream)
    {
        // The mystream.length is still full here.
        byte[] imageData = null;
        using (BinaryReader br = new BinaryReader(mystream))
        {
            imageData = br.ReadBytes(Convert.ToInt32(mystream.Length));
        }
        // But imageData.length is 0
        return imageData;
    }
I don't know what is wrong with the BinaryReader, it returns imageData with just 0 length. Tried to cast type as br.ReadBytes((int)mystream.Length) but still doesn't work.
Also tried all of the answers in Creating a byte array from a stream but still not working. Maybe my e.ChosenPhoto cannot be used as a normal Stream.
Thank you.
 
     
    