Announcement

Collapse
No announcement yet.

[CLOSED] [#2502] [16.0] error in async function

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    [CLOSED] [#2502] [16.0] error in async function

    Hello,

    - following constellation don't working correct:

    async function: async Task<int> ...
    while ()
    {
    for ()
    {
    break; ----- > this break leave the 'while' loop
    }
    Switch()
    {
    case ...:
    break; --- > the same problem !
    }
    await .....
    }
    -> the Bridge JS-Code:

    case 2: {
    if ( p < 10 ) {
    $step = 3;
    continue;
    }
    $step = 5;
    continue;
    }
    case 3: {
    for (i = 0; i < 10; i = (i + 1) | 0) {
    if (i > 5) {
    $step = 5;
    continue;
    }
    }
    
    $task1 = bridgeClass.App.pTaskWork("");
    $step = 4;
    $task1.continueWith($asyncBody);
    return;
    }
    case 4: {
    $taskResult1 = $task1.getAwaitedResult();
    v = $taskResult1;
    
    p = (p + 1) | 0;
    
    $step = 2;
    continue;
    }
    case 5: {
    Bye,
    Erwin Csunderlik
    Last edited by Leonid; 2017-03-27 @ 07:10 PM.

    #2
    Hello,

    Please share a Deck.NET sample demonstrating how to reproduce.

    Comment


      #3
      I reproduce the Problem in Deck.Net with following ittle example:

      public class Program
      {
          public static void Main()
          {
              var msg = "Hello, World!";
      
              Console.WriteLine(msg);
      
              new Task(async () =>
              {
              await PTaskWork("");
      
              }).Start();
          }
      
          static async Task PTaskWork(string ParStr)
          {
              int i = 0;
              int y = 0;
      
              while (i < 10)
              {
                  Console.WriteLine("Before for");
      
                  for (y = 0; y < 10; y++)
                  {
                      if (y > 5)
                      break; // -> don't work ('for' loop must leave if y > 5)
                  }
      
                  Console.WriteLine("y: " + y);
      
                  switch (y)
                  {
                      default:
                      if (y > 5)
                      {
                          Console.WriteLine("y2 ->: " + y);
                      }
                      break; // --> leave 'while' loop
                  }
      
                  Console.WriteLine("Before await");
      
                  await Task.Delay(50);
                  i++;
              }
          }
      }
      Last edited by Leonid; 2017-03-27 @ 07:22 PM.

      Comment


        #4
        Hi erwin – Click the Share button at the top of the page on your Deck.NET sample and post the link in this thread.
        Last edited by geoffrey.mcgill; 2017-03-28 @ 12:19 AM.

        Comment


          #5
          https://deck.net/d784911ef77fe1e3628dcc085317325f

          Comment


            #6
            Thanks for the Deck sample, erwin.

            We were able to reproduce the problem and openeda GitHub Issue #2502 to track this defect.
            And a fix for the issue merged into master branch and will be included in the next Bridge.NET release.

            When posting samples, it's also nice to wrap code snippets by [CODE] tags.


            Comment


              #7
              This thread was also moved to the Bugs forum.

              Comment

              Working...
              X