-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NetworkInterface.GetAllNetworkInterfaces throws on UWP #17706
Comments
cc: @joshfree @stephentoub @CIPop @himadrisarkar @ericstj 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. |
Is there a document that lists out which methods are known not to be implemented per OS/platform along with plans for future support across all of CoreFX? It'd be far more helpful to reference this in advance than during testing and discovering these things. |
To be clear, my request is across all of corefx if there are other areas where this may come up. Thanks! |
@davidsh Any ETA on this? This is particularly confusing since the official .NET Core documentation lists these methods as implemented and documented. Frankly, I don't think they should be even listed there until they actually are in the framework... |
cc: @himadrisarkar Himadri will look into the documentation to see why it is out of sync with the code implementation. |
+1 @davidsh, @himadrisarkar @joshfree These APIs exist to support the @onovotny to work-around this missing functionality please use
|
@CIPop This alternative API not solve the problems with libraries which supports the netstandard. |
I acknowledge that: it's a complicated workaround for those libraries to work on UWP until we get the APIs implemented. |
Just a comment: .NET Core and that whole family of new and open .NET efforts are really promising and cool, but the framework needs to be communicated and organized in a far more coherent way than it is now. |
Hi everybody! My question now is, did anybody here figured out a way to get the subnetmask of the available interfaces? thx, bg |
Create C\C++ Runtime Component and use GetAdaptersAddresses. Available since Anniversary. |
@jtoivola Thx for the suggestion. I also found that currently you can only get the information by using native code. I will have a look at this. Yesterday I used this PInvoke as mentioned on Stackoverflow. It solved the problem for me. |
This is an absolutely horrible practice. That completely defeats the purpose of having a .NET Standard. |
@karelz will this be included in the work to get netstandard 2.0 to UWP? Like actually implemented and working, not throwing? |
We should at minimum consider it. Personally I'd say that if it is implementable (via APIs available in UWP context) and not super-costly, I don't see a reason to exclude it - @davidsh @CIPop is it part of your NS2.0 UWP plan? Note: The issue is marked 'untriaged' - we are still working through Networking area triage (it's taking longer than I'd like as we are heads down on quite a lot of high-pri Netwroking issues :(). cc: @geoffkizer @Priya91 BTW: It would help if we can see upvotes on the top post to capture customer impact/interest. 10+ votes will be something hard to ignore ;-) |
yes, this is already part of our .NET Standard 2.0 for UWP plan. And by the way, the implementation won't be using WinRT APIs for UWP. We plan to re-use the existing .NET Core implementation which will work on UWP since those needed win32 api's will be part of allowed api for app container. |
@davidsh That's fantastic news! From the above comments, it sounded like there might be other API's in a similar situation -- that are in the surface area but throw at runtime on UWP. Is that still the case for 2.0 or have those gaps been filled? If there will still be a gap, is there a list we can triage to help get community support behind any specific sections? |
@karelz What would be the milestone for .netstandard2.0 UWP? Leaving it at Future for now. |
@Priya91 very good point. I think it's time to create one - I'll call it 2.1-UWP for now (@danmosemsft feel free to adjusted while I am OOF :)) |
@dotMorten @KAepora Couldn't agree more. I'm disappointed this is even a question that needs to be asked. Come on MS! |
We are working thru the list. But the objective for the ".NET Standard 2.0 for UWP" milestone is getting the entire surface area of .NET Standard 2.0 working on UWP. So, that includes System.Net.NetworkInformation as well as the System.Net.Security contract (SslStream, etc.). In general, we have added more things to the win32 allowed list such as iphlp, schannel, etc. so that we can implement these contracts for UWP. |
Off topic to this particular issue but has there been progress on getting ILEmit to work / be supported on UWP in any capacity? Even a fallback interpreter like iOS has can be useful for some things. |
I changed the milestone to 2.1.0 with explanation it is 'temporary version' - cc @danmosemsft @dotMorten @ccicchitelli @KAepora I understand your view point. We're trying to do our best. Sadly, in some (hopefully rare) cases we have to resort to the NotImplemented solutions - due to inability to fully implement the API, or due to resource constraints - ideally backed with low usage data and available workarounds.
Just to be super clear: In the cases when we will rely on newly white-listed OS APIs, we will of course require particular min version of the Win10 OS. |
@onovotny RefEmit is out of scope of .NET Standard 2.0 UWP wotk - it is one of the reasons why RefEmit is not part of .NET Standard 2.0, because it can't be implemented on all platforms. cc @terrajobst @danmosemsft |
I totally understand not every method and API call can be implemented on all platforms for obvious reasons, but I'd like think that's the only reason something doesn't get included. I'm in the position of planning to port a rather large .NET desktop/server app over, let's just say it's not exactly what I expected it would be when the ".NET everywhere!" announcement was made. |
IMHO that just means this API shouldn't have been part of the standard. If you make the API part of the standard, and a platform is saying it supports that standard, you also commit to provide the implementation. Getting runtime exceptions instead of compile time errors is quite unacceptable. I can sit here and happily think my .NET Standard component runs on all these platforms, and then it turns out it doesn't on some. It makes our components completely unsupportable. |
This is indeed lot worse that before.. I don't remember a time where API surface was not implemented for one part in Full Dotnet framework. So much for DotNet everywhere. I agree though this issue was only raised 8 months ago. With all the final and RC releases you lot keep making, few small platforms are bounds to go unsupported.. All for the greater good. yay |
I tried the following below and get "An object reference is required for the non static field, method, or property" and instantiating it throws the error "Does not contain a constructor that takes 0 arguments" SO what am I supposed to do to get network interface information for my Windows universal app? string intlist="";
intlist = NetworkAdapter.InboundMaxBitsPerSecond;
interfaces.Text = intlist; |
As we indicated above in the discussion on this issue, that functionality is not yet implemented for Windows UWP. |
A customer of mine is facing exactly the same issue and had to put a lot of effort into finding a workaround. @danmosemsft Are there any plans to emit compiler warnings when using APIs which throw PNSE/NIE? Or is that already in? |
@terrajobst is developing a tool. Immo will it work for UWP also? |
I'm running into this issue with a Windows 10 Mobile Enterprise device, I can't find an API that will return any information about the current network adapters. I added code to PInvoke Would be nice to have something that works at least, and ideally one of the managed APIs |
The tool should work also for UWP: Please document the API difference here: https://github.com/dotnet/corefx/wiki/ApiCompat |
Looks like we are on track to bring all the APIs back in 2.1. We should still document the difference for current UWP in the above ... |
@karelz Great news! Thank you for listening. |
Just to clarify: The credits for the decision & planning go to @davidsh @CIPop @DavidGoll, I was just the messenger in this case ;-) |
Just little note. Min UWP version should be 10.0.16299 to use |
I’m using the “final” .NET Core bits off of the MyGet feed and ran into an issue trying to use System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces(). The method throws on UWP with a NotImplementedException.
Why isn’t this working on UWP? The library has explicit support for netcore50 in the 4.1.0 nuget package. I would not expect arbitrary methods to simply not work. It sort of undermines trust that WYSIWYG when it comes to available surface area.
The text was updated successfully, but these errors were encountered: