Print Story Top Secret Fubar
By wiredog (Tue Nov 16, 2010 at 12:49:32 PM EST) Visual Studio 2008, c#, IntelliBorked (all tags)


>>Burn Before Reading<<

Working on an ASP.Net web app for $FederalLawEnforcementOrganization.

Add a new control defined in class ClassName (ClassName.ascx and ClassName.ascx.cs files).

The path is: c:\..\Project\WebuserControls\ControlType

The namespace is Project.WebUserControls.ControlType

Throughout the project I call "Project.WebUserControls.ControlType.ClassName.SomeMethod();" When I compile I get error "CS0234 The type or namespace name 'Project.WebUserControls.ControlType' does not exist in the class or namespace 'Project.WebUserControls' (are you missing an assembly reference?)" even though it most certainly does exist in that namespace. Also, Intellisense can't find the namespace, or anything in it.

After much googling about I find this at StackOverflow, which leads to a solution.
In web.config:
... <namespaces> .... <add namespace="Project.WebUserControls" />

Intellisense is still borked, but the project now compiles.

Interestingly, if I replace "namespace="Project.WebUserControls" with namespace="Project.WebUserControls.ControlType" it won't compile.

Anyone else seen this? Or have any idea why it happens?
And right after I post this, the fix stops working... What. The. Fuck?
Fixed? Moved ClassName.ascx.cs and .ascx from c:\..\Project\WebUserControls\ControlType to c:\..\Project\WebuserControls\ and similarly from namespace Project.WebUserControls.ControlType to Project.WebUserControls

No idea why this would fix it.

Update [2010-11-18 12:58:2 by wiredog]: Turns out that, while c# and .net allow static methods, those methods don't reliably work in asp component classes.
Top Secret Fubar | 16 comments (16 topical, 0 hidden)
Security through obscurity I see by georgeha (2.00 / 0) #1 Tue Nov 16, 2010 at 01:09:53 PM EST

Someday I'm gonna put that on a cover sheet. by wiredog (2.00 / 0) #2 Tue Nov 16, 2010 at 01:12:24 PM EST
Actually, none of this is truly classified.... But it is Law Enforcement Sensitive.

Mainly I'm diarizing this as a placeholder for when we figure out wtf is going on, so I can put the answer here.

Earth First!
(We can strip mine the rest later.)

[ Parent ]
Oh man that is crazy by duxup (2.00 / 0) #3 Tue Nov 16, 2010 at 01:16:49 PM EST
It might be more weird if I knew what any of that meant.  In any way :o

The crazy part is... by wiredog (2.00 / 0) #4 Tue Nov 16, 2010 at 01:29:06 PM EST
It can't find the fully qualified namespace. It's as if your bash shell couldn't find a directory when given the full path. A "/usr/bin does not exist!" type of thing...

Earth First!
(We can strip mine the rest later.)

[ Parent ]
I believe by sasquatchan (2.00 / 0) #10 Tue Nov 16, 2010 at 01:44:01 PM EST
your idea of a namespace is corrupted. It's slightly different between languages.

[ Parent ]
I've seen something similar by hulver (2.00 / 0) #5 Tue Nov 16, 2010 at 01:33:08 PM EST
I got something similar when I got used a class name that was already used by something else. I think it was something like usercontrol. I wouldn't be surprised if webconyrol was a reserved word.
Cheese is not a hat. - clock
I hope you don't rely on Intellisense. by muchagecko (2.00 / 0) #6 Tue Nov 16, 2010 at 01:33:22 PM EST
I thought it was great at first and bitched about how bad the help was in Flash.

But I'm glad I don't rely on anything like Intellisense. Stupid Visual Studio.

I hope you come up with a solution. Definitely post when you do.

A purpose gives you a reason to wake up every morning.
So a purpose is like a box of powdered donut holes?
My Name is Earl

I'm not familiar with Visual Studio by houser2112 (2.00 / 0) #15 Wed Nov 17, 2010 at 07:39:14 AM EST
But I've found that when context sensitive help doesn't give you what you're looking for in an IDE, chances are you're missing something.  It's not a good idea to rely solely on it, as opposed to actually learning whatever API you're using, but it's a good indicator of wrongness.

[ Parent ]
One quick thing by Dr Thrustgood (2.00 / 0) #7 Tue Nov 16, 2010 at 01:34:45 PM EST
Make sure you've done a full Clean Solution first - easy to forget in the heat of the moment, and that's when things get borked. Also, double-check where the compile error's happening, and triple-check that the project in question is referencing the project with the control in it.

Then turn everything on and off again...

Done that... by wiredog (2.00 / 0) #9 Tue Nov 16, 2010 at 01:42:49 PM EST
Several times... Which fixes it once. Then it starts falling over again.

Earth First!
(We can strip mine the rest later.)

[ Parent ]
Ouch by Dr Thrustgood (2.00 / 0) #13 Tue Nov 16, 2010 at 02:20:26 PM EST
I know what you're going through, not fun.

I'd double check that there aren't any funky warnings in the compile logs that are being hidden by your VS settings - sometimes warnings are hidden right when you need them most.

That and crazy version number shite getting in the way. Make sure that VS isn't overwriting your new DLL with an old copy somewhere down the line.

[ Parent ]
yeah, ran into that by sasquatchan (2.00 / 0) #8 Tue Nov 16, 2010 at 01:42:12 PM EST
but long since whacked the code associated with it.. Though I recall it was run-time related, not compile time related..

Short answer based on half-assed guessing: web security.. You're adding a web control that isn't part of the standard. Thus you have to enable it.

Hey, look I found it..

        <add tagPrefix="MY PREFIX" assembly="MY_ASSEMBLY" namespace="MY.NAME.SPACE">

Yeah, it's how you tell IIS where to find (specifically) the definition of the web page control (DLL, prefix name you used in the web page source, and the namespace of the control) since it isn't part of the standard bin.

But this isn't in IIS by wiredog (2.00 / 0) #11 Tue Nov 16, 2010 at 01:48:21 PM EST
It's in the compile. And running in the web server built in to VS2008.

Earth First!
(We can strip mine the rest later.)

[ Parent ]
well by sasquatchan (2.00 / 0) #12 Tue Nov 16, 2010 at 02:05:56 PM EST
aspx pages inside studio, more or less studio's own web server were always flaky.

I rarely had intellisense working, and even then it was hit or miss. Didn't care, so long as it compiled and ran.

We were using a free-sauce password edit class, which meant my web page had a control that wasn't standard, and the web config snippet I posted was how I get it working. Never cared about intellisense. Only cared if it worked. That's how I got it to compile, which is all that mattered to me.

[ Parent ]
First guess: file & path name length by BadDoggie (2.00 / 0) #14 Tue Nov 16, 2010 at 06:20:53 PM EST
Second guess: you didn't disable 8.3 naming.


OMG WE'RE FUCKED! -- duxup ?

Nope... by wiredog (2.00 / 0) #16 Wed Nov 17, 2010 at 07:47:19 AM EST
Dot Not 3.5, 64 bit, Win7, 8.3 naming disabled by default. Path is ~80 chars.

Thinking maybe too many classes/enums/etc?

Earth First!
(We can strip mine the rest later.)

[ Parent ]
Top Secret Fubar | 16 comments (16 topical, 0 hidden)