Issue of IkbmMWScheduledEvent.WaitRun

Home Forums kbmMW Issue of IkbmMWScheduledEvent.WaitRun

Viewing 2 reply threads
  • Author
    Posts
    • #54784
      TomYU
      Participant

      hi kim

      Run the following code, the ev.WaitRun method will enter an infinite loop.

      procedure Tform1.Button1Click(Sender: TObject);
      var
      ev:IkbmMWScheduledEvent;
      begin
      ev:=Scheduler.Run(procedure(const AEvent:IkbmMWScheduledEvent)
      begin
      raise Exception.Create(‘Error Message’);
      end)
      .WhenException(procedure (const AEvent:IkbmMWScheduledEvent; const AException:Exception)
      begin
      //
      end)
      .Precise.Activate;
      try
      //
      finally
      ev.WaitRun; // Wait forever
      end;
      ShowMessage(‘Scheduled Event is finish!’); //Can’t execute here

      end;

      kbmMW version:kbmMW 5.11

    • #54785
      TomYU
      Participant

      This problem affects the TkbmMWBindings.Update method.
      The TkbmMWBindings.Update method will enter an infinite loop when the UpdateNonSync method generates an exception.

    • #54812
      kimbomadsen
      Keymaster

      Hi,
      I have not specifically looked into this, but I think it could have to do with “afterrun” is not executed when an exception has been raised.

      The next version will contain a statement .IgnoreExceptions which will ensure afterrun is run even if an exception is thrown. Any exception handlers will also run.

Viewing 2 reply threads
  • You must be logged in to reply to this topic.