I am having a bizarre problem with screen sharing, but only on one computer, the MacPro.
I am only able to connect when the MacPro is at the login screen. Once connected I can log in to any user and screen sharing works as expected. However, if I try to connect when the computer isn't on the login screen, it just sits forever at the "connecting..." stage.
If I go and switch back to the login screen while it's waiting, then I get a "failed to connect" message, but if I retry then I can connect fine.
Note that it's not necessary to log out. I've got fast user switching on, and it's enough to simply be on the login screen, regardless of how many users are actually logged in.
Two of my computers (MacBook Pro and Mini) work as expected, I can vnc to them at any time and the connection works flawlessly. It's only the MacPro that has this problem.
I've read other threads about deleting the default login identity from the keychain, tried that, didn't seem to make a difference.
As far as I can tell from looking at the preferences pane for sharing, all three computers are set up identically, yet only the Pro won't allow screen sharing to start when not on the login screen.
Answering my own question: turns out I had an old vnc server still hanging around, called OSXvnc. When any used was logged in, it was waiting for vnc connections and failing. Once I thought to look in /var/log/system.log it was pretty obvious.