Search code examples
.netvisual-studio-2012portable-class-library

VS2012 Object Browser shows members that I can't access


Using the Object Browser in Visual Studio I'm trying to find a way to capture the default proxy settings for the host machine, in a portable library.

That's a long shot, I know. Not all platforms will have such a concept, so such an API probably doesn't exist in the portable library, however I can't understand why the Object Browser shows me the static property WebRequest.DefaultWebProxy because I can't use it in code, its not there.

My Object Browser

You can see I've limited the search to the .NET Portable Subset.

What am I misunderstanding?


Solution

  • When you select an assembly in that list then you can see where it came from:

    C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETPortable\v4.5

    Which is the "home directory" for the PCL reference assemblies. But that's not where the buck stops. There are a large number of subdirectories in the Profile and v4.0\Profile directories that have directories with a name like "Profilexxx" where xxx is a number. They contain substitute reference assemblies that contain the available classes in the specific set of targets you selected when you created the project. In effect they'll remove classes that are not supported in one of the targets you selected.

    The flaw in Object Browser is that it is not aware of those substitutes and doesn't know which specific profile you selected. It only sees the reference assemblies in the home directory. Presumably a //TODO somewhere in the VS source code.