Friday, November 13, 2009

SPSite.Exists leaks SPSites

The Sharepoint Object Model is a painful, leak-prone API to work with. Roger Lamb's MSDN blog article is a great reference for deciding when you need to dispose of objects and when doing so will break things, but it's necessity is pretty powerful evidence of how clunky disposal is implemented in this managed code API.

In dev testing, QA found an issue where SPWeb objects were being leaked left and right. It turned out some disposable objects (like SPLimitedWebPartManager) themselves contained disposable objects you had to account for (LimitedWPM's Web).

Today, I ran into another case with a very minimal set of code I had changed. A quick look in Reflector revealed that as of SP2, even Microsoft can't always remember when to dispose of objects. The static method SPSite.Exists instantiates a new SPSite object that needs to be disposed of. However, there is no disposal code in the method. There's no way to work around this issue other than not calling SPSite.Exists. Luckily, no other code in the object model seems to call SPSite.Exists.

Sunday, August 23, 2009

Don't use generic domain names

Ever since I started on my newest client's project over a year ago, I've had problems with their VPN. When connected, I could no longer authenticate to remote Sharepoint or SQL servers on my local network (rending my VMs useless), name resolution would be fine for awhile and then stop resolving (making it a race to sync up source code with their server before I could no longer see it), group policies failed to update... anything that could go wrong seemed to on a very regular basis.

When visiting the client's site last year, I found that I could not log into my laptop with my domain's credentials while plugged into their network. It became a game of turn off the wireless, log in to my laptop, turn wireless back on. We eventually figured out that my domain name (the nice and generic DEV/dev.local) was conflicting with their DEV domain. While plugged into their network, my laptop would suddenly send login requests to their DEV domain controllers. The same thing happened when connected through VPN, causing SQL and Sharepoint to believe a hijack attempt was underway.

Over a year later, I finally got around to renaming the domain to a less generic BLUEYDEV/blueydev.local and suddenly everything works. I can finally work connected to VPN and source control rather than trying to sync everything up as quick as possible when connecting.

The moral of the story: When setting up your domain, never give them generic names that others might use, like DEV or TEST. This is especially important for laptops that you may be connecting to customers' networks.

Monday, May 25, 2009

Windows 7 Homegroup issue finding the homegroup

Windows 7 Homegroup does not play nice with bridged adapters. If you are bridging your wired NIC to a wireless NIC (in our case, for the Xbox to talk to our wireless network), you can start a Homegroup and others will be able to see it but they will encounter errors trying to join it. Likewise, if someone else has created the Homegroup, you will see it but not be able to join it from the bridged PC. Taking both adapters off of the bridge and then deleting the Network Bridge adapter resolved the issue for me.

That said, Homegroup is SIMPLE and it WORKS. If we want to watch a show on our office computers but the file is downstairs on the TV pc, we can just browse to the file in our Homegroup and watch it. The people who say it's just as easy to set up SMB shares haven't gone through the painful process of walking Mom & Pop through sharing each folder/setting permissions/creating user accounts/opening firewall ports.

Monday, April 13, 2009

Windows 7 and Win2k8 power management issues

More recent builds of Windows 7 have resolved the sleep issue on Lappy. We've also thrown 7 on the Media PC downstairs. The eye candy looks very crisp on a nice large TV. Bundled codecs meant we did not need to download K-Lite to watch any of our ripped AVI files. It also detected our wireless mouse's media keys out-of-the-box and is able to wake up from sleep when when push one, something we were missing before. Media Center can FINALLY use the timeline to move to a specific spot in AVI files that don't contain an index track. This always stopped us from using Media Center over Windows Explorer/WMP. The feature changes from Vista are small and subtle, but coupled with the performance enhancements, there's enough to warrant an upgrade from Vista.

With Lappy and Media PC sleep issues resolved, I noticed my main Win2k8 development box was no longer sleeping, heating up the office considerably at night. It turns out installing the Hyper-V role disables power management completely, the two are absolutely incompatible. While trying to switch back over to Virtual PC, I found performance of be horrible. The install of Vista under VPC was stuck in the same spot for an hour and a half. Even with all of the Hyper-V services stopped, your parent partition is still virtualized under the hypervisor. After removing the Hyper-V role and rebooting, VPC flew. Win2k8 was sound asleep and the office nice and cool when I walked in this morning.

Tuesday, January 20, 2009

Windows 7 Wake From Sleep issue and workaround

Playing with Windows 7 the last few weeks, I've found that my laptop refused to wake from sleep. The display alternated between not even powering back on and powering on but remaining black with a non-responsive mouse cursor. The only way to recover was to hard-power Lappy off and back on. This seems especially prevalent on Intel 945 chipset displays.

The only workaround I've found for now is to turn off sleeping completely and instead use hibernate. I've had no problems powering back on from hibernate so far, it only takes about 20 seconds to do with Windows 7 on my system, and doesn't drain your battery like sleep does.

The updated Intel 945 driver released today through Windows Update did not fix Wake From Sleep yet. Hopefully it's an issue that will be addressed before RTM.

Saturday, December 13, 2008

Zoom lever on Microsoft Wireless Comfort Keyboard 4000 scrolls in Firefox

I got a new Microsoft Wireless Comfort Keyboard 4000 today and found that the little zoom lever to the left of the qwerty keys caused Firefox to scroll (and backwards, even). There are plenty of articles out there on switching the lever to scroll instead of zoom, but I just wanted to fix the Zoom lever so that it zooms in Firefox. To do so, open your commands.xml file (usually located in C:\Program Files\Microsoft IntelliType Pro) and search for "MozillaUIWindowClass".

You should see two lines for for C319 and C320 immediately following the MozillaUIWindowClass line. Replace those two lines with:
<C319 Type="5" KeySeq="ctrl add" />
<C320 Type="5" KeySeq="ctrl subtract" />

The reference to "1.5" in the AppName property of can be safely ignore. I tested this fix with Firefox 3.0.4 and IntelliType Pro 6.2.

Restart your itype.exe process or just log out and back in/restart your PC. The Zoom lever should work in Firefox now.

Sunday, September 7, 2008

Trying out ANTS Profiler 4

I got an email that ANTS Profile 4 was released, so I downloaded my upgrade and poked around with it this weekend. I haven't given a good look at the new features list, but the performance improvements are very apparent when profiling. There is still some degradation of your app performance when profiling, but nothing at all like it used to be. I no longer feel like I'm suffering through horrible performance for the sake of finding my issue.

The other big-money change is nice calltree/methodgraph with the shiny "Call Graph" that brings you right to the line of code in the Line-Level Timings view. I love interactive + pretty! Native support to export to PDF and PNG too. This is either a new feature or something that's just been made much more discoverable, because I would have killed to have this in 3.x when debugging memory issues.


It's very much worth doling out dollars for.