your code is fine, ViewBag is having a Dynamic Properties, and in Runtime all the properties are being assigned.
This Exception is a common CLR Exception.. Try doing the Following steps it will work I hope.
Open Visual Studio
- Debug –> Exceptions –> (Uncheck) Common Language Runtime Exceptions
if still problems occures
- Tools –> Options –> Debugging(Expand) –> General –> (Check) Enable Just My Code
hope it helps, its working for me
Click Here for Detailed Images