{"action":"opened","issue":{"url":"https://api.github.com/repos/Redth/PushSharp/issues/614","repository_url":"https://api.github.com/repos/Redth/PushSharp","labels_url":"https://api.github.com/repos/Redth/PushSharp/issues/614/labels{/name}","comments_url":"https://api.github.com/repos/Redth/PushSharp/issues/614/comments","events_url":"https://api.github.com/repos/Redth/PushSharp/issues/614/events","html_url":"https://github.com/Redth/PushSharp/issues/614","id":132187874,"number":614,"title":"NullReferenceException in dev 3.0 latest code","user":{"login":"jjxtra","id":1271832,"avatar_url":"https://avatars.githubusercontent.com/u/1271832?v=3","gravatar_id":"","url":"https://api.github.com/users/jjxtra","html_url":"https://github.com/jjxtra","followers_url":"https://api.github.com/users/jjxtra/followers","following_url":"https://api.github.com/users/jjxtra/following{/other_user}","gists_url":"https://api.github.com/users/jjxtra/gists{/gist_id}","starred_url":"https://api.github.com/users/jjxtra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jjxtra/subscriptions","organizations_url":"https://api.github.com/users/jjxtra/orgs","repos_url":"https://api.github.com/users/jjxtra/repos","events_url":"https://api.github.com/users/jjxtra/events{/privacy}","received_events_url":"https://api.github.com/users/jjxtra/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-02-08T16:25:26Z","updated_at":"2016-02-08T16:25:26Z","closed_at":null,"body":"When queuing thousands of notifications, I get a null reference exception randomly in a background thread.\r\n\r\n```\r\n        public void SendiOS(string appName, string token, string message)\r\n        {\r\n            object obj;\r\n            if (appNamesAndServiceBrokers.TryGetValue(appName, out obj))\r\n            {\r\n                message = Newtonsoft.Json.JsonConvert.ToString(message);\r\n                JObject payload = JObject.Parse(\"{\\\"aps\\\":{\\\"alert\\\":\" + message + \"}}\");\r\n\r\n                // Logger.Log(\"APNS Payload: \" + payload.ToString());\r\n\r\n                ApnsNotification notification = new ApnsNotification(token, payload);\r\n                ServiceBroker<ApnsNotification> b = obj as ServiceBroker<ApnsNotification>;\r\n                b?.QueueNotification(notification);\r\n            }\r\n        }\r\n```"}}