Reputation: 34947
I'm trying to run some code on Windows IoT Core that uses DotNetty and I've run into the following exception:
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
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.
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.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
?
Upvotes: 2
Views: 486
Reputation: 9700
If you use UWP, you need 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.
Ref: .NET implementation support
Else, you can use .NET Core Console App or .NET Framework Console App but more versions choices:
Ref: NetworkInterface.GetAllNetworkInterfaces Method
Upvotes: 3