none
C# Program Control Flow RRS feed

  • Question

  • Hi

    I am new to C#.    I am an SQL DB programmer.

    We have a DB application written in C#, there is no front-end.  Its just backend application.

    Am trying to understand the program flow of this application through debugging by setting breakpoints at various points in the code.   I want to trace where is the starting point of the application, where is its endpoint.   And, how is the program control flowing from start to end.  I want to know how many n-tiered application it is  etc.

    This particular application is NOT multithreaded one.

    What best can be the approach in knowing these requirements?

    thank you

    Friday, July 20, 2018 8:59 PM

All replies

  • Friday, July 20, 2018 9:06 PM
  • Each application has entry point which is defined by startup object. It is determined in project properties in application tab - startup object. It could be any class which has static method with string[] parameters. End point is last comand in this method. But it is true when there is not another background thread. 

    There is difference between layer and tier. To see calling methods you can use Codemap in Visual Studio Enterprise. It is nice tool to show where method is called from, you can see call different assemblies, etc...

    Saturday, July 21, 2018 5:06 PM
  • Hi,

    To learn to debug a project, also please check:

    Tutorial: Learn to debug using Visual Studio

    7 Debugging Techniques you should know in C# .NET

    Regards,

    Stanly

    Note: This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; Therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, July 23, 2018 5:39 AM
  • As you said if application written in c# no front end means it's a console application and every console application there will be only entry point that will be like as shown below.

    static void Main(string[] args)
    {
     
    // your code
    
    }

    You can search for this in your project and it will be your starting of your project. If you want to know complete program flow and want to know each keyword in program then check following article, everything explained in detailed manner.

    https://www.tutlane.com/tutorial/csharp/csharp-hello-world-program-example

    If you want complete tutorial to know about c# programming language, then check this

    C# Tutorial with Examples

    Monday, July 23, 2018 9:11 AM
  • If there is no user interface are you indicating this is a class project that is called/invoked by something else or is this a Windows service? Did you write this or did someone else write this?

    Knowing what type of project this is will dictate how to run through code via the debugger. For instance, with a windows service you would set the following up as per the highlighted code. When the service starts a dialog appears asking to attach Visual Studio which should be open with the project open. Then you can trace through the code.

    When working with breakpoints you should know there are conditional breakpoints so that if you understand them then working with conditions to evaluate can assist in not hitting every single line of code which can become time consuming with little to no gain. 


    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Monday, July 23, 2018 3:23 PM
    Moderator