You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 1, 2024. It is now read-only.
ConnectAsync will hang indefinitely (the await will never continue) if an Android device is offline. A fully functional example can be downloaded and ran here: https://github.com/kwende/MqttNetExampleIssues.
Steps to Reproduce
The following are steps to reproduce on Android.
Disable your devices network (wireless and data),
Instantiate a socket of type Stream, TCP.
Instantiate a CancellationTokenSouce and assign a timeout.
Register a routine to be invoked when the token source times out, within that routine call Close/Dispose on the socket.
Attempt to connect to an endpoint with ConnectAsync.
You'll see the cancellation callback invoke, the socket will have Close/Dispose invoked, but it will never continue after the await. The result is effectively a hang.
Expected Behavior
When calling Close/Dispose on a socket attempt to connect to an endpoint using ConnectAsync on a device that has no network connectivity, a Dispose/Aborted-type exception should be raised and the await should continue as a result.
Actual Behavior
When calling Close/Dispose on a socket attempting to connect to an endpoint using ConnectAsync on a device that has no network connectivity, the await never continues and the network connection attempt hangs.
Basic Information
Version with issue: 5.0.0.2012
Last known good version: 5.0.0.2012
Platform Target Frameworks:
Android: Android 11.0 R
Android Support Library / AndroidX Version: NA
NuGet Packages: Xamarin.Essentials v 1.6.1 and Xamarin.Forms 5.0.0.2012
Affected Devices: Seemingly all. Tested on Google Pixel 3
Environment
Microsoft Visual Studio Professional 2022
Version 17.2.1
VisualStudio.17.Release/17.2.1+32516.85
Microsoft .NET Framework
Version 4.8.04161
Installed Version: Professional
Visual C++ 2022 00476-80000-00000-AA252
Microsoft Visual C++ 2022
.NET Core Debugging with WSL 1.0
.NET Core Debugging with WSL
ASP.NET and Web Tools 2019 17.2.388.21846
ASP.NET and Web Tools 2019
Azure App Service Tools v3.0.0 17.2.388.21846
Azure App Service Tools v3.0.0
Azure Functions and Web Jobs Tools 17.2.388.21846
Azure Functions and Web Jobs Tools
C# Tools 4.2.0-4.22252.24+47cdc16a21bbb8a4aadfb666b011e2059e1be5d2
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Common Azure Tools 1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.
Cookiecutter 17.0.22089.1
Provides tools for finding, instantiating and customizing templates in cookiecutter format.
Extensibility Message Bus 1.2.6 (master@34d6af2)
Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.
Linux Core Dump Debugging 1.0.9.32408
Enables debugging of Linux core dumps.
Microsoft JVM Debugger 1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines
Mono Debugging for Visual Studio 17.2.20 (482eb2a)
Support for debugging Mono processes with Visual Studio.
NuGet Package Manager 6.2.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/
Python - Profiling support 17.0.22089.1
Profiling support for Python projects.
Python with Pylance 17.0.22089.1
Provides IntelliSense, projects, templates, debugging, interactive windows, and other support for Python developers.
Razor (ASP.NET Core) 17.0.0.2218101+885a343b00bcab620a90c1550c37dafd730ce984
Provides languages services for ASP.NET Core Razor.
SQL Server Data Tools 17.0.62204.01010
Microsoft SQL Server Data Tools
Test Adapter for Boost.Test 1.0
Enables Visual Studio's testing tools with unit tests written for Boost.Test. The use terms and Third Party Notices are available in the extension installation directory.
Test Adapter for Google Test 1.0
Enables Visual Studio's testing tools with unit tests written for Google Test. The use terms and Third Party Notices are available in the extension installation directory.
TypeScript Tools 17.0.10418.2001
TypeScript Tools for Microsoft Visual Studio
Visual Basic Tools 4.2.0-4.22252.24+47cdc16a21bbb8a4aadfb666b011e2059e1be5d2
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Visual C++ for Linux Development 1.0.9.32408
Visual C++ for Linux Development
Visual F# Tools 17.1.0-beta.22253.3+058e7a7e597a02c129f38742f250a4b212da9ee3
Microsoft Visual F# Tools
Visual Studio IntelliCode 2.2
AI-assisted development for Visual Studio.
VisualStudio.DeviceLog 1.0
Information about my package
VisualStudio.Mac 1.0
Mac Extension for Visual Studio
VSPackage Extension 1.0
VSPackage Visual Studio Extension Detailed Info
Xamarin 17.2.0.174 (d17-2@fb414d4)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.
Xamarin Designer 17.2.0.244 (remotes/origin/d17-2@197e1a0b7)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.
Xamarin Templates 17.2.15 (2e3b60e)
Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.
Description
ConnectAsync will hang indefinitely (the await will never continue) if an Android device is offline. A fully functional example can be downloaded and ran here: https://github.com/kwende/MqttNetExampleIssues.
Steps to Reproduce
The following are steps to reproduce on Android.
You'll see the cancellation callback invoke, the socket will have Close/Dispose invoked, but it will never continue after the await. The result is effectively a hang.
Expected Behavior
When calling Close/Dispose on a socket attempt to connect to an endpoint using ConnectAsync on a device that has no network connectivity, a Dispose/Aborted-type exception should be raised and the await should continue as a result.
Actual Behavior
When calling Close/Dispose on a socket attempting to connect to an endpoint using ConnectAsync on a device that has no network connectivity, the await never continues and the network connection attempt hangs.
Basic Information
Environment
Microsoft Visual Studio Professional 2022
Version 17.2.1
VisualStudio.17.Release/17.2.1+32516.85
Microsoft .NET Framework
Version 4.8.04161
Installed Version: Professional
Visual C++ 2022 00476-80000-00000-AA252
Microsoft Visual C++ 2022
.NET Core Debugging with WSL 1.0
.NET Core Debugging with WSL
ASP.NET and Web Tools 2019 17.2.388.21846
ASP.NET and Web Tools 2019
Azure App Service Tools v3.0.0 17.2.388.21846
Azure App Service Tools v3.0.0
Azure Functions and Web Jobs Tools 17.2.388.21846
Azure Functions and Web Jobs Tools
C# Tools 4.2.0-4.22252.24+47cdc16a21bbb8a4aadfb666b011e2059e1be5d2
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Common Azure Tools 1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.
Cookiecutter 17.0.22089.1
Provides tools for finding, instantiating and customizing templates in cookiecutter format.
Extensibility Message Bus 1.2.6 (master@34d6af2)
Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.
Linux Core Dump Debugging 1.0.9.32408
Enables debugging of Linux core dumps.
Microsoft JVM Debugger 1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines
Mono Debugging for Visual Studio 17.2.20 (482eb2a)
Support for debugging Mono processes with Visual Studio.
NuGet Package Manager 6.2.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/
Python - Profiling support 17.0.22089.1
Profiling support for Python projects.
Python with Pylance 17.0.22089.1
Provides IntelliSense, projects, templates, debugging, interactive windows, and other support for Python developers.
Razor (ASP.NET Core) 17.0.0.2218101+885a343b00bcab620a90c1550c37dafd730ce984
Provides languages services for ASP.NET Core Razor.
SQL Server Data Tools 17.0.62204.01010
Microsoft SQL Server Data Tools
Test Adapter for Boost.Test 1.0
Enables Visual Studio's testing tools with unit tests written for Boost.Test. The use terms and Third Party Notices are available in the extension installation directory.
Test Adapter for Google Test 1.0
Enables Visual Studio's testing tools with unit tests written for Google Test. The use terms and Third Party Notices are available in the extension installation directory.
TypeScript Tools 17.0.10418.2001
TypeScript Tools for Microsoft Visual Studio
Visual Basic Tools 4.2.0-4.22252.24+47cdc16a21bbb8a4aadfb666b011e2059e1be5d2
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Visual C++ for Linux Development 1.0.9.32408
Visual C++ for Linux Development
Visual F# Tools 17.1.0-beta.22253.3+058e7a7e597a02c129f38742f250a4b212da9ee3
Microsoft Visual F# Tools
Visual Studio IntelliCode 2.2
AI-assisted development for Visual Studio.
VisualStudio.DeviceLog 1.0
Information about my package
VisualStudio.Mac 1.0
Mac Extension for Visual Studio
VSPackage Extension 1.0
VSPackage Visual Studio Extension Detailed Info
Xamarin 17.2.0.174 (d17-2@fb414d4)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.
Xamarin Designer 17.2.0.244 (remotes/origin/d17-2@197e1a0b7)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.
Xamarin Templates 17.2.15 (2e3b60e)
Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.
Xamarin.Android SDK 12.3.0.3 (d17-2/bbba5a2)
Xamarin.Android Reference Assemblies and MSBuild support.
Mono: adf1bc4
Java.Interop: xamarin/java.interop/d17-2@9760f0a9
ProGuard: Guardsquare/proguard@912d149
SQLite: xamarin/sqlite@7b1e016
Xamarin.Android Tools: xamarin/xamarin-android-tools/d17-2@fc3c2ac
Xamarin.iOS and Xamarin.Mac SDK 15.10.0.1 (568bdb24e)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.
Show/Hide Visual Studio info
Build Logs
Screenshots
NA
Reproduction Link
Workaround
Calling a synchronous Connect does seem to raise an appropriate exception when the device is offline. This appears to only affect ConnectAsync.
The text was updated successfully, but these errors were encountered: