ServiceBusReceiver.ReceiveMessagesAsync 抛出异常

ServiceBusReceiver.ReceiveMessagesAsync is throwing exceptions

我正在尝试从服务总线死信主题中读取 BlobCreated 事件:

await using(ServiceBusClient serviceBusClient = new ServiceBusClient("xxxxx"))
{
    await using (ServiceBusReceiver receiver = serviceBusClient.CreateReceiver("TOPICNAME/Subscriptions/blob-events/$deadletterqueue"))
    {
        var messages = receiver.ReceiveMessagesAsync(cancellationToken);

        //Exception occurs in the enumeration
        await foreach(var message in messages)
        {
            //Process the message
        }
    }
}

异常详情:

System.ArgumentOutOfRangeException: The UTC time represented when the offset is applied must be between year 0 and 10,000. (Parameter 'offset')
         at System.DateTimeOffset.ValidateDate(DateTime dateTime, TimeSpan offset)
         at System.DateTimeOffset..ctor(DateTime dateTime)
         at Azure.Messaging.ServiceBus.Amqp.AmqpMessageConverter.AmqpMessageToSBMessage(AmqpMessage amqpMessage, Boolean isPeeked)
         at Azure.Messaging.ServiceBus.Amqp.AmqpReceiver.ReceiveMessagesAsyncInternal(Int32 maxMessages, Nullable`1 maxWaitTime, TimeSpan timeout, CancellationToken cancellationToken)
         at Azure.Messaging.ServiceBus.Amqp.AmqpReceiver.ReceiveMessagesAsyncInternal(Int32 maxMessages, Nullable`1 maxWaitTime, TimeSpan timeout, CancellationToken cancellationToken)
         at Azure.Messaging.ServiceBus.Amqp.AmqpReceiver.<>c.<<ReceiveMessagesAsync>b__38_0>d.MoveNext()
      --- End of stack trace from previous location ---
         at Azure.Messaging.ServiceBus.ServiceBusRetryPolicy.RunOperation[T1,TResult](Func`4 operation, T1 t1, TransportConnectionScope scope, CancellationToken cancellationToken)
         at Azure.Messaging.ServiceBus.ServiceBusRetryPolicy.RunOperation[T1,TResult](Func`4 operation, T1 t1, TransportConnectionScope scope, CancellationToken cancellationToken)
         at Azure.Messaging.ServiceBus.Amqp.AmqpReceiver.ReceiveMessagesAsync(Int32 maxMessages, Nullable`1 maxWaitTime, CancellationToken cancellationToken)
         at Azure.Messaging.ServiceBus.ServiceBusReceiver.ReceiveMessagesAsync(Int32 maxMessages, Nullable`1 maxWaitTime, Boolean isProcessor, CancellationToken cancellationToken)
         at Azure.Messaging.ServiceBus.ServiceBusReceiver.ReceiveMessagesAsync(Int32 maxMessages, Nullable`1 maxWaitTime, CancellationToken cancellationToken)
         at Azure.Messaging.ServiceBus.ServiceBusReceiver.ReceiveMessageAsync(Nullable`1 maxWaitTime, CancellationToken cancellationToken)
         at Azure.Messaging.ServiceBus.ServiceBusReceiver.ReceiveMessagesAsync(CancellationToken cancellationToken)+MoveNext()
         at Azure.Messaging.ServiceBus.ServiceBusReceiver.ReceiveMessagesAsync(CancellationToken cancellationToken)+System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult()
         at CarMax.Online.Media.DlqMonitor.MonitorService.RunAsync(CancellationToken cancellationToken) in C:\git\CarMax\online-systems-media-dlq-monitor\src\CarMax.Online.Media.DlqMonitor\MonitorService.cs:line 98
         at CarMax.Online.Media.DlqMonitor.MonitorService.RunAsync(CancellationToken cancellationToken) in C:\git\CarMax\online-systems-media-dlq-monitor\src\CarMax.Online.Media.DlqMonitor\MonitorService.cs:line 98

问题似乎与来自线路的 AMQP 消息的反序列化有关。我怎样才能解决这个问题/防止抛出这个异常?

请注意,我可以使用旧的 WindowsAzure.ServiceBus NuGet 包从遗留 .NET Framework 4.7.2 代码中轮询此主题。

我也遇到过这个问题。它似乎已在预发布 Azure.Messaging.ServiceBus 7.3.0-beta

中修复

这里讨论的问题:https://github.com/Azure/azure-sdk-for-net/issues/23499