firebase / firebase-unity-sdk

The Firebase SDK for Unity
http://firebase.google.com
Apache License 2.0
200 stars 33 forks source link

[Bug] Error caught by debugger on each recompile when in play mode #1049

Open tomkail opened 2 weeks ago

tomkail commented 2 weeks ago

Description

When my debugger (Rider) is connected, each time Unity recompiles due to code being edited while Unity is running, the follow exception is thrown. This makes it very annoying to leave my debugger attached.

System.ArgumentNullException: "_p_firebasefirestorecsharp__TransactionManager" has been disposed at Firebase.Firestore.TransactionManagerProxy.CppDispose () [0x00016] in /home/runner/work/firebase-unity-sdk/firebase-unity-sdk/linux_unity/firestore/swig/Firebase.Firestore_fixed.cs:3644 at Firebase.Firestore.TransactionManager.Dispose () [0x0000d] in /home/runner/work/firebase-unity-sdk/firebase-unity-sdk/firestore/src/TransactionManager.cs:63 at Firebase.Firestore.FirebaseFirestore.Dispose () [0x0004c] in /home/runner/work/firebase-unity-sdk/firebase-unity-sdk/firestore/src/FirebaseFirestore.cs:96 at Firebase.Firestore.FirebaseFirestore.Finalize () [0x00002] in /home/runner/work/firebase-unity-sdk/firebase-unity-sdk/firestore/src/FirebaseFirestore.cs:76

Reproducing the issue

Run your project, connect your debugger, change some code to force unity to compile.

Firebase Unity SDK Version

12

Unity editor version

2022.x.x

Installation Method

.unitypackage

Problematic Firebase Component(s)

Firestore

Other Firebase Component(s) in use

Firestore

Additional SDKs you are using

No response

Targeted Platform(s)

Apple Platforms

Unity editor platform

Mac

Scripting Runtime

IL2CPP

Release Distribution Type

Pre-built SDK from https://firebase.google.com/download/unity

Relevant Log Output

System.ArgumentNullException: "_p_firebase__firestore__csharp__TransactionManager" has been disposed
  at Firebase.Firestore.TransactionManagerProxy.CppDispose () [0x00016] in /home/runner/work/firebase-unity-sdk/firebase-unity-sdk/linux_unity/firestore/swig/Firebase.Firestore_fixed.cs:3644 
  at Firebase.Firestore.TransactionManager.Dispose () [0x0000d] in /home/runner/work/firebase-unity-sdk/firebase-unity-sdk/firestore/src/TransactionManager.cs:63 
  at Firebase.Firestore.FirebaseFirestore.Dispose () [0x0004c] in /home/runner/work/firebase-unity-sdk/firebase-unity-sdk/firestore/src/FirebaseFirestore.cs:96 
  at Firebase.Firestore.FirebaseFirestore.Finalize () [0x00002] in /home/runner/work/firebase-unity-sdk/firebase-unity-sdk/firestore/src/FirebaseFirestore.cs:76

If using CocoaPods for Apple platforms, the project's Podfile.lock

Expand Podfile.lock snippet
```yml 👀 Replace this line with the contents of your Podfile.lock! ```
google-oss-bot commented 2 weeks ago

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

ehsannas commented 1 week ago

Hey @tomkail , thanks for reporting. Does the issue occur consistently? Would you be able to give me a full log?

It looks as though there's a race condition and the code is trying to dispose of something that's already been disposed.

tomkail commented 1 week ago

Yeah, it's been happening fairly consistently since I've been using the package, over a year. I wrote in via the website (since that's where the downloads for Unity are hosted) but never heard back; I only realised this github existed recently. How can I get the full log?

ehsannas commented 1 week ago

Set FirebaseFirestore.LogLevel = LogLevel.Debug as early as possible in your application. Reproduce the crash. Depending on your environment you should be able to find the crash log.