Azure / azure-iot-sdk-csharp

A C# SDK for connecting devices to Microsoft Azure IoT services
Other
464 stars 494 forks source link

MQTT and AMQP DeviceClient not working with Mono/MacOS #124

Closed dluc closed 6 years ago

dluc commented 7 years ago

The Device Client sample code for AMQP and MQTT included in the SDK doesn't work in MacOS with Mono.

Exception with MQTT:

Error in sample: System.AggregateException: One or more errors occurred. ---> System.NotSupportedException: Specified method is not supported.
  at DotNetty.Handlers.Tls.TlsHandler+MediationStream.Read (System.Byte[] buffer, System.Int32 offset, System.Int32 count) [0x00000] in <22079275ffe0405986b7b9c0e5a29b50>:0 
  at Mono.Net.Security.MobileAuthenticatedStream.InnerRead (System.Int32 requestedSize) [0x00037] in <5afdc70d980c4033b3878286f754d091>:0 
  at (wrapper remoting-invoke-with-check) Mono.Net.Security.MobileAuthenticatedStream:InnerRead (int)
  at Mono.Net.Security.AsyncProtocolRequest.ProcessOperation (Mono.Net.Security.AsyncOperationStatus status) [0x0001d] in <5afdc70d980c4033b3878286f754d091>:0 
  at Mono.Net.Security.AsyncProtocolRequest.ProcessOperation () [0x0000d] in <5afdc70d980c4033b3878286f754d091>:0 
  at Mono.Net.Security.AsyncProtocolRequest.StartOperation () [0x00000] in <5afdc70d980c4033b3878286f754d091>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <ffb99659fc1c47faa4d5f883014d08aa>:0 
  at Mono.Net.Security.MobileAuthenticatedStream.EndProcessAuthentication (System.IAsyncResult result) [0x00064] in <5afdc70d980c4033b3878286f754d091>:0 
  at Mono.Net.Security.MobileAuthenticatedStream.EndAuthenticateAsClient (System.IAsyncResult asyncResult) [0x00000] in <5afdc70d980c4033b3878286f754d091>:0 
  at System.Threading.Tasks.TaskFactory`1[TResult].FromAsyncCoreLogic (System.IAsyncResult iar, System.Func`2[T,TResult] endFunction, System.Action`1[T] endAction, System.Threading.Tasks.Task`1[TResult] promise, System.Boolean requiresSynchronization) [0x00019] in <ffb99659fc1c47faa4d5f883014d08aa>:0 
   --- End of inner exception stack trace ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <ffb99659fc1c47faa4d5f883014d08aa>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <ffb99659fc1c47faa4d5f883014d08aa>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <ffb99659fc1c47faa4d5f883014d08aa>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <ffb99659fc1c47faa4d5f883014d08aa>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in <ffb99659fc1c47faa4d5f883014d08aa>:0 
  at Microsoft.Azure.Devices.Client.Transport.Mqtt.Util+<WriteMessageAsync>d__14.MoveNext () [0x00069] in <01ca0c46397e477d8c9359af2fc84da6>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <ffb99659fc1c47faa4d5f883014d08aa>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <ffb99659fc1c47faa4d5f883014d08aa>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <ffb99659fc1c47faa4d5f883014d08aa>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <ffb99659fc1c47faa4d5f883014d08aa>:0 
  at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <ffb99659fc1c47faa4d5f883014d08aa>:0 
  at Microsoft.Azure.Devices.Client.Transport.Mqtt.MqttTransportHandler+<OpenAsync>d__61.MoveNext () [0x001a3] in <01ca0c46397e477d8c9359af2fc84da6>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <ffb99659fc1c47faa4d5f883014d08aa>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <ffb99659fc1c47faa4d5f883014d08aa>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <ffb99659fc1c47faa4d5f883014d08aa>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <ffb99659fc1c47faa4d5f883014d08aa>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in <ffb99659fc1c47faa4d5f883014d08aa>:0 
  at Microsoft.Azure.Devices.Client.Transport.Mqtt.MqttTransportHandler+<OpenAsync>d__44.MoveNext () [0x00094] in <01ca0c46397e477d8c9359af2fc84da6>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <ffb99659fc1c47faa4d5f883014d08aa>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <ffb99659fc1c47faa4d5f883014d08aa>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <ffb99659fc1c47faa4d5f883014d08aa>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <ffb99659fc1c47faa4d5f883014d08aa>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in <ffb99659fc1c47faa4d5f883014d08aa>:0 
  at Microsoft.Azure.Devices.Client.Transport.ProtocolRoutingDelegatingHandler+<TryOpenPrioritizedTransportsAsync>d__3.MoveNext () [0x00104] in <01ca0c46397e477d8c9359af2fc84da6>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <ffb99659fc1c47faa4d5f883014d08aa>:0 
  at Microsoft.Azure.Devices.Client.Transport.ProtocolRoutingDelegatingHandler+<TryOpenPrioritizedTransportsAsync>d__3.MoveNext () [0x0028f] in <01ca0c46397e477d8c9359af2fc84da6>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <ffb99659fc1c47faa4d5f883014d08aa>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <ffb99659fc1c47faa4d5f883014d08aa>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <ffb99659fc1c47faa4d5f883014d08aa>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <ffb99659fc1c47faa4d5f883014d08aa>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in <ffb99659fc1c47faa4d5f883014d08aa>:0 
  at Microsoft.Azure.Devices.Client.Transport.ProtocolRoutingDelegatingHandler+<OpenAsync>d__2.MoveNext () [0x0006c] in <01ca0c46397e477d8c9359af2fc84da6>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <ffb99659fc1c47faa4d5f883014d08aa>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <ffb99659fc1c47faa4d5f883014d08aa>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <ffb99659fc1c47faa4d5f883014d08aa>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <ffb99659fc1c47faa4d5f883014d08aa>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in <ffb99659fc1c47faa4d5f883014d08aa>:0 
  at Microsoft.Azure.Devices.Client.Transport.ErrorDelegatingHandler+<>c__DisplayClass19_0+<<ExecuteWithErrorHandlingAsync>b__0>d.MoveNext () [0x00065] in <01ca0c46397e477d8c9359af2fc84da6>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <ffb99659fc1c47faa4d5f883014d08aa>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <ffb99659fc1c47faa4d5f883014d08aa>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <ffb99659fc1c47faa4d5f883014d08aa>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <ffb99659fc1c47faa4d5f883014d08aa>:0 
  at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <ffb99659fc1c47faa4d5f883014d08aa>:0 
  at Microsoft.Azure.Devices.Client.Transport.ErrorDelegatingHandler+<ExecuteWithErrorHandlingAsync>d__20`1[T].MoveNext () [0x0011f] in <01ca0c46397e477d8c9359af2fc84da6>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <ffb99659fc1c47faa4d5f883014d08aa>:0 
  at Microsoft.Azure.Devices.Client.Transport.ErrorDelegatingHandler+<ExecuteWithErrorHandlingAsync>d__20`1[T].MoveNext () [0x00321] in <01ca0c46397e477d8c9359af2fc84da6>:0 
