Throw when receiver is passed in TimeSpan.Zero for server timeout (#296)

#294
This commit is contained in:
Sean Feldman 2017-09-08 18:23:31 -06:00 коммит произвёл Neeraj Makam
Родитель 6af10c6587
Коммит e650ac4c4e
6 изменённых файлов: 150 добавлений и 101 удалений

Просмотреть файл

@ -283,6 +283,11 @@ namespace Microsoft.Azure.ServiceBus.Core
{
this.ThrowIfClosed();
if (operationTimeout <= TimeSpan.Zero)
{
throw Fx.Exception.ArgumentOutOfRange(nameof(operationTimeout), operationTimeout, Resources.TimeoutMustBePositiveNonZero.FormatForUser(nameof(operationTimeout), operationTimeout));
}
MessagingEventSource.Log.MessageReceiveStart(this.ClientId, maxMessageCount);
IList<Message> unprocessedMessageList = null;
@ -320,7 +325,7 @@ namespace Microsoft.Azure.ServiceBus.Core
/// <seealso cref="DeferAsync"/>
public async Task<Message> ReceiveDeferredMessageAsync(long sequenceNumber)
{
IList<Message> messages = await this.ReceiveDeferredMessageAsync(new long[] { sequenceNumber }).ConfigureAwait(false);
IList<Message> messages = await this.ReceiveDeferredMessageAsync(new[] { sequenceNumber }).ConfigureAwait(false);
if (messages != null && messages.Count > 0)
{
return messages[0];
@ -665,7 +670,7 @@ namespace Microsoft.Azure.ServiceBus.Core
{
throw new ArgumentNullException(nameof(serviceBusPlugin), Resources.ArgumentNullOrWhiteSpace.FormatForUser(nameof(serviceBusPlugin)));
}
else if (this.RegisteredPlugins.Any(p => p.Name == serviceBusPlugin.Name))
if (this.RegisteredPlugins.Any(p => p.Name == serviceBusPlugin.Name))
{
throw new ArgumentException(nameof(serviceBusPlugin), Resources.PluginAlreadyRegistered.FormatForUser(nameof(serviceBusPlugin)));
}
@ -700,8 +705,7 @@ namespace Microsoft.Azure.ServiceBus.Core
ReceivingAmqpLink receivingAmqpLink = await this.ReceiveLinkManager.GetOrCreateAsync(timeoutHelper.RemainingTime()).ConfigureAwait(false);
Source source = (Source)receivingAmqpLink.Settings.Source;
string tempSessionId;
if (!source.FilterSet.TryGetValue(AmqpClientConstants.SessionFilterName, out tempSessionId))
if (!source.FilterSet.TryGetValue<string>(AmqpClientConstants.SessionFilterName, out var tempSessionId))
{
receivingAmqpLink.Session.SafeClose();
throw new ServiceBusException(true, Resources.SessionFilterMissing);
@ -715,8 +719,9 @@ namespace Microsoft.Azure.ServiceBus.Core
receivingAmqpLink.Closed += this.OnSessionReceiverLinkClosed;
this.SessionIdInternal = tempSessionId;
long lockedUntilUtcTicks;
this.LockedUntilUtcInternal = receivingAmqpLink.Settings.Properties.TryGetValue(AmqpClientConstants.LockedUntilUtc, out lockedUntilUtcTicks) ? new DateTime(lockedUntilUtcTicks, DateTimeKind.Utc) : DateTime.MinValue;
this.LockedUntilUtcInternal = receivingAmqpLink.Settings.Properties.TryGetValue<long>(AmqpClientConstants.LockedUntilUtc, out var lockedUntilUtcTicks)
? new DateTime(lockedUntilUtcTicks, DateTimeKind.Utc)
: DateTime.MinValue;
}
internal async Task<AmqpResponseMessage> ExecuteRequestResponseAsync(AmqpRequestMessage amqpRequestMessage)
@ -728,8 +733,7 @@ namespace Microsoft.Azure.ServiceBus.Core
}
TimeoutHelper timeoutHelper = new TimeoutHelper(this.OperationTimeout, true);
RequestResponseAmqpLink requestResponseAmqpLink = null;
if (!this.RequestResponseLinkManager.TryGetOpenedObject(out requestResponseAmqpLink))
if (!this.RequestResponseLinkManager.TryGetOpenedObject(out var requestResponseAmqpLink))
{
MessagingEventSource.Log.CreatingNewLink(this.ClientId, this.isSessionReceiver, this.SessionIdInternal, true, this.LinkException);
requestResponseAmqpLink = await this.RequestResponseLinkManager.GetOrCreateAsync(timeoutHelper.RemainingTime()).ConfigureAwait(false);
@ -893,15 +897,14 @@ namespace Microsoft.Azure.ServiceBus.Core
return messages;
}
else if (response.StatusCode == AmqpResponseStatusCode.NoContent ||
(response.StatusCode == AmqpResponseStatusCode.NotFound && Equals(AmqpClientConstants.MessageNotFoundError, response.GetResponseErrorCondition())))
if (response.StatusCode == AmqpResponseStatusCode.NoContent ||
(response.StatusCode == AmqpResponseStatusCode.NotFound && Equals(AmqpClientConstants.MessageNotFoundError, response.GetResponseErrorCondition())))
{
return messages;
}
else
{
throw response.ToMessagingContractException();
}
throw response.ToMessagingContractException();
}
catch (Exception exception)
{
@ -976,7 +979,7 @@ namespace Microsoft.Azure.ServiceBus.Core
protected virtual async Task OnAbandonAsync(string lockToken)
{
IEnumerable<Guid> lockTokens = new[] { new Guid(lockToken) };
if (lockTokens.Any((lt) => this.requestResponseLockedMessages.Contains(lt)))
if (lockTokens.Any(lt => this.requestResponseLockedMessages.Contains(lt)))
{
await this.DisposeMessageRequestResponseAsync(lockTokens, DispositionStatus.Abandoned).ConfigureAwait(false);
}
@ -992,7 +995,7 @@ namespace Microsoft.Azure.ServiceBus.Core
protected virtual async Task OnDeferAsync(string lockToken)
{
IEnumerable<Guid> lockTokens = new[] { new Guid(lockToken) };
if (lockTokens.Any((lt) => this.requestResponseLockedMessages.Contains(lt)))
if (lockTokens.Any(lt => this.requestResponseLockedMessages.Contains(lt)))
{
await this.DisposeMessageRequestResponseAsync(lockTokens, DispositionStatus.Defered).ConfigureAwait(false);
}
@ -1008,7 +1011,7 @@ namespace Microsoft.Azure.ServiceBus.Core
protected virtual async Task OnDeadLetterAsync(string lockToken)
{
IEnumerable<Guid> lockTokens = new[] { new Guid(lockToken) };
if (lockTokens.Any((lt) => this.requestResponseLockedMessages.Contains(lt)))
if (lockTokens.Any(lt => this.requestResponseLockedMessages.Contains(lt)))
{
await this.DisposeMessageRequestResponseAsync(lockTokens, DispositionStatus.Suspended).ConfigureAwait(false);
}
@ -1205,10 +1208,8 @@ namespace Microsoft.Azure.ServiceBus.Core
{
throw new SessionLockLostException(Resources.SessionLockExpiredOnMessageSession);
}
else
{
throw new MessageLockLostException(Resources.MessageLockLost);
}
throw new MessageLockLostException(Resources.MessageLockLost);
}
throw error.ToMessagingContractException();
@ -1313,7 +1314,7 @@ namespace Microsoft.Azure.ServiceBus.Core
linkSettings.AddProperty(AmqpClientConstants.EntityTypeName, AmqpClientConstants.EntityTypeManagement);
Uri endPointAddress = new Uri(this.ServiceBusConnection.Endpoint, entityPath);
string[] claims = new[] { ClaimConstants.Manage, ClaimConstants.Listen };
string[] claims = { ClaimConstants.Manage, ClaimConstants.Listen };
AmqpRequestResponseLinkCreator requestResponseLinkCreator = new AmqpRequestResponseLinkCreator(entityPath, this.ServiceBusConnection, endPointAddress, claims, this.CbsTokenProvider, linkSettings, this.ClientId);
Tuple<AmqpObject, DateTime> linkDetails = await requestResponseLinkCreator.CreateAndOpenAmqpLinkAsync().ConfigureAwait(false);

Просмотреть файл

@ -59,4 +59,19 @@
<DotNetCliToolReference Include="dotnet-sourcelink-git" Version="2.1.2" />
</ItemGroup>
<ItemGroup>
<Compile Update="Resources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
</Project>

166
src/Microsoft.Azure.ServiceBus/Resources.Designer.cs сгенерированный
Просмотреть файл

@ -8,34 +8,35 @@
// </auto-generated>
//------------------------------------------------------------------------------
using System.Reflection;
namespace Microsoft.Azure.ServiceBus {
using System;
using System.Reflection;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
public class Resources {
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
public static global::System.Resources.ResourceManager ResourceManager {
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.Azure.ServiceBus.Resources", typeof(Resources).GetTypeInfo().Assembly);
@ -46,11 +47,11 @@ namespace Microsoft.Azure.ServiceBus {
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
public static global::System.Globalization.CultureInfo Culture {
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
@ -60,284 +61,291 @@ namespace Microsoft.Azure.ServiceBus {
}
/// <summary>
/// Looks up a localized string similar to No session-id was specified for a session receiver..
/// Looks up a localized string similar to No session-id was specified for a session receiver..
/// </summary>
public static string AmqpFieldSessionId {
internal static string AmqpFieldSessionId {
get {
return ResourceManager.GetString("AmqpFieldSessionId", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to The received message (delivery-id:{0}, size:{1} bytes) exceeds the limit ({2} bytes) currently allowed on the link..
/// Looks up a localized string similar to The received message (delivery-id:{0}, size:{1} bytes) exceeds the limit ({2} bytes) currently allowed on the link..
/// </summary>
public static string AmqpMessageSizeExceeded {
internal static string AmqpMessageSizeExceeded {
get {
return ResourceManager.GetString("AmqpMessageSizeExceeded", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to The value of the argument {0} must be positive..
/// Looks up a localized string similar to The value of the argument {0} must be positive..
/// </summary>
public static string ArgumentMustBePositive {
internal static string ArgumentMustBePositive {
get {
return ResourceManager.GetString("ArgumentMustBePositive", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to The argument {0} is null or white space..
/// Looks up a localized string similar to The argument {0} is null or white space..
/// </summary>
public static string ArgumentNullOrWhiteSpace {
internal static string ArgumentNullOrWhiteSpace {
get {
return ResourceManager.GetString("ArgumentNullOrWhiteSpace", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to The argument &apos;{0}&apos; cannot exceed {1} characters..
/// Looks up a localized string similar to The argument &apos;{0}&apos; cannot exceed {1} characters..
/// </summary>
public static string ArgumentStringTooBig {
internal static string ArgumentStringTooBig {
get {
return ResourceManager.GetString("ArgumentStringTooBig", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to There are no brokeredMessages supplied. Please make sure input messages are not empty..
/// Looks up a localized string similar to There are no brokeredMessages supplied. Please make sure input messages are not empty..
/// </summary>
public static string BrokeredMessageListIsNullOrEmpty {
internal static string BrokeredMessageListIsNullOrEmpty {
get {
return ResourceManager.GetString("BrokeredMessageListIsNullOrEmpty", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Sending empty {0} is not a valid operation..
/// Looks up a localized string similar to Sending empty {0} is not a valid operation..
/// </summary>
public static string CannotSendAnEmptyMessage {
internal static string CannotSendAnEmptyMessage {
get {
return ResourceManager.GetString("CannotSendAnEmptyMessage", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to &apos;{0}&apos; contains character &apos;{1}&apos; which is not allowed because it is reserved in the Uri scheme..
/// Looks up a localized string similar to &apos;{0}&apos; contains character &apos;{1}&apos; which is not allowed because it is reserved in the Uri scheme..
/// </summary>
public static string CharacterReservedForUriScheme {
internal static string CharacterReservedForUriScheme {
get {
return ResourceManager.GetString("CharacterReservedForUriScheme", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to This request has been blocked because the entity or namespace is being throttled. Please retry the operation, and if condition continues, please slow down your rate of request..
/// Looks up a localized string similar to This request has been blocked because the entity or namespace is being throttled. Please retry the operation, and if condition continues, please slow down your rate of request..
/// </summary>
public static string DefaultServerBusyException {
internal static string DefaultServerBusyException {
get {
return ResourceManager.GetString("DefaultServerBusyException", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to The entity path/name &apos;{0}&apos; exceeds the &apos;{1}&apos; character limit..
/// Looks up a localized string similar to The entity path/name &apos;{0}&apos; exceeds the &apos;{1}&apos; character limit..
/// </summary>
public static string EntityNameLengthExceedsLimit {
internal static string EntityNameLengthExceedsLimit {
get {
return ResourceManager.GetString("EntityNameLengthExceedsLimit", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to The minimum back off period &apos;{0}&apos; cannot exceed the maximum back off period of &apos;{1}&apos;..
/// Looks up a localized string similar to The minimum back off period &apos;{0}&apos; cannot exceed the maximum back off period of &apos;{1}&apos;..
/// </summary>
public static string ExponentialRetryBackoffRange {
internal static string ExponentialRetryBackoffRange {
get {
return ResourceManager.GetString("ExponentialRetryBackoffRange", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Serialization operation failed due to unsupported type {0}..
/// Looks up a localized string similar to Serialization operation failed due to unsupported type {0}..
/// </summary>
public static string FailedToSerializeUnsupportedType {
internal static string FailedToSerializeUnsupportedType {
get {
return ResourceManager.GetString("FailedToSerializeUnsupportedType", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to {0} is not a supported user property type..
/// Looks up a localized string similar to {0} is not a supported user property type..
/// </summary>
public static string InvalidAmqpMessageProperty {
internal static string InvalidAmqpMessageProperty {
get {
return ResourceManager.GetString("InvalidAmqpMessageProperty", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to The entity name or path contains an invalid character &apos;{0}&apos;. The supplied value is &apos;{1}&apos;..
/// Looks up a localized string similar to The entity name or path contains an invalid character &apos;{0}&apos;. The supplied value is &apos;{1}&apos;..
/// </summary>
public static string InvalidCharacterInEntityName {
internal static string InvalidCharacterInEntityName {
get {
return ResourceManager.GetString("InvalidCharacterInEntityName", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to The string has an invalid encoding format..
/// Looks up a localized string similar to The string has an invalid encoding format..
/// </summary>
public static string InvalidEncoding {
internal static string InvalidEncoding {
get {
return ResourceManager.GetString("InvalidEncoding", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to The specified value &apos;{0}&apos; is invalid. &quot;maxConcurrentCalls&quot; must be greater than zero..
/// Looks up a localized string similar to The specified value &apos;{0}&apos; is invalid. &quot;maxConcurrentCalls&quot; must be greater than zero..
/// </summary>
public static string MaxConcurrentCallsMustBeGreaterThanZero {
internal static string MaxConcurrentCallsMustBeGreaterThanZero {
get {
return ResourceManager.GetString("MaxConcurrentCallsMustBeGreaterThanZero", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to A message handler has already been registered..
/// Looks up a localized string similar to A message handler has already been registered..
/// </summary>
public static string MessageHandlerAlreadyRegistered {
internal static string MessageHandlerAlreadyRegistered {
get {
return ResourceManager.GetString("MessageHandlerAlreadyRegistered", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to The lock supplied is invalid. Either the lock expired, or the message has already been removed from the queue..
/// Looks up a localized string similar to The lock supplied is invalid. Either the lock expired, or the message has already been removed from the queue, or was received by a different receiver instance..
/// </summary>
public static string MessageLockLost {
internal static string MessageLockLost {
get {
return ResourceManager.GetString("MessageLockLost", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to &apos;{0}&apos; is not a supported type..
/// Looks up a localized string similar to &apos;{0}&apos; is not a supported type..
/// </summary>
public static string NotSupportedPropertyType {
internal static string NotSupportedPropertyType {
get {
return ResourceManager.GetString("NotSupportedPropertyType", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to This operation is only supported for a message receiver in &apos;PeekLock&apos; receive mode..
/// Looks up a localized string similar to This operation is only supported for a message receiver in &apos;PeekLock&apos; receive mode..
/// </summary>
public static string PeekLockModeRequired {
internal static string PeekLockModeRequired {
get {
return ResourceManager.GetString("PeekLockModeRequired", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to The {0} plugin has already been registered...
/// Looks up a localized string similar to The {0} plugin has already been registered..
/// </summary>
public static string PluginAlreadyRegistered {
internal static string PluginAlreadyRegistered {
get {
return ResourceManager.GetString("PluginAlreadyRegistered", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Provided rule filter {0} is not supported. Supported values are: {1}, {2}.
/// Looks up a localized string similar to Provided rule filter {0} is not supported. Supported values are: {1}, {2}.
/// </summary>
public static string RuleFilterNotSupported {
internal static string RuleFilterNotSupported {
get {
return ResourceManager.GetString("RuleFilterNotSupported", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Session filter is missing on the link.
/// Looks up a localized string similar to Session filter is missing on the link. .
/// </summary>
public static string SessionFilterMissing
{
get
{
internal static string SessionFilterMissing {
get {
return ResourceManager.GetString("SessionFilterMissing", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to A session handler has already been registered..
/// Looks up a localized string similar to A session handler has already been registered..
/// </summary>
public static string SessionHandlerAlreadyRegistered {
internal static string SessionHandlerAlreadyRegistered {
get {
return ResourceManager.GetString("SessionHandlerAlreadyRegistered", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to The session lock has expired on the MessageSession. Accept a new MessageSession..
/// Looks up a localized string similar to The session lock has expired on the MessageSession. Accept a new MessageSession..
/// </summary>
public static string SessionLockExpiredOnMessageSession {
internal static string SessionLockExpiredOnMessageSession {
get {
return ResourceManager.GetString("SessionLockExpiredOnMessageSession", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to The length of the filter action statement is {0}, which exceeds the maximum length of {1}..
/// Looks up a localized string similar to The length of the filter action statement is {0}, which exceeds the maximum length of {1}..
/// </summary>
public static string SqlFilterActionStatmentTooLong {
internal static string SqlFilterActionStatmentTooLong {
get {
return ResourceManager.GetString("SqlFilterActionStatmentTooLong", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to The length of the filter statement is {0}, which exceeds the maximum length of {1}.
/// Looks up a localized string similar to The length of the filter statement is {0}, which exceeds the maximum length of {1}.
/// </summary>
public static string SqlFilterStatmentTooLong {
internal static string SqlFilterStatmentTooLong {
get {
return ResourceManager.GetString("SqlFilterStatmentTooLong", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Argument {0} must be a non-negative timeout value. The provided value was {1}..
/// Looks up a localized string similar to Argument {0} must be a non-negative timeout value. The provided value was {1}..
/// </summary>
public static string TimeoutMustBeNonNegative {
internal static string TimeoutMustBeNonNegative {
get {
return ResourceManager.GetString("TimeoutMustBeNonNegative", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Argument {0} must be a positive timeout value. The provided value was {1}..
/// Looks up a localized string similar to Argument {0} must be a positive timeout value. The provided value was {1}..
/// </summary>
public static string TimeoutMustBePositive {
internal static string TimeoutMustBePositive {
get {
return ResourceManager.GetString("TimeoutMustBePositive", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to The provided token does not specify the &apos;Audience&apos; value..
/// Looks up a localized string similar to Argument {0} must be a positive non-zero timeout value. The provided value was {1}..
/// </summary>
public static string TokenMissingAudience {
internal static string TimeoutMustBePositiveNonZero {
get {
return ResourceManager.GetString("TimeoutMustBePositiveNonZero", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to The provided token does not specify the &apos;Audience&apos; value..
/// </summary>
internal static string TokenMissingAudience {
get {
return ResourceManager.GetString("TokenMissingAudience", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to The provided token does not specify the &apos;ExpiresOn&apos; value..
/// Looks up a localized string similar to The provided token does not specify the &apos;ExpiresOn&apos; value..
/// </summary>
public static string TokenMissingExpiresOn {
internal static string TokenMissingExpiresOn {
get {
return ResourceManager.GetString("TokenMissingExpiresOn", resourceCulture);
}
}
}
}
}

Просмотреть файл

@ -210,4 +210,7 @@
<data name="SessionFilterMissing" xml:space="preserve">
<value>Session filter is missing on the link. </value>
</data>
<data name="TimeoutMustBePositiveNonZero" xml:space="preserve">
<value>Argument {0} must be a positive non-zero timeout value. The provided value was {1}.</value>
</data>
</root>

Просмотреть файл

@ -178,6 +178,11 @@ namespace Microsoft.Azure.ServiceBus.UnitTests
Assert.True(timer.Elapsed.TotalSeconds < 40);
}
internal async Task ReceiveShouldThrowForServerTimeoutZero(IMessageReceiver messageReceiver)
{
await Assert.ThrowsAsync<ArgumentOutOfRangeException>(() => messageReceiver.ReceiveAsync(TimeSpan.Zero));
}
internal async Task ScheduleMessagesAppearAfterScheduledTimeAsyncTestCase(IMessageSender messageSender, IMessageReceiver messageReceiver, int messageCount)
{
var startTime = DateTime.UtcNow;

Просмотреть файл

@ -97,6 +97,23 @@ namespace Microsoft.Azure.ServiceBus.UnitTests
}
}
[Theory]
[MemberData(nameof(TestPermutations))]
[DisplayTestMethodName]
async Task ReceiveShouldThrowForServerTimeoutZero(string queueName)
{
var receiver = new MessageReceiver(TestUtility.NamespaceConnectionString, queueName, receiveMode: ReceiveMode.ReceiveAndDelete);
try
{
await this.ReceiveShouldThrowForServerTimeoutZero(receiver);
}
finally
{
await receiver.CloseAsync().ConfigureAwait(false);
}
}
[Fact]
[DisplayTestMethodName]
async Task ReceiverShouldUseTheLatestPrefetchCount()