Skip to content

IPGlobalProperties.GetActiveUdpListeners() hangs in .NET 5 preview 2 #35051

@martincostello

Description

@martincostello

Using .NET 5.0.100-preview.2.20176.6, calls to IPGlobalProperties.GetActiveUdpListeners() seem to hang indefinitely.

I can repro this with the following, where the Console output never occurs with .NET 5 preview 2 (the method does not block with .NET Core 3.1).

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net5.0</TargetFramework>
    <RootNamespace>GetActiveUdpListenersHangRepro</RootNamespace>
  </PropertyGroup>
</Project>
using System;
using System.Net.NetworkInformation;

namespace GetActiveUdpListenersHangRepro
{
    internal static class Program
    {
        internal static void Main()
        {
            var properties = IPGlobalProperties.GetIPGlobalProperties();
            properties.GetActiveUdpListeners();

            Console.Write("Press any key to exit...");
            Console.Read();
        }
    }
}

Partial output from dotnet --info:

> dotnet --info
.NET Core SDK (reflecting any global.json):
 Version:   5.0.100-preview.2.20176.6
 Commit:    d752c3e07b

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.18362
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\5.0.100-preview.2.20176.6\

Host (useful for support):
  Version: 5.0.0-preview.2.20160.6
  Commit:  d12f79a4d1

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions