Skip to content

v3.0.0

Compare
Choose a tag to compare
@RoryDungan RoryDungan released this 15 Feb 06:36
· 30 commits to master since this release
078f3c9

New features

  • Finally method is consistent with JS Promise.prototype.finally(). If a promise is rejected somewhere in the chain before the finally, it can still be caught by a Catch block chained after the Finally. Finally also does not take any arguments or return a value. Previous functionality of the Finally method is still availble with the ContinueWith method. Credits to @theJenix.
  • Promises now support reporting progress using the ReportProgress function and handling progress using the onProgress callback of Then or the Progress function (thanks @alonso-ARG and @ryden)
  • Signed assembly with a strong name. Now you can use the official package from Nuget as a dependency if you also want to sign your assemblies.
  • Invalid operations on promises now throw custom exceptions rather than ApplicationException.

Fixes

  • Fixed issue where calling Then on a non-generic promise with an onRejected handler wouldn't handle the rejection (hander would get called but result promise would still be rejected).
  • Fixed bug where Promise.All<T1, T2> would throw an exception if both promises rejected.
  • Fixed bug where Promise.All for non-generic promise would throw an exception if a promise passed into it rejected.

Breaking changes

  • Previously, Finally would also act as an onResolved handler, meaning that exceptions thrown earlier in the chain would not be passed to a handler after the Finally function. Now that the functionality has been modified to be consistent with JavaScript promises, this is no longer the case. To ensure the same functionality with legacy code, you should use the new ContinueWith function instead, which does exactly the same thing as the old version of Finally did.
  • New exception types do not inherit from ApplicationException, so any code specifically handling ApplicationException type exceptions will no longer handle execptions thrown by promises. Promises now throw a PromiseStateException if an action is done when a promise is in an invalid state (e.g. rejecting a promise that has already resolved). Promise.Race throws an InvalidOperationException if it is called with an empty IEnumerable.