--- End of stack trace from previous location where exception was thrown ---
  at Microsoft.Azure.Devices.Client.Transport.ErrorDelegatingHandler+<OpenAsync>d__4.MoveNext () [0x001ae] in <01ca0c46397e477d8c9359af2fc84da6>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <ffb99659fc1c47faa4d5f883014d08aa>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <ffb99659fc1c47faa4d5f883014d08aa>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <ffb99659fc1c47faa4d5f883014d08aa>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <ffb99659fc1c47faa4d5f883014d08aa>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in <ffb99659fc1c47faa4d5f883014d08aa>:0 
  at Microsoft.Azure.Devices.Client.Transport.RetryDelegatingHandler+<OpenAsync>d__23.MoveNext () [0x000a5] in <01ca0c46397e477d8c9359af2fc84da6>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <ffb99659fc1c47faa4d5f883014d08aa>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <ffb99659fc1c47faa4d5f883014d08aa>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <ffb99659fc1c47faa4d5f883014d08aa>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <ffb99659fc1c47faa4d5f883014d08aa>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in <ffb99659fc1c47faa4d5f883014d08aa>:0 
  at Microsoft.Azure.Devices.Client.TaskHelpers+<WithTimeout>d__17.MoveNext () [0x001ff] in <01ca0c46397e477d8c9359af2fc84da6>:0 
