I use the following code to connect to firebase and try to read data. The connection is successful but I am unable to read the data. It gives System.NullReferenceException:'Object reference not set to an instance of an object.
namespace GPSTrack
{
public partial class Form1 : Form
{
IFirebaseConfig config = new FirebaseConfig
{
AuthSecret = "4xxxxxxxxxxxxxxxxEzs",
BasePath= "nodxxxxxx.firebaseio.com"
};
IFirebaseClient client;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
client = new FireSharp.FirebaseClient(config);
if(client!=null)
{
MessageBox.Show("Connection success");
}
}
private async void button1_Click(object sender, EventArgs e)
{
FirebaseResponse response = await client.GetTaskAsync("test");
FBclass obj = response.ResultAs<FBclass>();
MessageBox.Show(response.ToString());
}
}
}