C# .NET - Need to find errors in source code

Asked By Srinivasan S
03-Feb-12 11:40 AM
How can I find the errors in the given source code?

That is,
 
I want to find the logic error as well as syntax error.

Need some examples....
  [)ia6l0 iii replied to Srinivasan S
03-Feb-12 12:16 PM
The easiest way is to ask what the code does first, and then run the code and cross-verify with its compiled output.

If it is a windows application, you will have an exe and check its functionality. If it is a web application, open the particular page and check its functionality. 

If you have build errors then they are most likely syntax errors. and few exceptions like "DivideByZero" in certain cases will be identified by the compiler at compile time itself. If you don't know where to look for errors, when you compile - go to View menu and choose "Error List". (Keyboard shortcut is CTRL + W,E). If you compile the source code now, you will get the errors listed in a window as shown below.


NNote that the erroneous lines are highlighted, and you can get the line numbers in the error window as well. 

LLogical errors can only be determined by writing unit test cases or by code review. Since, that is a big topic in itself - I wouldn't flood this post. 

Hope this helps.

  kalpana aparnathi replied to Srinivasan S
03-Feb-12 12:33 PM
hi,

Here i am giving you one link for code analysis so please check  it
http://www.jetbrains.com/resharper/features/code_analysis.html
  dipa ahuja replied to Srinivasan S
03-Feb-12 12:35 PM
First make sure your error window is being displayed

If its not then : Click on View Menu then click "Error List" This will display you the error list or result of the building the project

Now Build your project by ► Ctrl + shift + B

Now This will show you all the error list in the "Error List" Window
  Riley K replied to Srinivasan S
03-Feb-12 08:54 PM


If there are syntax errors do you think the code would compile, 

syntax errors are clearly mentioned in the error list??

Coming to logical errors it depends on your logical formula?

Create New Account
help
Export to excel functionality error Hi experts, please help on this The Export functionality for Web takes an error on the response.End(); {Unable to evaluate expression because the code is optimized or a response. OutputStream); } / / - - response.Write(excelXml); response.Flush(); response.End(); / / HttpContext.Current. ApplicationInstance. CompleteRequest(); } and getting error, please help me if u have solution for the same Thanks Vijay HI refer this code. . .for functionality Step 1: Add a button in the aspx page. < asp : Button ID = "btnExport" Text = "Export server" OnClick = "ExportToExcel" / > Step 2: Add below code behind method which will be fired on click of Export button. protected void ExportToExcel( object sender, EventArgs e) { DataTable dt = new DataTable (); dt vbdotnetaddict.blogspot.com / 2011 / 01 / import-excel-table-into-sql-table.html you are gettin error because of this line- response.Write(excelXml); Solution: Make second argument of response.redirect(url
Is there a vbs script to re-enable right-click functionality? C++ / VB x-no-archive:yes Hello Sirs, I am looking for a .vbs script to re-enable right click functionality on a Windows XP box which has been locked not to use the right button Here one More To Do the Same - -- -- -- -- -Copy Below- -- -- -- -- -- -- -- -- -- -- -- set oShell = CreateObject("WScript.Shell") on error resume next oShell.RegWrite "HKCU \ Software \ Microsoft \ Windows \ CurrentVersion \ Policies \ NoViewContextMenu ", "1", "REG_DWORD" if Err devil_himself <DEVIL_HIMSELF. . .@rediffmail.com> Thanx, I have tried that, it does nothing. It gives no error, but it doesn't enable right click. Now I have tried the original script you posted. I understand the nowrap problem and now it gives no error but again no effect. Thanks anyway V. keywords: Is, there, a, vbs, script, to, re
OWA - right click not working Exchange Server Hi, I am using IE7 and the right-click functionality has stopped working following a recent Microsoft Update! When I right-click on a message, the IE status bar shows "Error on page" and the error msg is: "Object does not support this property or method." Any ideas on how to _ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ I managed to resolve the problem by Resetting my IE settings. keywords: OWA, -, right, click, not, working description: Hi, I am using IE7 and the right-click functionality has stopped working following a recent Microsoft Update! When I right-click on a
Office Live - editing functionality error Word Operating System: Mac OS X 10.6 (Snow Leopard) Processor: Intel Thanks for your to use Office Live to collaboratively edit a Word document. Everything works fine until I click on the "edit" button, when I get this error message:"To complete installation of the Office Live Update, close all browser windows and then in-One For Dummies http: / / tinyurl.com / Office-2008-for-Dummies keywords: Office, Live, -, editing, functionality, error description: Operating System: Mac OS X 10.6 (Snow Leopard) Processor: Intel Thanks for your
Start Button Does Not Work Windows 7 I have lost all Left-Click functionality in the Start Button (Far Left Orb on the Task Bar) on my Vista Home Premium system. When I "click" on the button nothing happens. The Right-Click of the Start Button pops up a dialog box that shows (Open, Explore) and nothing do not resolve the problem because I do not have that option when I right-click the Start Button. Every time I boot up I receive the following error message boxes: 1 - (Windows Sidebar) Settings.ini is being used by another process. Close the other program and then click Retry, or click Cancel to exit Sidebar. 2 - (Location is not available) C: \ Windows \ System32 \ config \ systemprofile \ Desktop