Thursday, December 11, 2008

Twas the Night Before a Corrupted Windows Profile

Score: Windows Profile: 2, Gordon: 3.

Twas the night before a corrupted Windows profile and all through the workplace,
Elves come to your computer, random things to erase.
I arose from my bed and arrived there the next day,
And stuck my laptop on the docking station (in the usual way).

When what to my wondering eyes should appear,
AC power was on, yet no other features were here.
I tried to undock it. I thought that was the trick.
But nothing seemed to happen after the mouse click.

I thought to myself, "this thing just needs a good reboot".
"Windows is shutting down" disappeared, but the mouse screen stayed. Oh shoot.
"If you won't shut down, then we'll have to do this the hard way."
I held down the button till the screen went away.

I started it back up, and everything was just fine.
It found the AC power and all the other hardware of mine.
Now I could work. I was cruising in style.
Except now, "Windows cannot locate your roaming profile."

So it logged me in under that evil TEMP account
(the one that always erases whenever you log out).
Redoing my settings I can handle just fine,
But now I'm eternally stuck to use TEMP every time.

It said something about a file name being too long.
Well, last time I logged in, no such thing had gone wrong.
I logged out and in, then rebooted once more...
Nothing changed --I even tried System Restore.

Of course the "Undo Last Restore" failed. Microsoft is that elf.
I just laughed when I saw it, in spite of myself.
I moved lots of long-named files out of My Documents to the C: drive,
I logged out and back in, and then my profile was alive!

It took a while to log in, so I ran a Disk Cleanup and Defrag.
It seems to be better. There's not so much lag.
But I heard the elf exclaim ere he drove out of sight,
"255-character-long profile filenames to all, or you're picking a fight!"

Thank you.

Although WinXP supports much longer filenames, the profile manager has trouble with filenames over 255 characters long. I also noticed that it doesn't like non-ASCII filenames. For example, I had a file named "かんしゃさい.doc". I had also tried copying the corrupted profile to a new local account, and this file along with the long-named ones refused to be copied. After renaming the non-ASCII one and moving the long-named ones (I didn't want to rename) out of My Documents\Visual Studio 2005\Projects\ into a new folder C:\Projects, everything worked just fine.

There are other good resources out there for this problem, too. I recommend:
http://forums.microsoft.com/WindowsToolsandUtilities/ShowPost.aspx?PostID=3947666&SiteID=69

Friday, December 5, 2008

Error CS0117: '<MyClass>' does not contain a definition for 'Profile'

I discovered another bad idea: creating a member variable named 'Context' in a web page class (or any class that inherits System.Web.UI.Control). I happened to make this mistake in a MasterPage class.

If you do, you should receive a love letter or two from the compiler much like mine:
'MyNamespace.MyClass' does not contain a definition for 'Profile'
...and/or:
'MyNamespace.MyClass' does not contain a definition for 'ApplicationInstance'.

You'll also find this warning:
'MyPageClass.Context' hides inherited member 'System.Web.UI.Control.Context'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword.

Here's the list of other member names you may only envy when building classes that inherit the Control class:
http://msdn.microsoft.com/en-us/library/system.web.ui.control_members.aspx

Monday, December 1, 2008

Error CS0570 '<propertyname>' is not supported by the language

I ran into this error today and was able to resolve it. Hopefully I can save someone else some trouble.

In a solution, I have a web project in C# that references a C# project called BusinessComponents. I had replaced some .dll files in the BusinessComponents project with newer versions without updating the references. Then, I tried to access a new property called PseudoFamily in the dlls from the web project. It exploded, saying:
'MSU.Radiology.CIS.ServiceLayer.FamilyManager.PseudoFamily' is not supported by the language

...and I found a message in VS's Output pane that said (I shortened it a bit):
Reference to type '...PseudoFamily' claims it is defined in 'c:\...BusinessLogic.DLL', but it could not be found.

Removing and re-adding the references from the BusinessComponents project to the .dll files fixed the issue.

(I should have guessed... in following with Microsoft's long tradition of 'restart to fix it')