Random crashes calling ImageConversion:LoadImage

Hello,

Some of my users are experiencing “random” (I call that method quite a lot and it works most of the time) crashes when calling the following method:
UnityEngine.ImageConversion:LoadImage (UnityEngine.Texture2D,byte[ ],bool)

I’m using Unity 2020.1.6f1

I’ve attached crash logs to this thread.

Here is my code calling that function:

public static Texture2D LoadImage(string filePath)
        {

            Texture2D tex = null;
            byte[] fileData;

            if (File.Exists(filePath))
            {
                fileData = File.ReadAllBytes(filePath);
                tex = new Texture2D(2, 2); // new Texture2D (2, 2, TextureFormat.BGRA32,false);
                tex.LoadImage(fileData); //..this will auto-resize the texture dimensions.
            }
            return tex;
        }

I’ve checked with one user (the one from the attached logs) and his drivers are up to date.

Everything besides that call works well on his computer.

I saw several threads/questions a bit old related to similar bugs and they all seemed to have been resolved so I’m wondering if there is anything I can do to avoid the crashes at least.

Thank you for your help,

6457036–723802–Player.log.txt (48.8 KB)
6457036–723805–error.log.txt (73.6 KB)

1 Like

Same issue. Sporadic, impossible to repro on purpose, but does seem to happen reliably after a lot of gameplay. I believe the error message says invalid memory address or something like that