diff --git a/sdk/core/Azure.Core/api/Azure.Core.net461.cs b/sdk/core/Azure.Core/api/Azure.Core.net461.cs index 053e05af4245..0bf81881caa9 100644 --- a/sdk/core/Azure.Core/api/Azure.Core.net461.cs +++ b/sdk/core/Azure.Core/api/Azure.Core.net461.cs @@ -188,9 +188,9 @@ protected Response() { } } public partial class SyncAsyncEventArgs : System.EventArgs { - public SyncAsyncEventArgs(bool runSynchronously, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { } + public SyncAsyncEventArgs(bool isRunningSynchronously, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { } public System.Threading.CancellationToken CancellationToken { get { throw null; } } - public bool RunSynchronously { get { throw null; } } + public bool IsRunningSynchronously { get { throw null; } } } } namespace Azure.Core diff --git a/sdk/core/Azure.Core/api/Azure.Core.net5.0.cs b/sdk/core/Azure.Core/api/Azure.Core.net5.0.cs index d12ef3a649da..fba323ec63ae 100644 --- a/sdk/core/Azure.Core/api/Azure.Core.net5.0.cs +++ b/sdk/core/Azure.Core/api/Azure.Core.net5.0.cs @@ -188,9 +188,9 @@ protected Response() { } } public partial class SyncAsyncEventArgs : System.EventArgs { - public SyncAsyncEventArgs(bool runSynchronously, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { } + public SyncAsyncEventArgs(bool isRunningSynchronously, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { } public System.Threading.CancellationToken CancellationToken { get { throw null; } } - public bool RunSynchronously { get { throw null; } } + public bool IsRunningSynchronously { get { throw null; } } } } namespace Azure.Core diff --git a/sdk/core/Azure.Core/api/Azure.Core.netstandard2.0.cs b/sdk/core/Azure.Core/api/Azure.Core.netstandard2.0.cs index 053e05af4245..0bf81881caa9 100644 --- a/sdk/core/Azure.Core/api/Azure.Core.netstandard2.0.cs +++ b/sdk/core/Azure.Core/api/Azure.Core.netstandard2.0.cs @@ -188,9 +188,9 @@ protected Response() { } } public partial class SyncAsyncEventArgs : System.EventArgs { - public SyncAsyncEventArgs(bool runSynchronously, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { } + public SyncAsyncEventArgs(bool isRunningSynchronously, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { } public System.Threading.CancellationToken CancellationToken { get { throw null; } } - public bool RunSynchronously { get { throw null; } } + public bool IsRunningSynchronously { get { throw null; } } } } namespace Azure.Core diff --git a/sdk/core/Azure.Core/samples/Events.md b/sdk/core/Azure.Core/samples/Events.md index 76b020e8354f..97007b5f80ae 100644 --- a/sdk/core/Azure.Core/samples/Events.md +++ b/sdk/core/Azure.Core/samples/Events.md @@ -25,7 +25,7 @@ that contain important information for writing your event handler. `new CancellationTokenSource(TimeSpan.FromSeconds(10)).Token`, for example) will correctly propagate. -- There is a `SyncAsyncEventArgs.RunSynchronously` flag indicating whether your +- There is a `SyncAsyncEventArgs.IsRunningSynchronously` flag indicating whether your handler was invoked synchronously or asynchronously. In general, - If you're calling sync methods on your client, you should use sync methods @@ -33,12 +33,12 @@ that contain important information for writing your event handler. - If you're calling async methods on your client, you should use async methods where possible to implement your event handler. - If you're not in control of how the client will be used or want to write - safer code, you should check the `RunSynchronously` property and call + safer code, you should check the `IsRunningSynchronously` property and call either sync or async methods as directed. There are code examples of all three situations below to compare. Please also see the note at the very end discussing the dangers of sync-over-async to - understand the risks of not using the `RunSynchronously` flag. + understand the risks of not using the `IsRunningSynchronously` flag. - Most events will customize the event data by deriving from `SyncAsyncEventArgs` and including details about what triggered the event or providing options to @@ -125,7 +125,7 @@ write an async handler but raise it from a sync method, the handler will be doing sync-over-async and may cause ThreadPool starvation. See the note at the bottom for more details. -You should use the `SyncAsyncEventArgs.RunSynchronously` property to check how +You should use the `SyncAsyncEventArgs.IsRunningSynchronously` property to check how the event is being raised and implement your handler accordingly. Here's an example handler that's safe to invoke from both sync and async code paths. @@ -133,7 +133,7 @@ example handler that's safe to invoke from both sync and async code paths. var client = new AlarmClient(); client.Ring += async (SyncAsyncEventArgs e) => { - if (e.RunSynchronously) + if (e.IsRunningSynchronously) { Console.WriteLine("Wake up!"); } @@ -180,7 +180,7 @@ sync-over-async because you're getting sync behavior but still invoking all the async machinery. See [Diagnosing .NET Core ThreadPool Starvation with PerfView](https://docs.microsoft.com/archive/blogs/vancem/diagnosing-net-core-threadpool-starvation-with-perfview-why-my-service-is-not-saturating-all-cores-or-seems-to-stall) for a detailed explanation of how that can cause serious performance problems. -We recommend you use the `SyncAsyncEventArgs.RunSynchronously` flag to avoid +We recommend you use the `SyncAsyncEventArgs.IsRunningSynchronously` flag to avoid ThreadPool starvation. But what about executing synchronous code on an async code path like the "Adding diff --git a/sdk/core/Azure.Core/src/SyncAsyncEventArgs.cs b/sdk/core/Azure.Core/src/SyncAsyncEventArgs.cs index 8b8c5a9bd03f..707a32350494 100644 --- a/sdk/core/Azure.Core/src/SyncAsyncEventArgs.cs +++ b/sdk/core/Azure.Core/src/SyncAsyncEventArgs.cs @@ -31,7 +31,7 @@ public class SyncAsyncEventArgs : EventArgs /// and serious performance problems. /// /// - /// You can use this property to check + /// You can use this property to check /// how the event is being raised and implement your handler /// accordingly. Here's an example handler that's safe to invoke from /// both sync and async code paths. @@ -39,7 +39,7 @@ public class SyncAsyncEventArgs : EventArgs /// var client = new AlarmClient(); /// client.Ring += async (SyncAsyncEventArgs e) => /// { - /// if (e.RunSynchronously) + /// if (e.IsRunningSynchronously) /// { /// Console.WriteLine("Wake up!"); /// } @@ -54,7 +54,7 @@ public class SyncAsyncEventArgs : EventArgs /// /// /// - public bool RunSynchronously { get; } + public bool IsRunningSynchronously { get; } /// /// Gets a cancellation token related to the original operation that @@ -72,7 +72,7 @@ public class SyncAsyncEventArgs : EventArgs /// Initializes a new instance of the /// class. /// - /// + /// /// A value indicating whether the event handler was invoked /// synchronously or asynchronously. Please see /// for more details. @@ -84,10 +84,10 @@ public class SyncAsyncEventArgs : EventArgs /// that take a token so cancellation will correctly propagate. The /// default value is . /// - public SyncAsyncEventArgs(bool runSynchronously, CancellationToken cancellationToken = default) + public SyncAsyncEventArgs(bool isRunningSynchronously, CancellationToken cancellationToken = default) : base() { - RunSynchronously = runSynchronously; + IsRunningSynchronously = isRunningSynchronously; CancellationToken = cancellationToken; } } diff --git a/sdk/core/Azure.Core/src/SyncAsyncEventHandler.cs b/sdk/core/Azure.Core/src/SyncAsyncEventHandler.cs index 0de375d646b2..36c18cdf4e07 100644 --- a/sdk/core/Azure.Core/src/SyncAsyncEventHandler.cs +++ b/sdk/core/Azure.Core/src/SyncAsyncEventHandler.cs @@ -74,7 +74,7 @@ namespace Azure.Core /// on a client. If you write an async handler but raise it from a sync /// method, the handler will be doing sync-over-async and may cause /// ThreadPool starvation. See the note in Remarks for more details. You - /// should use the + /// should use the /// property to check how the event is being raised and implement your /// handler accordingly. Here's an example handler that's safe to invoke /// from both sync and async code paths. @@ -82,7 +82,7 @@ namespace Azure.Core /// var client = new AlarmClient(); /// client.Ring += async (SyncAsyncEventArgs e) => /// { - /// if (e.RunSynchronously) + /// if (e.IsRunningSynchronously) /// { /// Console.WriteLine("Wake up!"); /// } @@ -158,7 +158,7 @@ namespace Azure.Core /// /// /// - /// is a flag indicating + /// is a flag indicating /// whether your handler was invoked synchronously or asynchronously. If /// you're calling sync methods on your client, you should use sync methods /// to implement your event handler (you can return @@ -166,7 +166,7 @@ namespace Azure.Core /// your client, you should use async methods where possible to implement /// your event handler. If you're not in control of how the client will be /// used or want to write safer code, you should check the - /// property and call + /// property and call /// either sync or async methods as directed. /// /// @@ -214,7 +214,7 @@ namespace Azure.Core /// Diagnosing.NET Core ThreadPool Starvation with PerfView /// for a detailed explanation of how that can cause serious performance /// problems. We recommend you use the - /// flag to avoid + /// flag to avoid /// ThreadPool starvation. /// /// diff --git a/sdk/core/Azure.Core/tests/SyncAsyncEventHandlerTests.cs b/sdk/core/Azure.Core/tests/SyncAsyncEventHandlerTests.cs index 8ff367fc494a..3250da4babc8 100644 --- a/sdk/core/Azure.Core/tests/SyncAsyncEventHandlerTests.cs +++ b/sdk/core/Azure.Core/tests/SyncAsyncEventHandlerTests.cs @@ -28,8 +28,8 @@ public class TestSyncAsyncEventArgs : SyncAsyncEventArgs { public TestClient Client { get; } public int Result { get; } - public TestSyncAsyncEventArgs(TestClient client, int result, bool runSynchronously, CancellationToken cancellationToken = default) - : base(runSynchronously, cancellationToken) + public TestSyncAsyncEventArgs(TestClient client, int result, bool isRunningSynchronously, CancellationToken cancellationToken = default) + : base(isRunningSynchronously, cancellationToken) { Client = client; Result = result; @@ -46,17 +46,17 @@ public TestClient() : this(null) { } public virtual event SyncAsyncEventHandler Working; public virtual event SyncAsyncEventHandler WorkCompleted; - protected virtual async Task OnWorkingAsync(bool runSynchronously, CancellationToken cancellationToken) => + protected virtual async Task OnWorkingAsync(bool isRunningSynchronously, CancellationToken cancellationToken) => await Working.RaiseAsync( - new SyncAsyncEventArgs(runSynchronously, cancellationToken), + new SyncAsyncEventArgs(isRunningSynchronously, cancellationToken), nameof(TestClient), nameof(Working), ClientDiagnostics) .ConfigureAwait(false); - protected virtual async Task OnWorkCompletedAsync(int result, bool runSynchronously, CancellationToken cancellationToken) => + protected virtual async Task OnWorkCompletedAsync(int result, bool isRunningSynchronously, CancellationToken cancellationToken) => await WorkCompleted.RaiseAsync( - new TestSyncAsyncEventArgs(this, result, runSynchronously, cancellationToken), + new TestSyncAsyncEventArgs(this, result, isRunningSynchronously, cancellationToken), nameof(TestClient), nameof(Working), ClientDiagnostics) @@ -121,7 +121,7 @@ public async Task Handle(T e) if (Delay != null) { - if (e.RunSynchronously) + if (e.IsRunningSynchronously) { e.CancellationToken.WaitHandle.WaitOne(Delay.Value); } @@ -134,7 +134,7 @@ public async Task Handle(T e) Func callback = Callback; if (callback != null) { - await callback(e.RunSynchronously, e.CancellationToken); + await callback(e.IsRunningSynchronously, e.CancellationToken); } if (Throws != null) @@ -453,7 +453,7 @@ public async Task SequentialProcessing() { text.Append(before); TimeSpan delay = TimeSpan.FromMilliseconds(50); - if (e.RunSynchronously) + if (e.IsRunningSynchronously) { e.CancellationToken.WaitHandle.WaitOne(delay); } diff --git a/sdk/core/Azure.Core/tests/samples/EventSamples.cs b/sdk/core/Azure.Core/tests/samples/EventSamples.cs index f9c6b3b011e5..4bed1e1802a4 100644 --- a/sdk/core/Azure.Core/tests/samples/EventSamples.cs +++ b/sdk/core/Azure.Core/tests/samples/EventSamples.cs @@ -25,11 +25,11 @@ public void Snooze(CancellationToken cancellationToken = default) => public async Task SnoozeAsync(CancellationToken cancellationToken = default) => await SnoozeInternal(false, cancellationToken).ConfigureAwait(false); - protected virtual async Task SnoozeInternal(bool runSynchronously, CancellationToken cancellationToken) + protected virtual async Task SnoozeInternal(bool isRunningSynchronously, CancellationToken cancellationToken) { // Why does snoozing an alarm always wait 9 minutes? TimeSpan delay = TimeSpan.FromMilliseconds(900); - if (runSynchronously) + if (isRunningSynchronously) { cancellationToken.WaitHandle.WaitOne(delay); } @@ -37,7 +37,7 @@ protected virtual async Task SnoozeInternal(bool runSynchronously, CancellationT { await Task.Delay(delay, cancellationToken).ConfigureAwait(false); } - SyncAsyncEventArgs e = new SyncAsyncEventArgs(runSynchronously, cancellationToken); + SyncAsyncEventArgs e = new SyncAsyncEventArgs(isRunningSynchronously, cancellationToken); await Ring.RaiseAsync(e, nameof(AlarmClient), nameof(Ring), _clientDiagnostics).ConfigureAwait(false); } } @@ -77,7 +77,7 @@ public async Task CombinedHandler() var client = new AlarmClient(); client.Ring += async (SyncAsyncEventArgs e) => { - if (e.RunSynchronously) + if (e.IsRunningSynchronously) { Console.WriteLine("Wake up!"); } diff --git a/sdk/search/Azure.Search.Documents/api/Azure.Search.Documents.netstandard2.0.cs b/sdk/search/Azure.Search.Documents/api/Azure.Search.Documents.netstandard2.0.cs index 18ea5c43db0c..c5a2d505b30e 100644 --- a/sdk/search/Azure.Search.Documents/api/Azure.Search.Documents.netstandard2.0.cs +++ b/sdk/search/Azure.Search.Documents/api/Azure.Search.Documents.netstandard2.0.cs @@ -2199,18 +2199,18 @@ public enum FacetType } public partial class IndexActionCompletedEventArgs : Azure.Search.Documents.Models.IndexActionEventArgs { - public IndexActionCompletedEventArgs(Azure.Search.Documents.SearchIndexingBufferedSender sender, Azure.Search.Documents.Models.IndexDocumentsAction action, Azure.Search.Documents.Models.IndexingResult result, bool runSynchronously, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) : base (default(Azure.Search.Documents.SearchIndexingBufferedSender), default(Azure.Search.Documents.Models.IndexDocumentsAction), default(bool), default(System.Threading.CancellationToken)) { } + public IndexActionCompletedEventArgs(Azure.Search.Documents.SearchIndexingBufferedSender sender, Azure.Search.Documents.Models.IndexDocumentsAction action, Azure.Search.Documents.Models.IndexingResult result, bool isRunningSynchronously, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) : base (default(Azure.Search.Documents.SearchIndexingBufferedSender), default(Azure.Search.Documents.Models.IndexDocumentsAction), default(bool), default(System.Threading.CancellationToken)) { } public Azure.Search.Documents.Models.IndexingResult Result { get { throw null; } } } public partial class IndexActionEventArgs : Azure.SyncAsyncEventArgs { - public IndexActionEventArgs(Azure.Search.Documents.SearchIndexingBufferedSender sender, Azure.Search.Documents.Models.IndexDocumentsAction action, bool runSynchronously, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) : base (default(bool), default(System.Threading.CancellationToken)) { } + public IndexActionEventArgs(Azure.Search.Documents.SearchIndexingBufferedSender sender, Azure.Search.Documents.Models.IndexDocumentsAction action, bool isRunningSynchronously, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) : base (default(bool), default(System.Threading.CancellationToken)) { } public Azure.Search.Documents.Models.IndexDocumentsAction Action { get { throw null; } } public Azure.Search.Documents.SearchIndexingBufferedSender Sender { get { throw null; } } } public partial class IndexActionFailedEventArgs : Azure.Search.Documents.Models.IndexActionEventArgs { - public IndexActionFailedEventArgs(Azure.Search.Documents.SearchIndexingBufferedSender sender, Azure.Search.Documents.Models.IndexDocumentsAction action, Azure.Search.Documents.Models.IndexingResult result, System.Exception exception, bool runSynchronously, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) : base (default(Azure.Search.Documents.SearchIndexingBufferedSender), default(Azure.Search.Documents.Models.IndexDocumentsAction), default(bool), default(System.Threading.CancellationToken)) { } + public IndexActionFailedEventArgs(Azure.Search.Documents.SearchIndexingBufferedSender sender, Azure.Search.Documents.Models.IndexDocumentsAction action, Azure.Search.Documents.Models.IndexingResult result, System.Exception exception, bool isRunningSynchronously, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) : base (default(Azure.Search.Documents.SearchIndexingBufferedSender), default(Azure.Search.Documents.Models.IndexDocumentsAction), default(bool), default(System.Threading.CancellationToken)) { } public System.Exception Exception { get { throw null; } } public Azure.Search.Documents.Models.IndexingResult Result { get { throw null; } } } diff --git a/sdk/search/Azure.Search.Documents/src/Batching/IndexActionCompletedEventArgs.cs b/sdk/search/Azure.Search.Documents/src/Batching/IndexActionCompletedEventArgs.cs index 0cf9b1271e6f..095b7e83ded0 100644 --- a/sdk/search/Azure.Search.Documents/src/Batching/IndexActionCompletedEventArgs.cs +++ b/sdk/search/Azure.Search.Documents/src/Batching/IndexActionCompletedEventArgs.cs @@ -37,7 +37,7 @@ public class IndexActionCompletedEventArgs : IndexActionEventArgs /// The of an action that was successfully /// completed. /// - /// + /// /// A value indicating whether the event handler was invoked /// synchronously or asynchronously. Please see /// for more details. @@ -57,9 +57,9 @@ public IndexActionCompletedEventArgs( SearchIndexingBufferedSender sender, IndexDocumentsAction action, IndexingResult result, - bool runSynchronously, + bool isRunningSynchronously, CancellationToken cancellationToken = default) - : base(sender, action, runSynchronously, cancellationToken) + : base(sender, action, isRunningSynchronously, cancellationToken) { Argument.AssertNotNull(result, nameof(result)); Result = result; diff --git a/sdk/search/Azure.Search.Documents/src/Batching/IndexActionEventArgs.cs b/sdk/search/Azure.Search.Documents/src/Batching/IndexActionEventArgs.cs index ba61fdb21d4d..da1ac17d8e0f 100644 --- a/sdk/search/Azure.Search.Documents/src/Batching/IndexActionEventArgs.cs +++ b/sdk/search/Azure.Search.Documents/src/Batching/IndexActionEventArgs.cs @@ -40,7 +40,7 @@ public class IndexActionEventArgs : SyncAsyncEventArgs /// The that was added, sent, /// completed, or failed. /// - /// + /// /// A value indicating whether the event handler was invoked /// synchronously or asynchronously. Please see /// for more details. @@ -59,9 +59,9 @@ public class IndexActionEventArgs : SyncAsyncEventArgs public IndexActionEventArgs( SearchIndexingBufferedSender sender, IndexDocumentsAction action, - bool runSynchronously, + bool isRunningSynchronously, CancellationToken cancellationToken = default) - : base(runSynchronously, cancellationToken) + : base(isRunningSynchronously, cancellationToken) { Argument.AssertNotNull(sender, nameof(sender)); Argument.AssertNotNull(action, nameof(action)); diff --git a/sdk/search/Azure.Search.Documents/src/Batching/IndexActionFailedEventArgs.cs b/sdk/search/Azure.Search.Documents/src/Batching/IndexActionFailedEventArgs.cs index b55f9d2da6bf..1ba27d721b2d 100644 --- a/sdk/search/Azure.Search.Documents/src/Batching/IndexActionFailedEventArgs.cs +++ b/sdk/search/Azure.Search.Documents/src/Batching/IndexActionFailedEventArgs.cs @@ -47,7 +47,7 @@ public class IndexActionFailedEventArgs : IndexActionEventArgs /// the caused by an action that failed to /// complete. /// - /// + /// /// A value indicating whether the event handler was invoked /// synchronously or asynchronously. Please see /// for more details. @@ -68,9 +68,9 @@ public IndexActionFailedEventArgs( IndexDocumentsAction action, IndexingResult result, Exception exception, - bool runSynchronously, + bool isRunningSynchronously, CancellationToken cancellationToken = default) - : base(sender, action, runSynchronously, cancellationToken) + : base(sender, action, isRunningSynchronously, cancellationToken) { // Do not validate - either might be null Result = result; diff --git a/sdk/search/Azure.Search.Documents/src/Batching/SearchIndexingBufferedSender.cs b/sdk/search/Azure.Search.Documents/src/Batching/SearchIndexingBufferedSender.cs index 5b72c89f10c0..36851bb0bce8 100644 --- a/sdk/search/Azure.Search.Documents/src/Batching/SearchIndexingBufferedSender.cs +++ b/sdk/search/Azure.Search.Documents/src/Batching/SearchIndexingBufferedSender.cs @@ -340,7 +340,7 @@ await ActionAdded.RaiseAsync( new IndexActionEventArgs( this, action, - runSynchronously: false, + isRunningSynchronously: false, cancellationToken), nameof(SearchIndexingBufferedSender), nameof(ActionAdded), @@ -372,7 +372,7 @@ await ActionSent.RaiseAsync( new IndexActionEventArgs( this, action, - runSynchronously: false, + isRunningSynchronously: false, cancellationToken), nameof(SearchIndexingBufferedSender), nameof(ActionSent), @@ -407,7 +407,7 @@ await ActionCompleted.RaiseAsync( this, action, result, - runSynchronously: false, + isRunningSynchronously: false, cancellationToken), nameof(SearchIndexingBufferedSender), nameof(ActionCompleted), @@ -445,7 +445,7 @@ await ActionFailed.RaiseAsync( action, result, exception, - runSynchronously: false, + isRunningSynchronously: false, cancellationToken), nameof(SearchIndexingBufferedSender), nameof(ActionFailed), diff --git a/sdk/storage/Azure.Storage.Queues/api/Azure.Storage.Queues.netstandard2.0.cs b/sdk/storage/Azure.Storage.Queues/api/Azure.Storage.Queues.netstandard2.0.cs index 6d353b3cd3e3..e1ae3bc1e18d 100644 --- a/sdk/storage/Azure.Storage.Queues/api/Azure.Storage.Queues.netstandard2.0.cs +++ b/sdk/storage/Azure.Storage.Queues/api/Azure.Storage.Queues.netstandard2.0.cs @@ -37,7 +37,7 @@ public QueueClient(System.Uri queueUri, Azure.Storage.StorageSharedKeyCredential protected internal virtual Azure.Storage.Queues.QueueServiceClient GetParentQueueServiceClientCore() { throw null; } public virtual Azure.Response GetProperties(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetPropertiesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - protected virtual System.Threading.Tasks.Task OnMessageDecodingFailedAsync(Azure.Storage.Queues.Models.QueueMessage receivedMessage, Azure.Storage.Queues.Models.PeekedMessage peekedMessage, bool runSynchronously, System.Threading.CancellationToken cancellationToken) { throw null; } + protected virtual System.Threading.Tasks.Task OnMessageDecodingFailedAsync(Azure.Storage.Queues.Models.QueueMessage receivedMessage, Azure.Storage.Queues.Models.PeekedMessage peekedMessage, bool isRunningSynchronously, System.Threading.CancellationToken cancellationToken) { throw null; } public virtual Azure.Response PeekMessage(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> PeekMessageAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response PeekMessages(int? maxMessages = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -87,7 +87,7 @@ public enum ServiceVersion } public partial class QueueMessageDecodingFailedEventArgs : Azure.SyncAsyncEventArgs { - public QueueMessageDecodingFailedEventArgs(Azure.Storage.Queues.QueueClient queueClient, Azure.Storage.Queues.Models.QueueMessage receivedMessage, Azure.Storage.Queues.Models.PeekedMessage peekedMessage, bool runSynchronously, System.Threading.CancellationToken cancellationToken) : base (default(bool), default(System.Threading.CancellationToken)) { } + public QueueMessageDecodingFailedEventArgs(Azure.Storage.Queues.QueueClient queueClient, Azure.Storage.Queues.Models.QueueMessage receivedMessage, Azure.Storage.Queues.Models.PeekedMessage peekedMessage, bool isRunningSynchronously, System.Threading.CancellationToken cancellationToken) : base (default(bool), default(System.Threading.CancellationToken)) { } public Azure.Storage.Queues.Models.PeekedMessage PeekedMessage { get { throw null; } } public Azure.Storage.Queues.QueueClient Queue { get { throw null; } } public Azure.Storage.Queues.Models.QueueMessage ReceivedMessage { get { throw null; } } diff --git a/sdk/storage/Azure.Storage.Queues/samples/Sample03_MessageEncoding.cs b/sdk/storage/Azure.Storage.Queues/samples/Sample03_MessageEncoding.cs index 98140a6164b3..92b2288634ac 100644 --- a/sdk/storage/Azure.Storage.Queues/samples/Sample03_MessageEncoding.cs +++ b/sdk/storage/Azure.Storage.Queues/samples/Sample03_MessageEncoding.cs @@ -47,7 +47,7 @@ public void MessageDecodingFailedHandlerAsync() { Console.WriteLine($"Invalid message has been received, message id={args.ReceivedMessage.MessageId} body={args.ReceivedMessage.Body}"); - if (args.RunSynchronously) + if (args.IsRunningSynchronously) { args.Queue.DeleteMessage(args.ReceivedMessage.MessageId, args.ReceivedMessage.PopReceipt); } diff --git a/sdk/storage/Azure.Storage.Queues/src/QueueClient.cs b/sdk/storage/Azure.Storage.Queues/src/QueueClient.cs index 0c9d197609b1..634527a43c99 100644 --- a/sdk/storage/Azure.Storage.Queues/src/QueueClient.cs +++ b/sdk/storage/Azure.Storage.Queues/src/QueueClient.cs @@ -3172,19 +3172,19 @@ private void AssertEncodingForEncryption() /// /// The with raw body, if present. /// The with raw body, if present. - /// A value indicating whether the event handler was invoked + /// A value indicating whether the event handler was invoked /// synchronously or asynchronously. /// Cancellation token. /// protected virtual async Task OnMessageDecodingFailedAsync(QueueMessage receivedMessage, PeekedMessage peekedMessage, - bool runSynchronously, CancellationToken cancellationToken) + bool isRunningSynchronously, CancellationToken cancellationToken) { await ClientConfiguration.QueueMessageDecodingFailedHandlers.RaiseAsync( new QueueMessageDecodingFailedEventArgs( queueClient: this, receivedMessage: receivedMessage, peekedMessage: peekedMessage, - runSynchronously: runSynchronously, + isRunningSynchronously: isRunningSynchronously, cancellationToken: cancellationToken), nameof(QueueClientOptions), nameof(QueueClientOptions.MessageDecodingFailed), diff --git a/sdk/storage/Azure.Storage.Queues/src/QueueClientOptions.cs b/sdk/storage/Azure.Storage.Queues/src/QueueClientOptions.cs index 042d205d4126..a08ef116073a 100644 --- a/sdk/storage/Azure.Storage.Queues/src/QueueClientOptions.cs +++ b/sdk/storage/Azure.Storage.Queues/src/QueueClientOptions.cs @@ -151,7 +151,7 @@ public QueueClientOptions(ServiceVersion version = LatestVersion) /// { /// Console.WriteLine($"Invalid message has been received, message id={args.ReceivedMessage.MessageId} body={args.ReceivedMessage.Body}"); /// - /// if (args.RunSynchronously) + /// if (args.IsRunningSynchronously) /// { /// args.Queue.DeleteMessage(args.ReceivedMessage.MessageId, args.ReceivedMessage.PopReceipt); /// } diff --git a/sdk/storage/Azure.Storage.Queues/src/QueueMessageDecodingFailedEventArgs.cs b/sdk/storage/Azure.Storage.Queues/src/QueueMessageDecodingFailedEventArgs.cs index a48179fb47a2..c3f26052e704 100644 --- a/sdk/storage/Azure.Storage.Queues/src/QueueMessageDecodingFailedEventArgs.cs +++ b/sdk/storage/Azure.Storage.Queues/src/QueueMessageDecodingFailedEventArgs.cs @@ -36,7 +36,7 @@ public class QueueMessageDecodingFailedEventArgs : SyncAsyncEventArgs /// The that has received invalid message. /// The received message. /// The peeked message. - /// + /// /// A value indicating whether the event handler was invoked /// synchronously or asynchronously. Please see /// for more details. @@ -55,9 +55,9 @@ public QueueMessageDecodingFailedEventArgs( QueueClient queueClient, QueueMessage receivedMessage, PeekedMessage peekedMessage, - bool runSynchronously, + bool isRunningSynchronously, CancellationToken cancellationToken) - : base(runSynchronously, cancellationToken) + : base(isRunningSynchronously, cancellationToken) { Argument.AssertNotNull(queueClient, nameof(queueClient)); Queue = queueClient; diff --git a/sdk/storage/Microsoft.Azure.WebJobs.Extensions.Storage.Queues/src/QueueServiceClientProvider.cs b/sdk/storage/Microsoft.Azure.WebJobs.Extensions.Storage.Queues/src/QueueServiceClientProvider.cs index 0ecb97a14961..c89c899977f8 100644 --- a/sdk/storage/Microsoft.Azure.WebJobs.Extensions.Storage.Queues/src/QueueServiceClientProvider.cs +++ b/sdk/storage/Microsoft.Azure.WebJobs.Extensions.Storage.Queues/src/QueueServiceClientProvider.cs @@ -71,7 +71,7 @@ private SyncAsyncEventHandler CreateMessage { return async (QueueMessageDecodingFailedEventArgs args) => { - // This event is raised only in async paths hence args.RunSynchronously is ignored. + // This event is raised only in async paths hence args.IsRunningSynchronously is ignored. if (args.ReceivedMessage != null) { var queueClient = args.Queue;