---> (Inner Exception #0) System.NotSupportedException: Specified method is not supported.
  at DotNetty.Handlers.Tls.TlsHandler+MediationStream.Read (System.Byte[] buffer, System.Int32 offset, System.Int32 count) [0x00000] in <22079275ffe0405986b7b9c0e5a29b50>:0 
  at Mono.Net.Security.MobileAuthenticatedStream.InnerRead (System.Int32 requestedSize) [0x00037] in <5afdc70d980c4033b3878286f754d091>:0 
  at (wrapper remoting-invoke-with-check) Mono.Net.Security.MobileAuthenticatedStream:InnerRead (int)
  at Mono.Net.Security.AsyncProtocolRequest.ProcessOperation (Mono.Net.Security.AsyncOperationStatus status) [0x0001d] in <5afdc70d980c4033b3878286f754d091>:0 
  at Mono.Net.Security.AsyncProtocolRequest.ProcessOperation () [0x0000d] in <5afdc70d980c4033b3878286f754d091>:0 
  at Mono.Net.Security.AsyncProtocolRequest.StartOperation () [0x00000] in <5afdc70d980c4033b3878286f754d091>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <ffb99659fc1c47faa4d5f883014d08aa>:0 
  at Mono.Net.Security.MobileAuthenticatedStream.EndProcessAuthentication (System.IAsyncResult result) [0x00064] in <5afdc70d980c4033b3878286f754d091>:0 
  at Mono.Net.Security.MobileAuthenticatedStream.EndAuthenticateAsClient (System.IAsyncResult asyncResult) [0x00000] in <5afdc70d980c4033b3878286f754d091>:0 
  at System.Threading.Tasks.TaskFactory`1[TResult].FromAsyncCoreLogic (System.IAsyncResult iar, System.Func`2[T,TResult] endFunction, System.Action`1[T] endAction, System.Threading.Tasks.Task`1[TResult] promise, System.Boolean requiresSynchronization) [0x00019] in <ffb99659fc1c47faa4d5f883014d08aa>:0 <---

Press enter to exit...

Exception with AMQP:

Device sending 5 messages to IoTHub...

    6/16/2017 5:35:55 PM> Sending message: 0, Data: [{"deviceId":"MyCSharpDevice","messageId":0,"temperature":28,"humidity":68}]
Error in sample: One or more errors occurred.

