Very simple app crashes

I have written very simple application in Unity for Windows Phone.

Aquarium background, bubbles (particle system) and fishes moving from left to right and right to left.

I published app to Windows Phone Store for free and in reports there are many crashes.

Stack trace which can I export:

App: AquariumInPhone
OS version: 8.0
Problem function: Unknown
Exception type: c0000005
30-day crash count: 23
Stack trace:

Frame    Image          Function                             Offset        
0        ntdll          RtlpWaitOnCriticalSection            0x0000007e    
1        ntdll          RtlpEnterCriticalSectionContended    0x00000060    
2        unityplayer                                         0x002ef5ac

This is very simple application, but crashes :frowning:

Fishes moving left have code:

using UnityEngine;

public class Fish1 : MonoBehaviour {

    float speed = 0.0032f;
    Vector3 startPoint;
    Vector3 currentPosition;
    System.Random r = new System.Random ();

    void Start()
    {    
        startPoint = transform.position;
        currentPosition = transform.position;
    }

    void Update ()
    {
        if (Camera.main.WorldToViewportPoint(transform.position).x < -0.2f)
        {
            int newY = r.Next(0, 5);

            if(r.Next(0, 2) == 0)
                newY = -newY;

            Vector3 pos = new Vector3(12.0f, (float)newY, 0.0f);
            currentPosition = pos;
            transform.position = currentPosition;
        }
        else
        {
            currentPosition.x--;
            transform.position += (currentPosition + startPoint) * speed * Time.deltaTime;
        }
    }
}

Fishes moving right have code:

using UnityEngine;

public class Fish2 : MonoBehaviour {

float speed = 0.005f;
Vector3 startPoint;
Vector3 currentPosition;
System.Random r = new System.Random ();

void Start()
{    
    startPoint = transform.position;
    currentPosition = transform.position;
}

void Update ()
{
    if (Camera.main.WorldToViewportPoint(transform.position).x > 1.2f)
    {
        int newY = r.Next(0, 5);

        if(r.Next(0, 2) == 0)
            newY = -newY;

        Vector3 pos = new Vector3(-12.0f, (float)newY, 0.0f);
        currentPosition = pos;
        transform.position = currentPosition;
    }
    else
    {
        currentPosition.x++;
        transform.position += (currentPosition + startPoint) * speed * Time.deltaTime;
    }
}
}

What can be the reason of crash? How can I fix this?

On stackoverflow somebody told me to post my problem here.

Regards, David

Hi,

I don’t think you can do anything on your own. Which Unity version are you using? Is there anything else in the stack trace, or have you posted it fully? How many downloads do you have (might help estimate how common this crash really is)?

Unity 4.3.4f1

This is all that I can export from Windows Phone Store.

1103 downloads. 23 crashes.

Have you been able to repro any of said crashes yourself?

I am beginner with Unity. This was my first app. I have run my app multiple times for long time on my smartphone and no crash. I can send .cab dump file.

That would be helpful. Could you do it through our bug reporter? It’s under Help → Report a Bug in Unity Editor.

Done.

What can I do next? I will be informed about bug fix? I should wait for new Unity release? 280 crashes on 1800 downloads. I have hidden my app from Windows Phone Store. I am planning to write commercial application - in this type of app there can not be any crashes, because crash equals to negative review in Store.

I believe the only thing you can do is wait for a new Unity release - 4.5 is just around the corner.

As for tracking the bug - we list all of them here once they’re processed: