Problem with System.Uri

If I use this code on big .Net I get a valid Host value.

serverUrl = "ws://" + pusherAppKey + "?client=js&version=1.9.3&protocol=5"
this.serverUri = new Uri(serverUrl);
string host = this.serverUri.Host;

But if I use it on .NETMF, I get an empty string value.

Here’s some more info:

	AbsolutePath	"//<my appKey>?client=js&version=1.9.3&protocol=5"
	AbsoluteUri	"ws://<my appKey>?client=js&version=1.9.3&protocol=5"
	Host		""
	HostNameType	Unknown	System.UriHostNameType
	IsAbsoluteUri	1	bool {int}
	IsLoopback	0	bool {int}
	IsUnc		0	bool {int}
	m_AbsolutePath	"//<my appKey>?client=js&version=1.9.3&protocol=5"
	m_Flags		0	int
	m_host		""	string
	m_hostNameType	0	System.UriHostNameType {int}
	m_isAbsoluteUri	true	bool
	m_isUnc	false	bool
	m_OriginalUriString	"ws://<my appKey>?client=js&version=1.9.3&protocol=5"
	m_port		-1	int
	m_scheme	"ws"
	OriginalString	"ws://<my appKey>?client=js&version=1.9.3&protocol=5"
	Port	-1	int
	Scheme		"ws"

I understand you need “ws://” but what happens when you change it to “http://” just as a short check… maybe a limitation or bug in Uri(…)

Yes, it works correctly with http.

I assume it only works for http or https. Would be a suggestion for MF 4.3

I created a new Issue on Codeplex:

Hi @ Andre.m - Yes, I understand that it is part of the core, and needs to be implemented by Microsoft in NETMF. I haven’t looked at 4.3. Do you know if it is implemented in that release?

For now, I will implement my own version.

@ andre.m - I ended up doing as you suggested. I copied the Uri class from codeplex to my project, put it in a new namespace, renamed it, and made the necessary modifications. It works great!