I came across a problem where I was no longer able to program the AVR after enabling the debugwire. When debugging the software on your microcontroller, make sure to always stop the debugging session the correct way so that the debugwire fuse bit gets disabled. When you don’t do this you will lock yourself out of the chip and will no longer be able to read/write the devices signature or fuses.
If you have locked yourself out try the following. I have tried it with the AVR dragon and the JTAGICE mkII programmers using Atmel Studio 6.1
1: Hook back into the debugging session by opening a project and start debugging.
2: In the menu select Debug->Disable debugwire and close
You should now be able to read the device signature again!