I was trying to attach the process to my web part code, i was getting above error.
Solution:
In the Visual Studio
Click on Tools
Options
Debugging
Options
Unchecked: "Enable Just My Code"
Solution:
In the Visual Studio
Click on Tools
Options
Debugging
Options
Unchecked: "Enable Just My Code"