{"action":"created","issue":{"url":"https://api.github.com/repos/Starcounter/Starcounter/issues/3210","labels_url":"https://api.github.com/repos/Starcounter/Starcounter/issues/3210/labels{/name}","comments_url":"https://api.github.com/repos/Starcounter/Starcounter/issues/3210/comments","events_url":"https://api.github.com/repos/Starcounter/Starcounter/issues/3210/events","html_url":"https://github.com/Starcounter/Starcounter/issues/3210","id":123262075,"number":3210,"title":"Code after await gets ignored","user":{"login":"warpech","id":566463,"avatar_url":"https://avatars.githubusercontent.com/u/566463?v=3","gravatar_id":"","url":"https://api.github.com/users/warpech","html_url":"https://github.com/warpech","followers_url":"https://api.github.com/users/warpech/followers","following_url":"https://api.github.com/users/warpech/following{/other_user}","gists_url":"https://api.github.com/users/warpech/gists{/gist_id}","starred_url":"https://api.github.com/users/warpech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/warpech/subscriptions","organizations_url":"https://api.github.com/users/warpech/orgs","repos_url":"https://api.github.com/users/warpech/repos","events_url":"https://api.github.com/users/warpech/events{/privacy}","received_events_url":"https://api.github.com/users/warpech/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-12-21T11:42:53Z","updated_at":"2015-12-23T00:44:55Z","closed_at":null,"body":"I want to play with a very simple own project during the holidays. I use a [3rdparty library](https://github.com/octokit/octokit.net) that wraps a REST API in an asynchronous C# interface (lots of `async`/`await`).\r\n\r\nHere comes a problem. For some reason, any code after `await` gets ignored by Starcounter. **It is executed, but does not have any effect in Starcounter APIs**:\r\n\r\n- `Console.WriteLine` does not write to the console in Administrator. \r\n- `Db.Transact` does not execute the transaction (inner breakpoint is never reached).\r\n\r\nI have tested a super simple `async`/`await` scenario and it worked, so it must be something specific that Octokit.net is doing, but I can't figure it out. Any ideas?\r\n\r\nThe whole project is here: https://github.com/warpech/GitHubImporter/blob/master/Program.cs. It should be fully reproducible by just building and running it.\r\n\r\n![image](https://cloud.githubusercontent.com/assets/566463/11930112/f785eee2-a7e0-11e5-8320-07a4753f2e1c.png)\r\n\r\n![image](https://cloud.githubusercontent.com/assets/566463/11930034/4531b712-a7e0-11e5-9466-a94218888b6e.png)"},"comment":{"url":"https://api.github.com/repos/Starcounter/Starcounter/issues/comments/166769497","html_url":"https://github.com/Starcounter/Starcounter/issues/3210#issuecomment-166769497","issue_url":"https://api.github.com/repos/Starcounter/Starcounter/issues/3210","id":166769497,"user":{"login":"warpech","id":566463,"avatar_url":"https://avatars.githubusercontent.com/u/566463?v=3","gravatar_id":"","url":"https://api.github.com/users/warpech","html_url":"https://github.com/warpech","followers_url":"https://api.github.com/users/warpech/followers","following_url":"https://api.github.com/users/warpech/following{/other_user}","gists_url":"https://api.github.com/users/warpech/gists{/gist_id}","starred_url":"https://api.github.com/users/warpech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/warpech/subscriptions","organizations_url":"https://api.github.com/users/warpech/orgs","repos_url":"https://api.github.com/users/warpech/repos","events_url":"https://api.github.com/users/warpech/events{/privacy}","received_events_url":"https://api.github.com/users/warpech/received_events","type":"User","site_admin":false},"created_at":"2015-12-23T00:44:54Z","updated_at":"2015-12-23T00:44:54Z","body":"Thanks for the suggestions. Thanks @bigwad & @mtornwall for your code snippets. \r\n\r\nI combined your techniques in  https://github.com/warpech/GitHubImporter/commit/d32c47df3a20848da764b05db6eb35ff2f69b91b the following way:\r\n\r\n- I use `StarcounterEnvironment.RunWithinApplication` as proposed by @bigwad, so that I get console output in Administrator\r\n- I use `RunAsync` as proposed by @mtornwall\r\n- My block is wrapped in `try`/`catch` and that part works as well (testable when you change the word \"warpech\" to \"warpechxxx\" in the source file)\r\n\r\nSide question: When I have a choice in my await callback, should I choose to wrap my callback in `RunAsync` or `RunSync`? I noticed that @bigwad uses `RunSync` and @mtornwall uses `RunAsync`."}}