tiagomtotti / firebaseNet

Client library for Firebase Cloud Messaging (FCM) written in C# / .NET
Apache License 2.0
96 stars 30 forks source link

An unhandled exception of type 'System.NullReferenceException' occurred in mscorlib.dll #5

Open kaganbzkrt opened 7 years ago

kaganbzkrt commented 7 years ago

Throw Exception when :

await client.SendMessageAsync(message);

System.NullReferenceException was unhandled Message: An unhandled exception of type 'System.NullReferenceException' occurred in mscorlib.dll Additional information:

but notification was sended succesfully

:

tiagomtotti commented 7 years ago

Hi, can you please provide the code you're using to send the nofitications ?

shawndube commented 7 years ago

Happening to me also. Not sure i this helps:

private static async Task<IFCMResponse> SendFCMMessage(string deviceId, Dictionary<string, string> data)
        {
            FCMClient client = new FCMClient("...snip");

            var message = new Message()
            {
                To = deviceId,
                Priority = MessagePriority.high,
                TimeToLive = 30,
                Data = data
            };

            return await client.SendMessageAsync(message);

        }  
shawndube commented 7 years ago

Actually, my current NPE is in: Exception thrown: 'System.NullReferenceException' in System.Web.dll but i've seen it say mscorelib also.