Skip to content

Releases: Real-Serious-Games/C-Sharp-Promise

v3.0.1

14 Nov 00:02
Compare
Choose a tag to compare

New features

  • Default build now includes .NET Standard 2.0 support. This is included in the Nuget package in addition to the existing .NET Framework 3.5 DLLs, and allows the library to be used in .NET Core, UWP and Unity .NET Standard projects.
  • Promise.Sequence can now report progress (thanks @alonsohki)

Fixes

  • Stopped progress from being reported on an already resolved or rejected promise in a Race (thanks @sindrijo)
  • Stopped Promise.All reporting progress if the promise has already rejected (thanks @alonsohki)
  • Improved examples and documentation (thanks @KonH and @vanillajonathan)

v3.0.0

15 Feb 06:36
078f3c9
Compare
Choose a tag to compare

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.

v2.0.0

04 Dec 04:34
8ae468f
Compare
Choose a tag to compare

New features

  • Exception handling has been modified to be more consistent to the A+ standard (thanks to @Nepoxx for finding the issue and @philippevk for helping suggest a solution)
    • .Then after a .Catch now runs after the exception has been handled, similar to Finally
    • Promise rejection handlers can now return a value in the same way as a resolved handler
  • PromiseTimer: TimeData struct now contains a property with the number of elapsed updates as well as the time that has elapsed.

Fixes

  • Exceptions that have already been handled no longer also get sent to the unhandled exception handler when used with .Done()

Breaking changes

  • Due to the way exception handling works now, some instances where a .Then would have been canceled by an exception being throw will now run regardless. The examples have been updated to reflect this.
  • One overload of Promise.Then has been removed and replaced with a similar version.
    • IPromise<ConvertedT>(Func<PromisedT, IPromise<ConvertedT>> onResolved, Func<Exception, IPromise<ConvertedT> onRejected) replaces a version of the same method that took an Action<Exception for the onResolved handler. This is because, now that onRejected handlers can return values, we can't have a function that may or may not return a promise with a value.
  • Transform has been removed. Since v1.2 Then works in the same way so use that instead.

v1.3.0

27 Oct 01:44
Compare
Choose a tag to compare

New features

  • Added Cancel method to PromiseTimer (thanks @PhilippCh)
  • Implemented an overload of Promise.All that works with Tuples of multiple types. Also added a custom Tuple implementation in order to maintain compatibility with .NET 3.5
  • Implemented Finally method (thanks @nloewen)
  • Removed dependency on RSG.Toolkit

Fixes

  • Removed all code that depended on reflection APIs that aren't supported by Unity IL2CPP on console platforms (PS4)
  • Corrected version of the Xunit test runner that was broken in Visual Studio 2017