question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unexpected 'await' at top of other suggestions

See original GitHub issue

Environment data

dotnet --info output:

.NET SDK (reflecting any global.json):
 Version:   5.0.405     
 Commit:    63325e1c7d  
Runtime Environment:    
 OS Name:     Windows   
 OS Version:  10.0.19044
 OS Platform: Windows   
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\5.0.405\
Host (useful for support):
  Version: 5.0.14
  Commit:  d5b56c6327
.NET SDKs installed:
  3.1.416 [C:\Program Files\dotnet\sdk]
  5.0.303 [C:\Program Files\dotnet\sdk]
  5.0.402 [C:\Program Files\dotnet\sdk]
  5.0.405 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
  Microsoft.AspNetCore.App 3.1.20 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.22 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.14 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.1.20 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.22 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.14 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.1.20 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 3.1.22 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.11 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.14 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

VS Code version: 1.65.0 C# Extension version: v1.24.1

Steps to reproduce

  1. When C# Extension is enabled, open a C# code and try to index an array with, let’s say, i
  2. Trigger suggestions (either automatically or manually by the key binding)

Expected behavior

Since it’s the simplest possible suggestion, i should be the first

Actual behavior

There’s this weird await keyword suggestions that appears first. This happened on different circumstances, not just when indexing arrays; but this one was the one I could reproduce. image Note that it’s not a snippet suggestion, cuz the snippet setting (put snippets at the bottom, after other suggestions) is not fixing this.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:11
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

6reactions
leebailey88commented, Mar 17, 2022

Yes, this is a very frustrating issue. Makes writing a simple for loop difficult as the i gets auto-replaced to await constantly. Even worse, it also adds async in front of the function

2reactions
scriptweldercommented, Mar 7, 2022

I’m experiencing the same issue - reverting to 1.24.0 helps for now

Read more comments on GitHub >

github_iconTop Results From Across the Web

'await Unexpected identifier' on Node.js 7.5 - Stack Overflow
You can use await only inside of async function s. – Bergi. Feb 14, 2017 at 11:56. 2.
Read more >
How to Fix the "Unexpected reserved word (await)" Error in ...
The “unexpected reserved word (await)” error occurs in JavaScript when you use the await keyword in a function that is not specified as ......
Read more >
async function expression - JavaScript - MDN Web Docs
The async function keywords can be used to define an async function inside an expression.
Read more >
Asynchronous programming: futures, async, await - Dart
This codelab teaches you how to write asynchronous code using futures and the async and await keywords. Using embedded DartPad editors, you can...
Read more >
javascript - await does not wait for Promise to finish
@SachinHooda await operator can only be used inside an async function, failing this would throw a runtime error as "Can not use keyword...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found