Compile Error 'RuntimeInformation' does not exist in the current context
myfingerhurt opened this issue · 6 comments
When I was trying to compile this project at first time with Visual Studio 2015, I ran into these errors.
Error CS0103 The name 'RuntimeInformation' does not exist in the current context
Error CS0103 The name 'OSPlatform' does not exist in the current context
And before those errors vs 2015 was asking me for .NET Framework 4.8.
First I was trying to install .NET Framework 4.8, but didn't solve the errors.
https://dotnet.microsoft.com/download/dotnet-framework/net48
Then after few googling, I found this site was helping.
https://www.nuget.org/packages/System.Runtime.InteropServices.RuntimeInformation/
So I go to Solution Explorer find this project, right-click, Manage Nuget Package... In the Browse tab, Search "RuntimeInformation" then find the "System.Runtime.InteropServices.RuntimeInformation" Package name, 4.3.0 is the newest for now, and click Install.
Then rebuild, all errors are gone.
Another problem, STUN from Google not always works very well.
Your external IP can't be obtained. You are blocked :-(
.\p2p-main\p2pconn\Form1.cs
Need to be able to change the STUN server address, so better to expose STUN server address into the GUI.
The Visual Studio error “You are debugging a Release build of p2p.exe. Using Just My Code with Release builds using compiler optimizations results in a degraded debugging experience (e.g. breakpoints will not be hit).”
In Tools
- Options
window, navigate to General
section from the unfolded Debugging
tree
In General
section , check the checkbox by the name Suppress JIT optimization on module load (Managed only)
Hello @myfingerhurt, thanks for sharing your valuable notes, much appreciated!
Another problem, STUN from Google not always works very well.
Your external IP can't be obtained. You are blocked :-(
.\p2p-main\p2pconn\Form1.cs
Need to be able to change the STUN server address, so better to expose STUN server address into the GUI.
Added more stun servers: 171947c
For now, the error is gone. I can connect 2 PCs in LAN but not in WAN. For this to work should port forwarding be enabled? Because my ISP doesn't allow forwarding ports. Is that can be a reason?
Good.., No need for port forwarding, being P2P.