I’m a firm believer in the mantra “When all else fails, read the instructions.” For most items, I just get stuck into what I need to do and figure out the details on the way. This is what I did when I started using VS2010 beta 2. I have never used a beta 1 product before, and I’m usually hesitant to try out beta 2 products, but I wasted no time with VS2008 and VS2010 because of the huge potential they carry.
As soon as my installation was done I opened Visual Studio and started to write some code. This was cool. I then unpacked the samples to see how some of the new things were done, and then finally I started to apply some of the new techniques to some applications that I already have.
One thing I tried this morning on Windows 7 was to add a jump list to my app. I wanted to add two tasks, and a recent file list. Piece of cake; to be exact, piece of cake without the flour to bake the cake with in the first place. After finding the namespace in Object Browser, I started playing around with the various classes to make the application work but there was no feedback; no jump list, no crash, no error message, Nothing (or null in C#). So I added a handler for JumpItemsRejected event.
The first bit of luck I got was a message telling me that there is no registered handler when I tried to add a JumpPath object. I figured this is because the file type used by my application hasn’t been registered on Windows so I associated this with my program by using Open With in Windows Explorer and tried again; then the weirdness began. I got the same message from my code, there is no registered handler. Meanwhile, I right clicked the task bar button and lo and behold, my JumpPath was right there.
I ran the code again, and again, and again, and again. But this time there was no joy, in place of the JumpPath, I got the message box. I changed the code multiple times to see if anything would change. But the definition of insanity is trying the same thing over and over again, without a Catch block. At this point, I mounted the VS2010 iso and installed the documentation for the first time. When that was done I searched for JumpList and got 33 results which helped me not one bit. It was the same info as what you would find in the Object Browser, no example code. So I went back to the insanity.
I added a task to the JumpList and that worked, only the JumpPath was rejected. All this was in a sample application that opens a .csv file, and the task was calling the same app with an argument of ”-doNothing”. The code in the startup procedure checks for an argument and displays it in a message box,or loads as normal if there is no command line argument. I invoked the task and take a wild guess what I got! The jump list with the JumpPath included.
It’s a conspiracy I tell you. It didn’t take me long to get to the bottom of it, the program that was registered to handle the file type is Jump.exe, the build result. The program that was running when I pressed F5 in the IDE is Jump.vshost32.exe (I am on Windows 7 64 bit). After spending a large part of the morning trying to get rid of the error in my code, I discovered that there wasn’t one; how annoying.
I don’t know if this is a known issue, it it isn’t then it is an unknown issue isn’t it. But I think the documentation for the final version should tell us that you should run the registered application for a Jump path from Windows Explorer or run without debugging from the IDE . This of course is assuming that the application you are writing has been registered with Windows for the file type you want. And something else for my wish list, give us some samples please. This isn’t an issue big enough that we have to try to figure out ourselves in the morning before heading to the office.
If you want to see the VS2010 code for creating Jump Lists, click here. Remember to register the .code file type before running this code (see the sample.code file inside the solution for instructions). Or better yet, run it without registering and have fun trying to figure out what went wrong. Happy coding.