ExceptionServices.Default.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. // Licensed to the .NET Foundation under one or more agreements.
  2. // The .NET Foundation licenses this file to you under the Apache 2.0 License.
  3. // See the LICENSE file in the project root for more information.
  4. #if HAS_EDI
  5. namespace System.Reactive.PlatformServices
  6. {
  7. //
  8. // WARNING: This code is kept *identically* in two places. One copy is kept in System.Reactive.Core for non-PLIB platforms.
  9. // Another copy is kept in System.Reactive.PlatformServices to enlighten the default lowest common denominator
  10. // behavior of Rx for PLIB when used on a more capable platform.
  11. //
  12. internal class DefaultExceptionServices/*Impl*/ : IExceptionServices
  13. {
  14. public void Rethrow(Exception exception)
  15. {
  16. System.Runtime.ExceptionServices.ExceptionDispatchInfo.Capture(exception).Throw();
  17. }
  18. }
  19. }
  20. #else
  21. namespace System.Reactive.PlatformServices
  22. {
  23. internal class DefaultExceptionServices : IExceptionServices
  24. {
  25. public void Rethrow(Exception exception)
  26. {
  27. throw exception;
  28. }
  29. }
  30. }
  31. #endif