6/19/2010

06-19-10 - NiftyP4 and Timeout

I've fiddled with the NiftyP4 code and have it almost working perfectly for my needs (thanks Jim!). One small niggle remains :

When I lose my net connection from home to work, VC will still hang longer than I'd like. This appears to be comming from the P4 command. The problem is that P4 hangs, and that Nifty waits on P4. Those issues in more detail :

P4 stalls way too long when it can't connect to the server. So far as I can tell there is no way to set this timeout variable in P4 (??). (net searching is a bit hard because Perforce does have a timeout variable, but that is for controlling how long client login sessions on the server last before they are reset). I'd like to set this timeout to like 1 second, currently it's 10 seconds or something. I basically either have a fast connection or not, the long timeout is never right.

Nifty stalls on P4. This is so that when you do something like "save all", it gets notication of the VC command and can check out any necessary files before VC tries to save them. So it runs the P4 command and waits before returning to let VC do its save.

So my hack solution for the moment is to make Nifty only wait for 500 millis for the P4 command and just return if it isn't done by then. This will then give you a "file is not writeable" popup error kind of thing and saves you from the horrible stalled out DevStudio.

BTW some notes for working on addins :

The easiest way to find the names of VC commands seems to be from Keyboard mapping. It appears that they are basically not documented at all. If you can't get it too hookup from the Keyboard mapping command name, your next best option is to trap *every* command and log its name, then go into VC and do the things you want to find the name for and see what comes out of your logs. (see links below)

Disabling an addin from the Tools->Addins menu does not actually unload it (sadly). You have to close VC and restart it to make it unload so that you can update the DLL.

The easiest way to debug an addin is just to make a .AddIn file in "C:\Users\you\Documents\Visual Studio 2005\Addins" and point it at the DLL that you build from your AddIn project. Then you can set up F5 in your AddIn project to run devenv. That way you debug the devenv session that loads your AddIn and you can set breakpoints etc.

See also :

Using EnableVSIPLogging to identify menus and commands with VS 2005 + SP1 - Dr. eX's Blog - Site Home - MSDN Blogs
Source Checkout - niftyplugins - Project Hosting on Google Code
Resources about Visual Studio .NET extensibility
Many Visual studio events missing from Events.SolutionEvents
HOWTO Getting Project and ProjectItem events from a Visual Studio .NET add-in.
HOWTO Capturing commands events from Visual Studio .NET add-ins
Binding to Visual Studio internal Commands from add-in

1 comment:

cbloom said...

Yeah okay this is mostly the bomb. It does cause the occasional annoyance when the server is slow for whatever reason, but that is minor and easily fixed. I prefer to have my devstudio not lock up.

old rants