ppatierno / azuresblite

Access to Microsoft Azure Service Bus from all platforms using AMQP protocol
Apache License 2.0
28 stars 10 forks source link

Queue message complete error message #6

Open kaki104 opened 8 years ago

kaki104 commented 8 years ago

Hello

I used this package to UWP app Messages are normally output. But if I call a Complete method failure occurs. I would like to know the cause of the error below. Is it normal that an error?

source

        _client = QueueClient.CreateFromConnectionString("Endpoint=sb://aaaa.servicebus.windows.net/;SharedAccessKeyName=listen;SharedAccessKey=aaaa", "d2ctutorial");
        OnMessageOptions options = new OnMessageOptions
        {
            AutoComplete = false,
            //AutoRenewTimeout = TimeSpan.FromMinutes(1)
        };

        _client.OnMessage((message) =>
        {
            try
            {
                var bodyStream = message.GetBytes();
                string result = Encoding.UTF8.GetString(bodyStream);
                //var bodyAsString = new StreamReader(bodyStream, Encoding.ASCII).ReadToEnd();

                Debug.WriteLine("Received message: {0} messageId: {1}", result, message.MessageId);
                message.Complete();
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }
        }, options);

error

Object reference not set to an instance of an object. AzureSBLite.WinRT at ppatierno.AzureSBLite.Messaging.BrokeredMessage.Complete() at UWPSample.ViewModels.WelcomePageViewModel.<>c.b__10_0(BrokeredMessage message)