Encountering a JsonReaderException while using Firebase streaming in VB.NET can be frustrating. This error typically occurs due to improper JSON formatting or unexpected data types in your stream. To resolve this issue, ensure your JSON data adheres to the correct structure expected by Firebase. Additionally, check for null values or mismatched data types that might trigger the exception. Implementing robust error handling can also help you identify and troubleshoot issues quickly. By understanding the common causes of JsonReaderException, you can enhance your Firebase integration in VB.NET and ensure smoother data streaming experiences. Love Text Hubs
Exception when using Firebase streaming
Yusuf-3141
45
Reputation points
Hi,
When I try to read data from Firebase using FirebaseDatabase.net Library I receive Newtonsoft.Json.JsonReaderException exeption
this code works
Imports Firebase.Database
Imports Firebase.Database.Query
Public Class Form1
Private Async Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim client As New FirebaseClient("https://abcd.asia-southeast1.firebasedatabase.app/")
Dim gesture = Await client _
.Child("gestures") _
.Child("last_gesture") _
.OnceSingleAsync(Of String)()
If gesture IsNot Nothing Then
Label1.Text = gesture
Else
Label1.Text = "..."
End If
Console.WriteLine(gesture)
End Sub
End Class
but this code does not work when using streaming
Imports Firebase.Database
Imports Firebase.Database.Query
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim client As New FirebaseClient("https://abcd.asia-southeast1.firebasedatabase.app/")
client.Child("gestures").Child("last_gesture").AsObservable(Of String)() _
.Subscribe(Sub(f)
Console.WriteLine(f.Object)
If f.Object IsNot Nothing Then
Label1.Invoke(Sub() Label1.Text = f.Object)
End If
End Sub)
End Sub
End Class
How can I solve this issue
Thank you in advance
2 answers
Sort by: Most helpful
-
-
Yusuf-3141 45 Reputation points
2024-10-20T23:35:24.6+00:00 I think the issue not in firebase itself because i can read / write to it without problem the issue only hapen when try receive data using streaming i have reach this advanced stage of project and here is the project on Github
https://github.com/devenv2/WinFormsApp1/tree/master