collection.GetSnapshotAsync代码停止我的控制台应用程序

时间:2019-07-08 02:46:23

标签: c# firebase google-cloud-firestore firebase-authentication

我试图读取数据并将其插入FireStore,并且在此代码后我的应用程序失败->等待newDoc.GetSnapshotAsync(); 我正在使用控制台应用程序,它在该行之后停止。尝试捕获不会捕获任何错误。

 try {

            GoogleCredential credential = GoogleCredential.FromFile("project.json");
            ChannelCredentials channelCredentials = credential.ToChannelCredentials();
            Channel channel = new Channel(FirestoreClient.DefaultEndpoint.ToString(), channelCredentials);
            FirestoreClient firestoreClient = FirestoreClient.Create(channel);
            db = FirestoreDb.Create(projectId, client: firestoreClient);

                    var collection = db.Collection("users");  
                    var newDoc = collection.Document("x5EkYuk23odfmXZX8KfW");  
                    var qs = await newDoc.GetSnapshotAsync();  <--stops here
  }
  catch(Exception ex)
  {
     throw; <-- never hits here
  }

0 个答案:

没有答案