Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

Please see the answer to the following question: Can't specify the 'async' modifier on the 'Main' method of a console app

I am trying to do this with a VB.NET program. I have added the package using NUGET and I have ensured that the Reference is added. Please see the code below:

Imports Nito.AsyncEx

Public Class ScheduledTasks
    Private Shared Async Sub MainAsync(args As String())
        Dim bs As New Bootstrapper()
        Dim list As VariantType = Await bs.GetList()
    End Sub
End Class

The error is: Type BootStrapper is not found. I have used Intellisense to look at the types contained in Nito.AsyncEx and Bootstapper is not there? How do I create an asynchronous main method using VB.NET?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
179 views
Welcome To Ask or Share your Answers For Others

1 Answer

Bootstrapper is not a part of AsyncEx. AsyncContext is:

Imports Nito.AsyncEx

Public Class Program
    Private Shared Sub Main(args As String())
        AsyncContext.Run(Function() MainAsync(args))
    End Sub
    Private Shared Function MainAsync(args As String()) As Task
        ...
    End Function
End Class

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...