Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
182 views
in Technique[技术] by (71.8m points)

vb.net - Bootstrapper class not found in Nito.AsyncEx

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

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

1 Reply

0 votes
by (71.8m points)

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...