(NetNative)NetworkInterface.GetNetworkInterfaces() 中的 NotImplementedException Win IoT Core 14393
NotImplementedException in (NetNative)NetworkInterface.GetNetworkInterfaces() Win IoT Core 14393
我正在尝试 运行 Windows IoT Core 上使用 DotNetty 和
我 运行 出现以下异常:
System.TypeInitializationException: The type initializer for 'DotNetty.Transport.Channels.DefaultChannelId' threw an exception. ---> System.NotImplementedException: The method or operation is not implemented.
at System.Net.NetworkInformation.NetNativeNetworkInterface.GetNetworkInterfaces()
at DotNetty.Common.Internal.MacAddressUtil.GetBestAvailableMac()
at DotNetty.Common.Internal.DefaultPlatform.DotNetty.Common.Internal.IPlatform.GetDefaultDeviceId()
at DotNetty.Transport.Channels.DefaultChannelId.DefaultMachineId()
at DotNetty.Transport.Channels.DefaultChannelId..cctor()
--- End of inner exception stack trace ---
at DotNetty.Transport.Channels.AbstractChannel.NewId()
at DotNetty.Transport.Channels.AbstractChannel..ctor(IChannel parent)
at DotNetty.Transport.Channels.Sockets.AbstractSocketChannel..ctor(IChannel parent, Socket socket)
我在 github 上发现了 corefx
9675 的问题,其中一条评论说
Those particular methods are unimplemented right now. We plan to add the rest of the support later this year in an update to the System.Net.NetworkInformation package.
我得到了 System.Net.NetworkInformation
软件包 v4.3.0,当我打电话
System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces()
我直接得到了 NotImplementedException
异常。
`System.NotImplementedException: The method or operation is not implemented.
at System.Net.NetworkInformation.NetNativeNetworkInterface.GetNetworkInterfaces()
at System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces()
问题
我可以在 Windows IoT Core 14393
上完成这项工作吗?
如果您使用 UWP,则需要 10.0.16299。
因为这个API(System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces())适用于.NET Standard 2.0,支持.NET Standard 2.0的最低版本是16299。另外,你需要设置UWP应用最低定位版本为 16299.
参考:.NET implementation support
否则,您可以使用 .NET Core Console App 或 .NET Framework Console App,但更多版本选择:
我正在尝试 运行 Windows IoT Core 上使用 DotNetty 和 我 运行 出现以下异常:
System.TypeInitializationException: The type initializer for 'DotNetty.Transport.Channels.DefaultChannelId' threw an exception. ---> System.NotImplementedException: The method or operation is not implemented.
at System.Net.NetworkInformation.NetNativeNetworkInterface.GetNetworkInterfaces()
at DotNetty.Common.Internal.MacAddressUtil.GetBestAvailableMac()
at DotNetty.Common.Internal.DefaultPlatform.DotNetty.Common.Internal.IPlatform.GetDefaultDeviceId()
at DotNetty.Transport.Channels.DefaultChannelId.DefaultMachineId()
at DotNetty.Transport.Channels.DefaultChannelId..cctor()
--- End of inner exception stack trace ---
at DotNetty.Transport.Channels.AbstractChannel.NewId()
at DotNetty.Transport.Channels.AbstractChannel..ctor(IChannel parent)
at DotNetty.Transport.Channels.Sockets.AbstractSocketChannel..ctor(IChannel parent, Socket socket)
我在 github 上发现了 corefx
9675 的问题,其中一条评论说
Those particular methods are unimplemented right now. We plan to add the rest of the support later this year in an update to the System.Net.NetworkInformation package.
我得到了 System.Net.NetworkInformation
软件包 v4.3.0,当我打电话
System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces()
我直接得到了 NotImplementedException
异常。
`System.NotImplementedException: The method or operation is not implemented.
at System.Net.NetworkInformation.NetNativeNetworkInterface.GetNetworkInterfaces()
at System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces()
问题
我可以在 Windows IoT Core 14393
上完成这项工作吗?
如果您使用 UWP,则需要 10.0.16299。
因为这个API(System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces())适用于.NET Standard 2.0,支持.NET Standard 2.0的最低版本是16299。另外,你需要设置UWP应用最低定位版本为 16299.
参考:.NET implementation support
否则,您可以使用 .NET Core Console App 或 .NET Framework Console App,但更多版本选择: