Failing syntax highlighting when using `await foreach`
See original GitHub issueEnvironment data
C# Extension version: ms-dotnettools.csharp: version 1.21.14
Steps to reproduce
The syntax highlighting is broken for await foreach
usage.
Basically all code after the await foreach
declaration becomes broken
eg this snippet
public class Foo {
public override async Task waitTask(Brick.Grpc.StringMsg task, IServerStreamWriter<Bamse.Grpc.Any_Task_TaskEvent> streamWriter, ServerCallContext context) {
var stream = Bamse.Session.Default.Hub.waitTask(task);
await foreach (var e in stream.ResponseStream.ReadAllAsync()) {
await streamWriter.WriteAsync(e);
}
}
public override async Task<Brick.Grpc.Void> revokeTask(Brick.Grpc.StringMsg task, ServerCallContext context) {
return await Bamse.Session.Default.Hub.revokeTaskAsync(task);
}
}
Screenshot for reference:
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Async/await in foreach not waiting [duplicate] - Stack Overflow
Basically, this is what happens inside forEach : Array.prototype.forEach = function (callback) { for (let index = 0; index < this.length; ...
Read more >Avoid await in Foreach - Gigi Labs - Daniel D'Agostino
Whenever I see an await within a foreach (or other looping construct) ... Imagine that DoSomethingAsync() in the above code performs an HTTP ......
Read more >forEach is BAD! for Async Await Code - YouTube
Attempting to use Async / Await with forEach is a bad idea. In this advance async / await Javascript tutorial, I'll show you...
Read more >Solved: Why Async/Await does not work with .forEach
It turns out that the array.forEach method only accepts a synchronous function, and therefore is NOT compatible with the async/await syntax.
Read more >Problem using Parallel.ForEachAsync - Microsoft Q&A
MaxDegreeOfParallelism = 10; Await Parallel.ForEachAsync(links, options,; Async Sub(t); count += 1; 'AppendText(TextBox2, $"Processing index ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Any idea when this will make it into release?
This issue will be resolved once the semantic token api is introduced in the release build.