Error with VB.NET

2 posts, 0 answers
  1. HSLaw
    HSLaw avatar
    153 posts
    Member since:
    Jan 2006

    Posted 22 Sep 2014 Link to this post


    var notification = new PushNotification();
                var androidNotificationPayload = new Dictionary<string, object>()
                            new Dictionary<string, object>()
                                { "title", "title for android" },
                                { "message", "message for android" },
                                { "customData", "custom for android"},
                notification.Android = new Telerik.Everlive.Sdk.Core.Model.System.Push.Android.AndroidNotification();
                foreach (KeyValuePair<string, object> pair in androidNotificationPayload)
                    notification.Android.SetValue(pair.Key, pair.Value);
                var settings = new EverliveAppSettings()
                    ApiKey = "removed",
                    UseHttps = false
                var app = new EverliveApp(settings);
                var result = app.WorkWith().Push().Notifications().Create(notification).ExecuteSync();

    After convert the code above into VB.NET with Telerik's Code Converter, I get this error:

    How should I modify it?


  2. Anton Dobrev
    Anton Dobrev avatar
    529 posts

    Posted 22 Sep 2014 Link to this post


    Here is the correct VB code:
    Imports Telerik.Everlive.Sdk.Core.Model.System.Push
    Imports Telerik.Everlive.Sdk.Core
    Module Module1
        Sub Main()
            Dim notification = New PushNotification()
            Dim androidNotificationPayload = New Dictionary(Of String, Object)() From { _
                {"data", New Dictionary(Of String, Object)() From { _
                    {"title", "title for android"}, _
                    {"message", "message for android"}, _
                    {"customData", "custom for android"} _
                }} _
            notification.Android = New Telerik.Everlive.Sdk.Core.Model.System.Push.Android.AndroidNotification()
            For Each pair As KeyValuePair(Of String, Object) In androidNotificationPayload
                notification.Android.SetValue(pair.Key, pair.Value)
            Dim settings = New EverliveAppSettings() With { _
                .ApiKey = "removed", _
                .UseHttps = False _
            Dim app = New EverliveApp(settings)
            Dim result = app.WorkWith().Push().Notifications().Create(notification).ExecuteSync()
            'Service provided by Telerik (
            'Conversion powered by NRefactory.
            'Twitter: @telerik
        End Sub
    End Module

    Seems that the converter prefixed the ApiKey and UseHttps properties with a 'Key'. Removing it corrected the error.

    Let me know if you have further questions.

    Anton Dobrev
    Everlive is now Telerik Backend Services, and is part of the Telerik Platform.
Back to Top