0

I am having a problem when trying to use the debugger in visual studio code for my Unity project. I use Firebase Analytics in my project, and I am able to compile and run my app in the Unity Editor, as well as on iOS and Android devices. However when I try to use the debugger in VSC I get this error:

Exception has occurred.
System.IO.FileNotFoundException: Could not load the file 'Firebase.AppCheck'.
File name: 'Firebase.AppCheck'
  at System.AppDomain.Load (System.String assemblyString, System.Security.Policy.Evidence assemblySecurity, System.Boolean refonly, System.Threading.StackCrawlMark& stackMark) [0x00033] in <79a1904c928a4c2d9eba5ede6e6aa92e>:0 
  at System.AppDomain.Load (System.String assemblyString) [0x00002] in <79a1904c928a4c2d9eba5ede6e6aa92e>:0 
  at (wrapper remoting-invoke-with-check) System.AppDomain.Load(string)
  at UnityEngine.ClassLibraryInitializer+<>c.<InitAssemblyRedirections>b__2_0 (System.Object _, System.ResolveEventArgs args) [0x0000e] in /Users/bokken/build/output/unity/unity/Runtime/Export/Scripting/ClassLibraryInitializer.cs:43 
Easy

This happens at Firebase initialization, on line 3 of:

    void Start()
    {
        Firebase.FirebaseApp.CheckAndFixDependenciesAsync().ContinueWith(task => {
            var dependencyStatus = task.Result;
            if (dependencyStatus == Firebase.DependencyStatus.Available)
            {
                // Create and hold a reference to your FirebaseApp,
                // where app is a Firebase.FirebaseApp property of your application class.
                firebaseApp = Firebase.FirebaseApp.DefaultInstance;

                // Set a flag here to indicate whether Firebase is ready to use by your app.
                firebaseReady = true;
                MyDebug.Log("Firebase Analytics Ready");
            }
            else
            {
                // Firebase Unity SDK is not safe to use here.
                firebaseReady = false;
                MyDebug.Log($"Could not resolve all Firebase dependencies: {dependencyStatus}");
            }
        });
    }

Note that I don't use Firebase AppCheck (at least not as far as I know :) ), only Analytics. The file Firebase.AppCheck does not exist anywhere on my drive, nor do I want to install it, If I can help it. As I said, it all works in my release workflow, it's just the debugger that gets stuck. Any ideas on how to fix, or is it a bug in one of the tools?

Tool versions (all very recent/latest):

Unity 2022.3.33f1
Unity for VSC 1.0.2
VSC 1.90.1
Firebase Analytics 12.0.0

I searched extensively for a solution but could not find it. I double checked my configuration of the Unity plugin for VSC, it looks OK.

6
  • how did you include the firebase sdk into a unity project?
    – BNazaruk
    Commented Jun 21 at 6:13
  • I downloaded FirebaseAnalytics.unitypackage and used [Assets] -> [Import Package], per instructions in Step 4 here: firebase.google.com/docs/unity/setup Commented Jun 21 at 19:08
  • I also installed EDM4U in the same way. Commented Jun 21 at 19:15
  • Hmm, I created a new simple test project with Firebase and it does not have this problem. It must be something wrong in my project setup. I'll confirm and report back. Commented Jun 21 at 19:58
  • I did a full Firebase re-install, but it did not fix the problem. Luckily the Firebase initialization code is not strictly required, so I #if !DEBUG it as a workaround. I think it's just something wrong with my project's Firebase setup. Thank you. Commented Jun 22 at 14:43

0