Unhandled Exception:
Microsoft.Azure.Amqp.CallbackException: An AsyncCallback threw an exception. ---> System.InvalidOperationException: An attempt was made to transition a task to a final state when it had already completed.
  at System.Threading.Tasks.TaskCompletionSource`1[TResult].SetException (System.Exception exception) [0x00021] in <ffb99659fc1c47faa4d5f883014d08aa>:0 
  at Microsoft.Azure.Amqp.Transport.AmqpTransportInitiator+<>c__DisplayClass15_0.<ConnectTaskAsync>b__0 (Microsoft.Azure.Amqp.Transport.TransportAsyncCallbackArgs a) [0x0001b] in <30854f3bcccb428b8b0653fd21dc8f6d>:0 
  at Microsoft.Azure.Amqp.Transport.AmqpTransportInitiator.Complete (Microsoft.Azure.Amqp.Transport.TransportAsyncCallbackArgs args) [0x0008c] in <30854f3bcccb428b8b0653fd21dc8f6d>:0 
  at Microsoft.Azure.Amqp.Transport.AmqpTransportInitiator.OnConnectComplete (Microsoft.Azure.Amqp.Transport.TransportAsyncCallbackArgs args) [0x0000f] in <30854f3bcccb428b8b0653fd21dc8f6d>:0 
  at Microsoft.Azure.Amqp.Transport.TlsTransportInitiator.Complete () [0x0006c] in <30854f3bcccb428b8b0653fd21dc8f6d>:0 
  at Microsoft.Azure.Amqp.Transport.TlsTransportInitiator.OnTransportOpened (System.IAsyncResult result) [0x00045] in <30854f3bcccb428b8b0653fd21dc8f6d>:0 
  at Microsoft.Azure.Amqp.AsyncResult.TryComplete (System.Boolean didCompleteSynchronously, System.Exception exception) [0x00117] in <30854f3bcccb428b8b0653fd21dc8f6d>:0 
   --- End of inner exception stack trace ---
  at Microsoft.Azure.Amqp.AsyncResult.TryComplete (System.Boolean didCompleteSynchronously, System.Exception exception) [0x00152] in <30854f3bcccb428b8b0653fd21dc8f6d>:0 
  at Microsoft.Azure.Amqp.AsyncResult.Complete (System.Boolean didCompleteSynchronously, System.Exception e) [0x00001] in <30854f3bcccb428b8b0653fd21dc8f6d>:0 
  at Microsoft.Azure.Amqp.TimeoutAsyncResult`1[T].CompleteInternal (System.Boolean syncComplete, System.Exception exception) [0x0002b] in <30854f3bcccb428b8b0653fd21dc8f6d>:0 
  at Microsoft.Azure.Amqp.TimeoutAsyncResult`1[T].CompleteSelf (System.Boolean syncComplete, System.Exception exception) [0x0001e] in <30854f3bcccb428b8b0653fd21dc8f6d>:0 
  at Microsoft.Azure.Amqp.AmqpObject+AmqpObjectAsyncResult.Signal (System.Boolean syncComplete, System.Exception exception) [0x00009] in <30854f3bcccb428b8b0653fd21dc8f6d>:0 
  at Microsoft.Azure.Amqp.AmqpObject.CompleteOpen (System.Boolean syncComplete, System.Exception exception) [0x00017] in <30854f3bcccb428b8b0653fd21dc8f6d>:0 
  at Microsoft.Azure.Amqp.Transport.TlsTransport.HandleOpenComplete (System.IAsyncResult result, System.Boolean syncComplete) [0x000bf] in <30854f3bcccb428b8b0653fd21dc8f6d>:0 
  at Microsoft.Azure.Amqp.Transport.TlsTransport.OnOpenComplete (System.IAsyncResult result) [0x0001b] in <30854f3bcccb428b8b0653fd21dc8f6d>:0 
  at System.Net.LazyAsyncResult.Complete (System.IntPtr userToken) [0x0003e] in <5afdc70d980c4033b3878286f754d091>:0 
  at System.Net.LazyAsyncResult.ProtectedInvokeCallback (System.Object result, System.IntPtr userToken) [0x00064] in <5afdc70d980c4033b3878286f754d091>:0 
  at System.Net.LazyAsyncResult.InvokeCallback (System.Object result) [0x00000] in <5afdc70d980c4033b3878286f754d091>:0 
  at Mono.Net.Security.AsyncProtocolRequest.StartOperation () [0x0004b] in <5afdc70d980c4033b3878286f754d091>:0 
  at Mono.Net.Security.AsyncProtocolRequest.<StartOperation>b__17_0 (System.Object _) [0x00000] in <5afdc70d980c4033b3878286f754d091>:0 
  at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context (System.Object state) [0x00007] in <ffb99659fc1c47faa4d5f883014d08aa>:0 
  at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00071] in <ffb99659fc1c47faa4d5f883014d08aa>:0 
  at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <ffb99659fc1c47faa4d5f883014d08aa>:0 
  at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem () [0x00021] in <ffb99659fc1c47faa4d5f883014d08aa>:0 
  at System.Threading.ThreadPoolWorkQueue.Dispatch () [0x00074] in <ffb99659fc1c47faa4d5f883014d08aa>:0 
  at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback () [0x00000] in <ffb99659fc1c47faa4d5f883014d08aa>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: Nested exception detected.
Original Exception: at Microsoft.Azure.Amqp.AsyncResult.TryComplete (bool,System.Exception) [0x00152] in <30854f3bcccb428b8b0653fd21dc8f6d>:0
at Microsoft.Azure.Amqp.AsyncResult.Complete (bool,System.Exception) [0x00001] in <30854f3bcccb428b8b0653fd21dc8f6d>:0
at Microsoft.Azure.Amqp.TimeoutAsyncResult`1<Microsoft.Azure.Amqp.AmqpObject>.CompleteInternal (bool,System.Exception) [0x0002b] in <30854f3bcccb428b8b0653fd21dc8f6d>:0
at Microsoft.Azure.Amqp.TimeoutAsyncResult`1<Microsoft.Azure.Amqp.AmqpObject>.CompleteSelf (bool,System.Exception) [0x0001e] in <30854f3bcccb428b8b0653fd21dc8f6d>:0
at Microsoft.Azure.Amqp.AmqpObject/AmqpObjectAsyncResult.Signal (bool,System.Exception) [0x00009] in <30854f3bcccb428b8b0653fd21dc8f6d>:0
at Microsoft.Azure.Amqp.AmqpObject.CompleteOpen (bool,System.Exception) [0x00017] in <30854f3bcccb428b8b0653fd21dc8f6d>:0
at Microsoft.Azure.Amqp.Transport.TlsTransport.HandleOpenComplete (System.IAsyncResult,bool) [0x000bf] in <30854f3bcccb428b8b0653fd21dc8f6d>:0
at Microsoft.Azure.Amqp.Transport.TlsTransport.OnOpenComplete (System.IAsyncResult) [0x0001b] in <30854f3bcccb428b8b0653fd21dc8f6d>:0
at System.Net.LazyAsyncResult.Complete (intptr) [0x0003e] in <5afdc70d980c4033b3878286f754d091>:0
at System.Net.LazyAsyncResult.ProtectedInvokeCallback (object,intptr) [0x00064] in <5afdc70d980c4033b3878286f754d091>:0
at System.Net.LazyAsyncResult.InvokeCallback (object) [0x00000] in <5afdc70d980c4033b3878286f754d091>:0
at Mono.Net.Security.AsyncProtocolRequest.StartOperation () [0x0004b] in <5afdc70d980c4033b3878286f754d091>:0
at Mono.Net.Security.AsyncProtocolRequest.<StartOperation>b__17_0 (object) [0x00000] in <5afdc70d980c4033b3878286f754d091>:0
at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context (object) [0x00007] in <ffb99659fc1c47faa4d5f883014d08aa>:0
at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool) [0x00071] in <ffb99659fc1c47faa4d5f883014d08aa>:0
at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool) [0x00000] in <ffb99659fc1c47faa4d5f883014d08aa>:0
at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem () [0x00021] in <ffb99659fc1c47faa4d5f883014d08aa>:0
at System.Threading.ThreadPoolWorkQueue.Dispatch () [0x00074] in <ffb99659fc1c47faa4d5f883014d08aa>:0
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback () [0x00000] in <ffb99659fc1c47faa4d5f883014d08aa>:0

Nested exception:managed backtrace not available
dluc commented 7 years ago

example project: https://github.com/dluc/iot-amqp-bug

tameraw commented 7 years ago

@dluc - It's currently in our backlog to get our .Netstandard implementation working against all supported platforms. Regards.

rquackenbush commented 7 years ago

Any progress on this?

CIPop commented 6 years ago

I gave this a quick look:

  1. The first error seems to be something unsupported on Mono. It might be that they’ve fixed it in a future Mono version or it might be that MQTT is not supported today on Mono (we have a test gap that we plan to fill in the future): DotNetty doesn’t implement the Synchronous Read stream operation. (In TlsHandler.cs:901).

  2. Second error seems like a (race condition ?) bug in AmqpTransportInitiator – it’s trying to SetException on an already completed task (possibly hiding another exception). We'll need to take a deeper look to understand why this is happening.

@rquackenbush do you see these errors with the latest version?

rquackenbush commented 6 years ago

@CIPop - yes. I'm using:

Error:

System.AggregateException: One or more errors occurred. ---> System.NotSupportedException: Specified method is not supported.
  at DotNetty.Handlers.Tls.TlsHandler+MediationStream.Read (System.Byte[] buffer, System.Int32 offset, System.Int32 count) [0x00000] in <95a592ba45884f87804d9fdf7e4d7fe2>:0 
  at Mono.Net.Security.MobileAuthenticatedStream.InnerRead (System.Int32 requestedSize) [0x00037] in <d2c057d9d34d4e029e580897bd60340c>:0 
  at (wrapper remoting-invoke-with-check) Mono.Net.Security.MobileAuthenticatedStream:InnerRead (int)
  at Mono.Net.Security.AsyncProtocolRequest.ProcessOperation (Mono.Net.Security.AsyncOperationStatus status) [0x0001d] in <d2c057d9d34d4e029e580897bd60340c>:0 
  at Mono.Net.Security.AsyncProtocolRequest.ProcessOperation () [0x0000d] in <d2c057d9d34d4e029e580897bd60340c>:0 
  at Mono.Net.Security.AsyncProtocolRequest.StartOperation () [0x00000] in <d2c057d9d34d4e029e580897bd60340c>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <204f770036d441bb8dfd3daba3550e83>:0 
  at Mono.Net.Security.MobileAuthenticatedStream.EndProcessAuthentication (System.IAsyncResult result) [0x00064] in <d2c057d9d34d4e029e580897bd60340c>:0 
  at Mono.Net.Security.MobileAuthenticatedStream.EndAuthenticateAsClient (System.IAsyncResult asyncResult) [0x00000] in <d2c057d9d34d4e029e580897bd60340c>:0 
  at System.Threading.Tasks.TaskFactory`1[TResult].FromAsyncCoreLogic (System.IAsyncResult iar, System.Func`2[T,TResult] endFunction, System.Action`1[T] endAction, System.Threading.Tasks.Task`1[TResult] promise, System.Boolean requiresSynchronization) [0x00019] in <204f770036d441bb8dfd3daba3550e83>:0 
   --- End of inner exception stack trace ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <204f770036d441bb8dfd3daba3550e83>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <204f770036d441bb8dfd3daba3550e83>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <204f770036d441bb8dfd3daba3550e83>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <204f770036d441bb8dfd3daba3550e83>:0 
  at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <204f770036d441bb8dfd3daba3550e83>:0 
  at Microsoft.Azure.Devices.Client.Transport.Mqtt.MqttTransportHandler+<OpenAsync>d__62.MoveNext () [0x00173] in <e33b45e7a81b48a49634235a6c67f098>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <204f770036d441bb8dfd3daba3550e83>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <204f770036d441bb8dfd3daba3550e83>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <204f770036d441bb8dfd3daba3550e83>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <204f770036d441bb8dfd3daba3550e83>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in <204f770036d441bb8dfd3daba3550e83>:0 
  at Microsoft.Azure.Devices.Client.Transport.Mqtt.Util+<WriteMessageAsync>d__14.MoveNext () [0x00087] in <e33b45e7a81b48a49634235a6c67f098>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <204f770036d441bb8dfd3daba3550e83>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <204f770036d441bb8dfd3daba3550e83>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <204f770036d441bb8dfd3daba3550e83>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <204f770036d441bb8dfd3daba3550e83>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in <204f770036d441bb8dfd3daba3550e83>:0 
  at Microsoft.Azure.Devices.Client.Transport.Mqtt.MqttTransportHandler+<OpenAsync>d__45.MoveNext () [0x00087] in <e33b45e7a81b48a49634235a6c67f098>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <204f770036d441bb8dfd3daba3550e83>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <204f770036d441bb8dfd3daba3550e83>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <204f770036d441bb8dfd3daba3550e83>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <204f770036d441bb8dfd3daba3550e83>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in <204f770036d441bb8dfd3daba3550e83>:0 
  at Microsoft.Azure.Devices.Client.Transport.ProtocolRoutingDelegatingHandler+<TryOpenPrioritizedTransportsAsync>d__3.MoveNext () [0x000ea] in <e33b45e7a81b48a49634235a6c67f098>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <204f770036d441bb8dfd3daba3550e83>:0 
  at Microsoft.Azure.Devices.Client.Transport.ProtocolRoutingDelegatingHandler+<TryOpenPrioritizedTransportsAsync>d__3.MoveNext () [0x0025d] in <e33b45e7a81b48a49634235a6c67f098>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <204f770036d441bb8dfd3daba3550e83>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <204f770036d441bb8dfd3daba3550e83>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <204f770036d441bb8dfd3daba3550e83>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <204f770036d441bb8dfd3daba3550e83>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in <204f770036d441bb8dfd3daba3550e83>:0 
  at Microsoft.Azure.Devices.Client.Transport.ProtocolRoutingDelegatingHandler+<OpenAsync>d__2.MoveNext () [0x0006e] in <e33b45e7a81b48a49634235a6c67f098>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <204f770036d441bb8dfd3daba3550e83>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <204f770036d441bb8dfd3daba3550e83>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <204f770036d441bb8dfd3daba3550e83>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <204f770036d441bb8dfd3daba3550e83>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in <204f770036d441bb8dfd3daba3550e83>:0 
  at Microsoft.Azure.Devices.Client.Transport.ErrorDelegatingHandler+<>c__DisplayClass19_0+<<ExecuteWithErrorHandlingAsync>b__0>d.MoveNext () [0x00067] in <e33b45e7a81b48a49634235a6c67f098>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <204f770036d441bb8dfd3daba3550e83>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <204f770036d441bb8dfd3daba3550e83>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <204f770036d441bb8dfd3daba3550e83>:0 
  at System.Runtime.CompilerServicesSystem.AggregateException: One or more errors occurred. ---> System.NotSupportedException: Specified method is not supported.
  at DotNetty.Handlers.Tls.TlsHandler+MediationStream.Read (System.Byte[] buffer, System.Int32 offset, System.Int32 count) [0x00000] in <95a592ba45884f87804d9fdf7e4d7fe2>:0 
  at Mono.Net.Security.MobileAuthenticatedStream.InnerRead (System.Int32 requestedSize) [0x00037] in <d2c057d9d34d4e029e580897bd60340c>:0 
  at (wrapper remoting-invoke-with-check) Mono.Net.Security.MobileAuthenticatedStream:InnerRead (int)
  at Mono.Net.Security.AsyncProtocolRequest.ProcessOperation (Mono.Net.Security.AsyncOperationStatus status) [0x0001d] in <d2c057d9d34d4e029e580897bd60340c>:0 
  at Mono.Net.Security.AsyncProtocolRequest.ProcessOperation () [0x0000d] in <d2c057d9d34d4e029e580897bd60340c>:0 
  at Mono.Net.Security.AsyncProtocolRequest.StartOperation () [0x00000] in <d2c057d9d34d4e029e580897bd60340c>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <204f770036d441bb8dfd3daba3550e83>:0 
  at Mono.Net.Security.MobileAuthenticatedStream.EndProcessAuthentication (System.IAsyncResult result) [0x00064] in <d2c057d9d34d4e029e580897bd60340c>:0 
  at Mono.Net.Security.MobileAuthenticatedStream.EndAuthenticateAsClient (System.IAsyncResult asyncResult) [0x00000] in <d2c057d9d34d4e029e580897bd60340c>:0 
  at System.Threading.Tasks.TaskFactory`1[TResult].FromAsyncCoreLogic (System.IAsyncResult iar, System.Func`2[T,TResult] endFunction, System.Action`1[T] endAction, System.Threading.Tasks.Task`1[TResult] promise, System.Boolean requiresSynchronization) [0x00019] in <204f770036d441bb8dfd3daba3550e83>:0 
   --- End of inner exception stack trace ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <204f770036d441bb8dfd3daba3550e83>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <204f770036d441bb8dfd3daba3550e83>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <204f770036d441bb8dfd3daba3550e83>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <204f770036d441bb8dfd3daba3550e83>:0 
  at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <204f770036d441bb8dfd3daba3550e83>:0 
  at Microsoft.Azure.Devices.Client.Transport.Mqtt.MqttTransportHandler+<OpenAsync>d__62.MoveNext () [0x00173] in <e33b45e7a81b48a49634235a6c67f098>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <204f770036d441bb8dfd3daba3550e83>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <204f770036d441bb8dfd3daba3550e83>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <204f770036d441bb8dfd3daba3550e83>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <204f770036d441bb8dfd3daba3550e83>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in <204f770036d441bb8dfd3daba3550e83>:0 
  at Microsoft.Azure.Devices.Client.Transport.Mqtt.MqttTransportHandler+<OpenAsync>d__45.MoveNext () [0x00087] in <e33b45e7a81b48a49634235a6c67f098>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <204f770036d441bb8dfd3daba3550e83>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <204f770036d441bb8dfd3daba3550e83>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <204f770036d441bb8dfd3daba3550e83>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <204f770036d441bb8dfd3daba3550e83>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in <204f770036d441bb8dfd3daba3550e83>:0 
  at Microsoft.Azure.Devices.Client.Transport.ProtocolRoutingDelegatingHandler+<TryOpenPrioritizedTransportsAsync>d__3.MoveNext () [0x000ea] in <e33b45e7a81b48a49634235a6c67f098>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <204f770036d441bb8dfd3daba3550e83>:0 
  at Microsoft.Azure.Devices.Client.Transport.ProtocolRoutingDelegatingHandler+<TryOpenPrioritizedTransportsAsync>d__3.MoveNext () [0x0025d] in <e33b45e7a81b48a49634235a6c67f098>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <204f770036d441bb8dfd3daba3550e83>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <204f770036d441bb8dfd3daba3550e83>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <204f770036d441bb8dfd3daba3550e83>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <204f770036d441bb8dfd3daba3550e83>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in <204f770036d441bb8dfd3daba3550e83>:0 
  at Microsoft.Azure.Devices.Client.Transport.ProtocolRoutingDelegatingHandler+<OpenAsync>d__2.MoveNext () [0x0006e] in <e33b45e7a81b48a49634235a6c67f098>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <204f770036d441bb8dfd3daba3550e83>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <204f770036d441bb8dfd3daba3550e83>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <204f770036d441bb8dfd3daba3550e83>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <204f770036d441bb8dfd3daba3550e83>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in <204f770036d441bb8dfd3daba3550e83>:0 
  at Microsoft.Azure.Devices.Client.Transport.ErrorDelegatingHandler+<>c__DisplayClass19_0+<<ExecuteWithErrorHandlingAsync>b__0>d.MoveNext () [0x00067] in <e33b45e7a81b48a49634235a6c67f098>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <204f770036d441bb8dfd3daba3550e83>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <204f770036d441bb8dfd3daba3550e83>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <204f770036d441bb8dfd3daba3550e83>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <204f770036d441bb8dfd3daba3550e83>:0 
  at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <204f770036d441bb8dfd3daba3550e83>:0 
  at Microsoft.Azure.Devices.Client.Transport.ErrorDelegatingHandler+<ExecuteWithErrorHandlingAsync>d__20`1[T].MoveNext () [0x00112] in <e33b45e7a81b48a49634235a6c67f098>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <204f770036d441bb8dfd3daba3550e83>:0 
  at Microsoft.Azure.Devices.Client.Transport.ErrorDelegatingHandler+<ExecuteWithErrorHandlingAsync>d__20`1[T].MoveNext () [0x002f2] in <e33b45e7a81b48a49634235a6c67f098>:0 
--- End of stack trace from previous location where exception was thrown ---
  at Microsoft.Azure.Devices.Client.Transport.ErrorDelegatingHandler+<OpenAsync>d__4.MoveNext () [0x0018d] in <e33b45e7a81b48a49634235a6c67f098>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <204f770036d441bb8dfd3daba3550e83>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <204f770036d441bb8dfd3daba3550e83>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <204f770036d441bb8dfd3daba3550e83>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <204f770036d441bb8dfd3daba3550e83>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in <204f770036d441bb8dfd3daba3550e83>:0 
  at Microsoft.Azure.Devices.Client.Transport.Mqtt.MqttIotHubAdapter+<Connect>d__31.MoveNext () [0x00227] in <e33b45e7a81b48a49634235a6c67f098>:0 
--- End of stack trace from previous location where exception was thrown ---
  at Microsoft.Azure.Devices.Client.DeviceClient+<>c__DisplayClass64_0.<ApplyTimeout>b__2 (System.Threading.Tasks.Task t) [0x0001e] in <e33b45e7a81b48a49634235a6c67f098>:0 
  at System.Threading.Tasks.ContinuationTaskFromTask.InnerInvoke () [0x00024] in <204f770036d441bb8dfd3daba3550e83>:0 
  at System.Threading.Tasks.Task.Execute () [0x00010] in <204f770036d441bb8dfd3daba3550e83>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <204f770036d441bb8dfd3daba3550e83>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <204f770036d441bb8dfd3daba3550e83>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <204f770036d441bb8dfd3daba3550e83>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <204f770036d441bb8dfd3daba3550e83>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in <204f770036d441bb8dfd3daba3550e83>:0 
  at CaptiveAire.Scada.Module.Host+<RunAsync>d__3.MoveNext () [0x001b2] in <0091e3c5af3d49dd9d48afc9f07f7cef>:0 
---> (Inner Exception #0) System.NotSupportedException: Specified method is not supported.
  at DotNetty.Handlers.Tls.TlsHandler+MediationStream.Read (System.Byte[] buffer, System.Int32 offset, System.Int32 count) [0x00000] in <95a592ba45884f87804d9fdf7e4d7fe2>:0 
  at Mono.Net.Security.MobileAuthenticatedStream.InnerRead (System.Int32 requestedSize) [0x00037] in <d2c057d9d34d4e029e580897bd60340c>:0 
  at (wrapper remoting-invoke-with-check) Mono.Net.Security.MobileAuthenticatedStream:InnerRead (int)
  at Mono.Net.Security.AsyncProtocolRequest.ProcessOperation (Mono.Net.Security.AsyncOperationStatus status) [0x0001d] in <d2c057d9d34d4e029e580897bd60340c>:0 
  at Mono.Net.Security.AsyncProtocolRequest.ProcessOperation () [0x0000d] in <d2c057d9d34d4e029e580897bd60340c>:0 
  at Mono.Net.Security.AsyncProtocolRequest.StartOperation () [0x00000] in <d2c057d9d34d4e029e580897bd60340c>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <204f770036d441bb8dfd3daba3550e83>:0 
  at Mono.Net.Security.MobileAuthenticatedStream.EndProcessAuthentication (System.IAsyncResult result) [0x00064] in <d2c057d9d34d4e029e580897bd60340c>:0 
  at Mono.Net.Security.MobileAuthenticatedStream.EndAuthenticateAsClient (System.IAsyncResult asyncResult) [0x00000] in <d2c057d9d34d4e029e580897bd60340c>:0 
  at System.Threading.Tasks.TaskFactory`1[TResult].FromAsyncCoreLogic (System.IAsyncResult iar, System.Func`2[T,TResult] endFunction, System.Action`1[T] endAction, System.Threading.Tasks.Task`1[TResult] promise, System.Boolean requiresSynchronization) [0x00019] in <204f770036d441bb8dfd3daba3550e83>:0 <---
rquackenbush commented 6 years ago

I just did some testing with the latest version of mono (5.4.0.201) and am happy to report that the Azure AMQP client is working and receiving messages. I haven't tried direct method invocations yet.

The MQTT client isn't throwing any errors, but it always times out when attempting to connect.

CIPop commented 6 years ago

The MQTT client isn't throwing any errors, but it always times out when attempting to connect.

@rquackenbush the QTT on Mono doesn't give you the System.NotSupportedException: Specified method is not supported. anymore? Can you check if it actually tries to connect using Wireshark - maybe it's a firewall rule or something on the network side interfering with the connection on that port.

rquackenbush commented 6 years ago

I haven't tried to capture any traffic, but I have have a version of my code that uses the M2Mqtt library (https://m2mqtt.wordpress.com/) to connect and it works fine so it shouldn't be a network / firewall issue.

On Wed, Oct 18, 2017 at 9:50 PM, Cristian Pop notifications@github.com wrote:

The MQTT client isn't throwing any errors, but it always times out when attempting to connect.

@rquackenbush https://github.com/rquackenbush the QTT on Mono doesn't give you the System.NotSupportedException: Specified method is not supported. anymore? Can you check if it actually tries to connect using Wireshark - maybe it's a firewall rule or something on the network side interfering with the connection on that port.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Azure/azure-iot-sdk-csharp/issues/124#issuecomment-337776313, or mute the thread https://github.com/notifications/unsubscribe-auth/AEGE7p229wkEnaYg5JuYVl8xKhN3NUEHks5stqrwgaJpZM4N9E9T .

CIPop commented 6 years ago

We're tracking multiple issues caused by the PCL libraries. The decision was to remove the PCL binary from our next release. As a workaround, please try adding a new netstandard1.3 (or 2.0) library to your project and reference it from the Mono application. Using the SDK within this library should work. We also recommend, if your platform allows, switching to .Net Core instead of Mono.

Tentatively closing this as a duplicate of #138 .