I have a website I am working on that I code/test on my local PC then copy to a production server.
Today I opened the web site on the production server and was surprised to see that visual studio catches several errors in my code that it does not catch when I build the project on the web server running on my local PC. For example, VS caught this error on the production server:
if(Session["FileID"] != "0")
file = SuiteFiles.GetFile(int.Parse(Session["FileID"].ToString()));
On the prod server I get a warning that says : Possible unintended reference comparison; to get a value comparison, cast the left hand side to type 'string'. This warning is very helpful - as you can see I am missing .ToString() on the Session reference. When I open this same file and build the web site on my local pc, I get no warning. How do I fix that?
I looked around VS a bit and found a setting under Tools->Options->Debugging->General. The options are: "Enable property evaluation and other implicit function calls", and "Call toString() on objects in variables windows (C# only). Both these are checked and toggling them appeared to make no difference (which is expected - I am using the same copy of VS to open prod/local). The web config files on local/production are approximately the same. PC is running XP, IIS 5, prod server is running IIS 5 also.
Thanks