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.

Failing syntax highlighting when using `await foreach`

See original GitHub issue

Environment 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: Screenshot 2020-03-14 at 10 07 15

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

5reactions
doodlefolkscommented, Apr 29, 2020

Any idea when this will make it into release?

1reaction
JoeRobichcommented, Mar 17, 2020

This issue will be resolved once the semantic token api is introduced in the release build.

Read more comments on GitHub >

github_iconTop 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 >

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