Skip to content

Commit 22190c7

Browse files
authored
(AzureCXP) fixes sample
resolves MicrosoftDocs/azure-docs#47976
1 parent 34654ec commit 22190c7

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

articles/service-bus-messaging/service-bus-dotnet-get-started-with-queues.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ To receive the messages you sent, create another **Console App (.NET Core)** app
200200
1. In *Program.cs*, add the following `using` statements at the top of the namespace definition, before the class declaration:
201201

202202
```csharp
203+
using System;
203204
using System.Text;
204205
using System.Threading;
205206
using System.Threading.Tasks;
@@ -216,18 +217,23 @@ To receive the messages you sent, create another **Console App (.NET Core)** app
216217

217218
Enter your connection string for the namespace as the `ServiceBusConnectionString` variable. Enter your queue name.
218219

219-
1. Replace the default contents of `Main()` with the following line of code:
220+
1. Replace the `Main()` method with the following code:
220221

221222
```csharp
222-
public static async Task Main(string[] args)
223-
{
223+
static void Main(string[] args)
224+
{
225+
MainAsync().GetAwaiter().GetResult();
226+
}
227+
228+
static async Task MainAsync()
229+
{
224230
queueClient = new QueueClient(ServiceBusConnectionString, QueueName);
225231

226232
Console.WriteLine("======================================================");
227233
Console.WriteLine("Press ENTER key to exit after receiving all the messages.");
228234
Console.WriteLine("======================================================");
229235

230-
// Register the queue message handler and receive messages in a loop
236+
// Register QueueClient's MessageHandler and receive messages in a loop
231237
RegisterOnMessageHandlerAndReceiveMessages();
232238

233239
Console.ReadKey();

0 commit comments

Comments
 (0)