Visual Studio gives error but live coding not

As i mentioned in the header, in visual studio i keep getting error while building my code but live code does not give any error.
Here is my code

And live coding log

Can anyone help, thanks