As you might have noticed, in V1.0 and V1.1 System.Uri is MarshalByRef… Some of you noticed this and thought it was odd, as did I because MarshalByRef is suppose to be only for types that encapsulate external resources that need to be shared across AppDomains. 

 

Well, you will be happy to hear we fixed this in Whidbey.  Although technically a breaking change, we don’t believe this will actually break any applications as it would have been hard to take advantage of the MarshalByRef properties of System.Uri.  Lance Olson, who owns System.Uri told me we made this change for a couple of reasons:

 

1)       Security – Uri is immutable and yet if you could pass it by ref then there is the potential for it to be changed by the caller without the callee knowing.

2)       Performance – MBRObj implied a significant performance (~100%) hit to System.Uri with no functional benefit.

 

 

I hope that satisfies your curiosity and helps you make a better choice about what to make MarshalByRef.