I am trying to create ER for a document library, eg http://server.com/sites/dev

I wanted to monitor document library for add and remove item.

I created Empty SharePoint 2013 project ( Not sandboxed) and added an ER. Added breakpoint in ItemAdded event. Run F5 no success Attached worker process ( all of them , I see 3), no success. There is no if condition inside by break point( verified) I even tried to create log file, no success, seem ER itself not working :( Copied .pdb files to GAC - no success Made feature manually Activate, after attaching no success.

As of now, I have no option left

3 Answers 3


Clean up everything from the site collection down. Use SharePoint manager and ensure that the event receiver is being attached to the library. Most probably, it is not being properly attached and therefore never even executing. PS: Ensure that the .DLL files are being copied to GAC. If it's not being attached to the library, you can try for example to attach the event receiver to a content type, and create a list of that content type AFTER attaching. Make sure you update the list and so on afterwards and finally attach the debugger. You can then try to activate the feature manually.

Also try using tools such as CKS Dev, right click on your project which contains the event receiver assemblies and select "Attach to all IIS worker processes". This attaches to all w3wp.exe processes and sometimes works when start doesn't.

EDIT: Instead of CKS Dev, which works only half of the time and is slow (since it attaches to all w3wp.exe processes instead of just the SharePoint app pools), here's this script which I made that I've had lots of success with:

# ---------------------------------------------------------
# Read Arguments from Visual Studio & Setting Configuration

$SolutionDir = "C:\SolutionPath\" 
$Namespace = "..." #$TargetName
$GACUtilPath = "C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools\gacutil.exe"

# ----------------------------------

$webURL = "http://portal.app.local/" #Web app URL for warmup.


echo "Installing DLLs in GAC..."
echo "*************************************************"
echo ""

echo "Installing DLL..."
Start-Process -NoNewWindow -Wait -FilePath $GACUtilPath -ArgumentList "/i `"$SolutionDir\ProjectName\bin\debug\dllName.dll`""
echo "...ready!"
echo ""

function PrintSPWorker()
    $worker =  C:\windows\system32\inetsrv\appcmd list wp
    $worker.Split("`r`n") | % {
        if ($_.contains("SharePoint")){
            write-host Please attach to PID: $_ -ForegroundColor Green

C:\windows\system32\inetsrv\appcmd recycle apppool "SharePoint App Pool"
start-sleep 2 #Wait for the app pool to start.

write-host "Warming up..."
for ($i =0; $i -lt 5; $i++)
    $r = Invoke-WebRequest -URI $webURL -UseDefaultCredentials
write-host "Done."

$date = Get-Date

write-host "Finished at $date" 

Most likely, you are not attaching to the correct process. If you are activating the feature via PowerShell, you need to Attach to PowerShell Process.

  • 1
    I think you've misunderstood the question. Your answer would have worked for Feature Receiver debugging context.
    – Tom
    Jun 13, 2014 at 21:27

You are probably not in the Debug configuration.
You can check by Rt clicking the Solution in the Solution Explorer, select "Properties". Opening Solution Properties

Then check the Configuration dropdown. Change it "Debug" and click "OK" Setting Debug Configuration

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.