Environment: Windows 10 eval copy; VS 2013 Express Update3.
I created a Blank WP 8.1 app and a Windows Phone Silverlight Class Library. I added a class to the class library and in the constructor attempt to new a Socket. The Blank WP 8.1 app creates an instance of the class in its OnNavigatedTo event. That's the only change I made to the WP 8.1 app.
The call in the Class1 constructor generates the exception given below. This occurs in the Emulator 8.1 WVGA 4 inch 512MB. Can anyone tell me what I'm doing wrong?
MainPage.xml.cs:
protected override void OnNavigatedTo(NavigationEventArgs e)
{
Class1 class1 = new Class1();
...
namespace SockLib { public class Class1 { public Class1() { try { // The next line generates the exception. Socket sock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); } catch (Exception e) { System.Diagnostics.Debug.WriteLine(e.ToString()); } } } } A first chance exception of type 'System.NullReferenceException' occurred in System.Net.ni.DLL System.NullReferenceException: Object reference not set to an instance of an object. at System.Net.Sockets.SocketNotificationManager..ctor() at System.Net.Sockets.Socket.get_SocketManager() at System.Net.Sockets.Socket..ctor(AddressFamily addressFamily, SocketType socketType, ProtocolType protocolType) at SockLib.Class1..ctor()