-1

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?

Community
  • 1
  • 1
w0051977
  • 13,975
  • 26
  • 129
  • 295

1 Answers1

0

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
Stephen Cleary
  • 406,130
  • 70
  • 637
  • 767