| | 1 | | // Copyright (c) Microsoft. All rights reserved. |
| | 2 | | // Licensed under the MIT license. See LICENSE file in the project root for full license information. |
| | 3 | |
|
| | 4 | | namespace Microsoft.Azure.ServiceBus.Primitives |
| | 5 | | { |
| | 6 | | using System; |
| | 7 | | using System.Threading.Tasks; |
| | 8 | |
|
| | 9 | | static class TaskExtensionHelper |
| | 10 | | { |
| | 11 | | public static void Schedule(Func<Task> func) |
| | 12 | | { |
| 16 | 13 | | _ = ScheduleInternal(func); |
| 16 | 14 | | } |
| | 15 | |
|
| | 16 | | static async Task ScheduleInternal(Func<Task> func) |
| | 17 | | { |
| | 18 | | try |
| | 19 | | { |
| 16 | 20 | | await func().ConfigureAwait(false); |
| 16 | 21 | | } |
| 0 | 22 | | catch (Exception ex) |
| | 23 | | { |
| 0 | 24 | | MessagingEventSource.Log.ScheduleTaskFailed(func, ex); |
| 0 | 25 | | } |
| 16 | 26 | | } |
| | 27 | |
|
| | 28 | | } |
| | 29 | | } |