简体   繁体   English

(NetNative)NetworkInterface.GetNetworkInterfaces()中的NotImplementedException Win IoT Core 14393

[英]NotImplementedException in (NetNative)NetworkInterface.GetNetworkInterfaces() Win IoT Core 14393

I'm trying to run some code on Windows IoT Core that uses DotNetty and I've run into the following exception: 我正在尝试在使用DotNetty的Windows IoT核心版上运行一些代码,并且遇到了以下异常:

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)

I have found the issue on github for corefx 9675 and one of the comments says 我在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包的更新中添加其余的支持。

I got System.Net.NetworkInformation package v4.3.0 and when I call System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces() directly I sadly get the NotImplementedException exception. 我得到了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()

Question

Can I make this work on Windows IoT Core 14393 ? 我可以在Windows IoT Core 14393上进行这项工作吗?

If you use UWP, you need 10.0.16299. 如果使用UWP,则需要10.0.16299。

Because this API(System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces()) applies to .NET Standard 2.0 and minimum version support .NET Standard 2.0 is 16299. Also, you need set the UWP app min targeting version to 16299 . 因为此API(System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces())适用于.NET Standard 2.0,并且最低版本支持.NET Standard 2.0是16299。而且,您需要将UWP应用的最低定位版本设置为16299

在此处输入图片说明

Ref: .NET implementation support 参考: .NET实现支持

Else, you can use .NET Core Console App or .NET Framework Console App but more versions choices: 另外,您可以使用.NET Core控制台应用程序或.NET Framework控制台应用程序,但可以选择更多版本:

在此处输入图片说明

Ref: NetworkInterface.GetAllNetworkInterfaces Method 参考: NetworkInterface.GetAllNetworkInterfaces方法

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM