Friday 15 June 2012

c# - await works but calling task.Result hangs/deadlocks -


The four tests to me and when I run it would have been the last to hang, my question is why is is: assign

  [Test] public void Chekonareslttest () {. ISTRU (checkstats (results); } [Test] Public Assign Blank Checkon Avat Test () {Assign. Wait for iStru (checkstats); } [Test] Public Assim Blank CheckStat TVViewTest () {Assign. Wait for the ISTRU (checkstats);); Confirm. Is true (wait for checkstats);); } [Test] Public Asset blank checkstatus resultTest () {Assign. ISTRU (checkstats (results); // This conviction is hanging. Waiting for the truth (Prticshasthl (wait ());} private async Task & lt; bool & gt; Chekstat () {var restClient = new REST client (@ "https://api.test.nordnet.se/next/1 "); Task & LT; IRestResponse & LT; DummyServiceStatus & gt; & gt; RestResponse = restClient.ExecuteTaskAsync & lt; DummyServiceStatus & gt; (new RestRequest (Method.GET)); IRestResponse & LT; DummyServiceStatus & gt; response = the rest await Respens; return response. data. Systems running;}   

I use this extension method to:

  Public Restricted Class RestClientExt {Public stable work   < Pre>  public class DummyServiceStatus {public string message {get; Set; } Public Hair Validation {Receiving; Set; } Public Hair Systemlinging {get; Set; } Skip to Public Bull SkipPhrase {Go; Set; } Public long timestamps {receive; Set; }}   

Why the last exam hangs?

You are running in standard deadlock state that I say and: async The method is trying to continue a column which is being blocked by the call on results .

In this situation, your Synchronization Contex is used by NUITIT to execute async zero test methods. I try to use the async task test methods instead.

No comments:

Post a Comment