Don't debug an unmanaged application

Since most of the world is .NET these days, its my tendency to think I can find everything using SOS. Recently, I was attempting to debug a Windows service (Office SharePoint Server Search), and mentally thought “Well, its SharePoint, which is nothing more than a large .NET application, do its .NET as well.” After opening Windbg, and trying to load SOS, I got the following error:

“Failed to find runtime DLL (mscorwks.dll), 0x80004005
Extension commands need mscorwks.dll in order to have something to do.”

This perplexed me until I realized I was trying to debug an application that is not managed. To prove this, I ran the “lmvm mscorwks” command to see if mscorwks.dll was loaded. It wasn’t.

Sharepoint Crawler: "Access is denied"

Ensure the crawl account has Read access to the web application you wish to crawl. Open Central Admin -> Application Management –> Application Security section –> Policy for Web Application. Add the default crawl user here for All Zones for each web application you want to crawl. Be sure to specify the correct web application.

(Note: Find the default content access account in your SSP under Search –> Search Settings.)

Tracking .NET Out-Of-Memory errors

Add the following registry key:

Value name: GCFailFastOnOOM
Value type: REG_DWORD
Value data: 4

The value of “4” writes an event message that includes the size of the allocation that failed and the number of bytes in use. A value of “1” simply logs an event in the Application event log. A value of “2” allows a debugger to be attached.

Use the “4” option to grab a dump, then examine the dump for severe fragmentation of the heap, or an attempt to allocate a huge object.

Debugging a different version of .NET runtime

Copy the mscorwks.dll from the machine that has a different .NET version (than the version running on your debugging desktop) to the C:temp directory. Rename the file with the name “mscordacwks” and the version of .NET framework it came from, like this: mscordacwks_2.0.50727.1433.63.dll

In WinDBG, issue the following command: cdb -z c:tempmscordacwks_2.0.50727.1433.63.dll

Unicode HTML space character

Use one of the following for a space: %u1160 or %u0020, for example: