I too came across this issue in different scenarios so to overcome this issue in my case i did a post back to the page so that it executes the same set of code next time and then it worked fine. I am not sure in which context ur executing that lines of code. Myne is a webcontrol thats placed in master page.

Thanks for the suggestions and comments on the above post..Well I sorted out the error after some tedious work.Actually it was a permission issue..I dont had permsion to assign the permission for a specific document library or List...

Go4Sharepoint, is a Microsoft Featured Community.
Microsoft, Windows, Sharepoint, Sharepoint logo, Windows logo, etc are trademarks of the Microsoft Corporation.
All product names, logos, copyrights, and trademarks mentioned are acknowledged as the registered intellectual property of their respective owners. This site is not in any way affiliated with, nor has it been authorized, sponsored, or otherwise approved by, Microsoft Corporation.