{"action":"opened","issue":{"url":"https://api.github.com/repos/akkadotnet/akka.net/issues/1292","labels_url":"https://api.github.com/repos/akkadotnet/akka.net/issues/1292/labels{/name}","comments_url":"https://api.github.com/repos/akkadotnet/akka.net/issues/1292/comments","events_url":"https://api.github.com/repos/akkadotnet/akka.net/issues/1292/events","html_url":"https://github.com/akkadotnet/akka.net/issues/1292","id":104867780,"number":1292,"title":"Unable to use await while message processing","user":{"login":"alexkool","id":13397077,"avatar_url":"https://avatars.githubusercontent.com/u/13397077?v=3","gravatar_id":"","url":"https://api.github.com/users/alexkool","html_url":"https://github.com/alexkool","followers_url":"https://api.github.com/users/alexkool/followers","following_url":"https://api.github.com/users/alexkool/following{/other_user}","gists_url":"https://api.github.com/users/alexkool/gists{/gist_id}","starred_url":"https://api.github.com/users/alexkool/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexkool/subscriptions","organizations_url":"https://api.github.com/users/alexkool/orgs","repos_url":"https://api.github.com/users/alexkool/repos","events_url":"https://api.github.com/users/alexkool/events{/privacy}","received_events_url":"https://api.github.com/users/alexkool/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-09-04T10:44:11Z","updated_at":"2015-09-04T10:44:11Z","closed_at":null,"body":"Scheme:\r\n`System -> MasterActor -> ChildrenActors.`\r\n\r\nWe pass `MsgReqBalance` message `MaserActor` in foreach loop we trying to `Ask<MsgRespBalance>(new MsgReqBalance())` all children and get blanace from all children. If we try to use `awat` we will fall while getting `Context` in `MasterActor`\r\n\r\nso. This code raise an error `There is no active ActorContext, this is most likely due to use of async operations from within this actor.`:\r\n```\r\n    public async void Handle(MsgReqBalance message)\r\n        {\r\n            List<BalanceEntry> entries = new List<BalanceEntry>();\r\n            foreach (var clientActor in Context.GetChildren())\r\n            {\r\n                var resp = await clientActor.Ask<MsgRespBalance>(new MsgReqBalance(), ActSys.OperationTimeout);\r\n                entries.Add(resp.BalanceEntry);\r\n            }\r\n            Context.Sender.Tell(new MsgRespComplexBalance() // << here we fall\r\n            {\r\n                BalanceEntries = entries\r\n            });\r\n        }\r\n```\r\n\r\nbut this code works fine:\r\n```\r\n    ConcurrentBag<BalanceEntry> entries = new ConcurrentBag<BalanceEntry>();\r\n    var actions = Context.GetChildren().Select(actor => new Action(() =>\r\n    {\r\n        var task = actor.Ask<MsgRespBalance>(new MsgReqBalance(), ActSys.OperationTimeout);\r\n        task.Wait();\r\n        entries.Add(task.Result.BalanceEntry);\r\n    }));\r\n    Parallel.Invoke(actions.ToArray());\r\n    Context.Sender.Tell(new MsgRespComplexBalance()\r\n    {\r\n        BalanceEntries = entries.ToList()\r\n    });\r\n```\r\nThe goal is using `Parallel.Invoke`. It blocks the execution but code works!\r\n\r\nPlease explain why this is so."}}