Thursday, March 01, 2001 ..:: Home ::.. Register  Login
   TechTidBits (Blog)  

VS08 showing private constructors via intellisense? WTF?

Jun 1

Written by:
Monday, June 01, 2009 9:12 PM  RssIcon

Believe it or not (cause I can't!) I have a project at work where I can some how get VS08 to show a private constructor via code intellisense.  Don't believe me, check it out!

This is a VERY weird situation I can't seem to repro at home.  Maybe it's a VS08-XP combo thing but I haven't seen this before and nor should I!  VS08 at work is giving me/allowing me to select via code intellisense the ability to pick a private constructor!  I kid you not!  Now, don't get me wrong, the CLR DOES generate a compile error, so there's little/no chance of a bug getting released.  But it just strikes me as being VERY odd that VS' intellisense gives me the private constructor option to select!

Don't believe me, here's my code for my class, there are two constructors, a private empty constructor (trying to force people to use the other one) and a public constructor taking some parameters of specific types (isn't that what operator/constructor overloading is meant for? haha).

Class that has constructor code, one private and one public

Now, when I goto use my class declared above, check out what VS shows me!  TWO overloaded constructors, VS08 even TELLS me the ///<summary> tag information (which I put a blurb in there about it being that way on purpose).

Why can I see the private constructor via intellisense?

Here's what VS08 SHOULD give me, or at least IMHO what it should be showing me (minus the 2 of 2 selector for the overloaded method haha)

Public constructor which I expected to see

I've created a sample project to try to isolate/test this out but things are working perfectly here at home on my dev box here (VS08 with Windows7).  Maybe you're seeing this as well?  If you are, PUHLEASE leave a comment to help me realize I'm NOT alone and having to cut back on coffee!

There!  Now that's off my chest, it's time to go get a coffee and get back to coding!



Source Code:

Location: Blogs Parent Separator TechTidBits

Your name:
Gravatar Preview
Your email:
(Optional) Email used only to show Gravatar.
Your website:
Add Comment   Cancel 
Copyright 1999-2012 by   Terms Of Use  Privacy Statement