• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Net framework session03
 

Net framework session03

on

  • 920 views

 

Statistics

Views

Total Views
920
Views on SlideShare
908
Embed Views
12

Actions

Likes
0
Downloads
0
Comments
0

1 Embed 12

http://niitcourseslides.blogspot.in 12

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • Initiate the session by explaining the session objectives. Tell the students that the success of a software solution depends largely on how well its various components have been designed. An effort should be made to ensure that the components of the existing software solution can be reused. This can be done by using frameworks and patterns. You need to elaborate the concept of applying patterns and frameworks by using the case study of BlueSeas Inc. This will help students to relate their programming skills with the actual practices followed in the software industry.
  • Initiate the session by explaining the session objectives. Tell the students that the success of a software solution depends largely on how well its various components have been designed. An effort should be made to ensure that the components of the existing software solution can be reused. This can be done by using frameworks and patterns. You need to elaborate the concept of applying patterns and frameworks by using the case study of BlueSeas Inc. This will help students to relate their programming skills with the actual practices followed in the software industry.
  • Initiate the session by explaining the session objectives. Tell the students that the success of a software solution depends largely on how well its various components have been designed. An effort should be made to ensure that the components of the existing software solution can be reused. This can be done by using frameworks and patterns. You need to elaborate the concept of applying patterns and frameworks by using the case study of BlueSeas Inc. This will help students to relate their programming skills with the actual practices followed in the software industry.
  • Initiate the session by explaining the session objectives. Tell the students that the success of a software solution depends largely on how well its various components have been designed. An effort should be made to ensure that the components of the existing software solution can be reused. This can be done by using frameworks and patterns. You need to elaborate the concept of applying patterns and frameworks by using the case study of BlueSeas Inc. This will help students to relate their programming skills with the actual practices followed in the software industry.
  • Initiate the session by explaining the session objectives. Tell the students that the success of a software solution depends largely on how well its various components have been designed. An effort should be made to ensure that the components of the existing software solution can be reused. This can be done by using frameworks and patterns. You need to elaborate the concept of applying patterns and frameworks by using the case study of BlueSeas Inc. This will help students to relate their programming skills with the actual practices followed in the software industry.
  • Initiate the session by explaining the session objectives. Tell the students that the success of a software solution depends largely on how well its various components have been designed. An effort should be made to ensure that the components of the existing software solution can be reused. This can be done by using frameworks and patterns. You need to elaborate the concept of applying patterns and frameworks by using the case study of BlueSeas Inc. This will help students to relate their programming skills with the actual practices followed in the software industry.
  • Initiate the session by explaining the session objectives. Tell the students that the success of a software solution depends largely on how well its various components have been designed. An effort should be made to ensure that the components of the existing software solution can be reused. This can be done by using frameworks and patterns. You need to elaborate the concept of applying patterns and frameworks by using the case study of BlueSeas Inc. This will help students to relate their programming skills with the actual practices followed in the software industry.
  • Initiate the session by explaining the session objectives. Tell the students that the success of a software solution depends largely on how well its various components have been designed. An effort should be made to ensure that the components of the existing software solution can be reused. This can be done by using frameworks and patterns. You need to elaborate the concept of applying patterns and frameworks by using the case study of BlueSeas Inc. This will help students to relate their programming skills with the actual practices followed in the software industry.
  • Initiate the session by explaining the session objectives. Tell the students that the success of a software solution depends largely on how well its various components have been designed. An effort should be made to ensure that the components of the existing software solution can be reused. This can be done by using frameworks and patterns. You need to elaborate the concept of applying patterns and frameworks by using the case study of BlueSeas Inc. This will help students to relate their programming skills with the actual practices followed in the software industry.
  • Initiate the session by explaining the session objectives. Tell the students that the success of a software solution depends largely on how well its various components have been designed. An effort should be made to ensure that the components of the existing software solution can be reused. This can be done by using frameworks and patterns. You need to elaborate the concept of applying patterns and frameworks by using the case study of BlueSeas Inc. This will help students to relate their programming skills with the actual practices followed in the software industry.
  • Initiate the session by explaining the session objectives. Tell the students that the success of a software solution depends largely on how well its various components have been designed. An effort should be made to ensure that the components of the existing software solution can be reused. This can be done by using frameworks and patterns. You need to elaborate the concept of applying patterns and frameworks by using the case study of BlueSeas Inc. This will help students to relate their programming skills with the actual practices followed in the software industry.
  • Initiate the session by explaining the session objectives. Tell the students that the success of a software solution depends largely on how well its various components have been designed. An effort should be made to ensure that the components of the existing software solution can be reused. This can be done by using frameworks and patterns. You need to elaborate the concept of applying patterns and frameworks by using the case study of BlueSeas Inc. This will help students to relate their programming skills with the actual practices followed in the software industry.
  • Initiate the session by explaining the session objectives. Tell the students that the success of a software solution depends largely on how well its various components have been designed. An effort should be made to ensure that the components of the existing software solution can be reused. This can be done by using frameworks and patterns. You need to elaborate the concept of applying patterns and frameworks by using the case study of BlueSeas Inc. This will help students to relate their programming skills with the actual practices followed in the software industry.
  • Initiate the session by explaining the session objectives. Tell the students that the success of a software solution depends largely on how well its various components have been designed. An effort should be made to ensure that the components of the existing software solution can be reused. This can be done by using frameworks and patterns. You need to elaborate the concept of applying patterns and frameworks by using the case study of BlueSeas Inc. This will help students to relate their programming skills with the actual practices followed in the software industry.
  • Initiate the session by explaining the session objectives. Tell the students that the success of a software solution depends largely on how well its various components have been designed. An effort should be made to ensure that the components of the existing software solution can be reused. This can be done by using frameworks and patterns. You need to elaborate the concept of applying patterns and frameworks by using the case study of BlueSeas Inc. This will help students to relate their programming skills with the actual practices followed in the software industry.
  • Initiate the session by explaining the session objectives. Tell the students that the success of a software solution depends largely on how well its various components have been designed. An effort should be made to ensure that the components of the existing software solution can be reused. This can be done by using frameworks and patterns. You need to elaborate the concept of applying patterns and frameworks by using the case study of BlueSeas Inc. This will help students to relate their programming skills with the actual practices followed in the software industry.
  • Initiate the session by explaining the session objectives. Tell the students that the success of a software solution depends largely on how well its various components have been designed. An effort should be made to ensure that the components of the existing software solution can be reused. This can be done by using frameworks and patterns. You need to elaborate the concept of applying patterns and frameworks by using the case study of BlueSeas Inc. This will help students to relate their programming skills with the actual practices followed in the software industry.
  • Initiate the session by explaining the session objectives. Tell the students that the success of a software solution depends largely on how well its various components have been designed. An effort should be made to ensure that the components of the existing software solution can be reused. This can be done by using frameworks and patterns. You need to elaborate the concept of applying patterns and frameworks by using the case study of BlueSeas Inc. This will help students to relate their programming skills with the actual practices followed in the software industry.
  • Initiate the session by explaining the session objectives. Tell the students that the success of a software solution depends largely on how well its various components have been designed. An effort should be made to ensure that the components of the existing software solution can be reused. This can be done by using frameworks and patterns. You need to elaborate the concept of applying patterns and frameworks by using the case study of BlueSeas Inc. This will help students to relate their programming skills with the actual practices followed in the software industry.
  • Initiate the session by explaining the session objectives. Tell the students that the success of a software solution depends largely on how well its various components have been designed. An effort should be made to ensure that the components of the existing software solution can be reused. This can be done by using frameworks and patterns. You need to elaborate the concept of applying patterns and frameworks by using the case study of BlueSeas Inc. This will help students to relate their programming skills with the actual practices followed in the software industry.
  • Initiate the session by explaining the session objectives. Tell the students that the success of a software solution depends largely on how well its various components have been designed. An effort should be made to ensure that the components of the existing software solution can be reused. This can be done by using frameworks and patterns. You need to elaborate the concept of applying patterns and frameworks by using the case study of BlueSeas Inc. This will help students to relate their programming skills with the actual practices followed in the software industry.
  • Initiate the session by explaining the session objectives. Tell the students that the success of a software solution depends largely on how well its various components have been designed. An effort should be made to ensure that the components of the existing software solution can be reused. This can be done by using frameworks and patterns. You need to elaborate the concept of applying patterns and frameworks by using the case study of BlueSeas Inc. This will help students to relate their programming skills with the actual practices followed in the software industry.
  • Initiate the session by explaining the session objectives. Tell the students that the success of a software solution depends largely on how well its various components have been designed. An effort should be made to ensure that the components of the existing software solution can be reused. This can be done by using frameworks and patterns. You need to elaborate the concept of applying patterns and frameworks by using the case study of BlueSeas Inc. This will help students to relate their programming skills with the actual practices followed in the software industry.
  • Initiate the session by explaining the session objectives. Tell the students that the success of a software solution depends largely on how well its various components have been designed. An effort should be made to ensure that the components of the existing software solution can be reused. This can be done by using frameworks and patterns. You need to elaborate the concept of applying patterns and frameworks by using the case study of BlueSeas Inc. This will help students to relate their programming skills with the actual practices followed in the software industry.
  • Initiate the session by explaining the session objectives. Tell the students that the success of a software solution depends largely on how well its various components have been designed. An effort should be made to ensure that the components of the existing software solution can be reused. This can be done by using frameworks and patterns. You need to elaborate the concept of applying patterns and frameworks by using the case study of BlueSeas Inc. This will help students to relate their programming skills with the actual practices followed in the software industry.
  • Initiate the session by explaining the session objectives. Tell the students that the success of a software solution depends largely on how well its various components have been designed. An effort should be made to ensure that the components of the existing software solution can be reused. This can be done by using frameworks and patterns. You need to elaborate the concept of applying patterns and frameworks by using the case study of BlueSeas Inc. This will help students to relate their programming skills with the actual practices followed in the software industry.
  • Initiate the session by explaining the session objectives. Tell the students that the success of a software solution depends largely on how well its various components have been designed. An effort should be made to ensure that the components of the existing software solution can be reused. This can be done by using frameworks and patterns. You need to elaborate the concept of applying patterns and frameworks by using the case study of BlueSeas Inc. This will help students to relate their programming skills with the actual practices followed in the software industry.
  • Initiate the session by explaining the session objectives. Tell the students that the success of a software solution depends largely on how well its various components have been designed. An effort should be made to ensure that the components of the existing software solution can be reused. This can be done by using frameworks and patterns. You need to elaborate the concept of applying patterns and frameworks by using the case study of BlueSeas Inc. This will help students to relate their programming skills with the actual practices followed in the software industry.
  • Initiate the session by explaining the session objectives. Tell the students that the success of a software solution depends largely on how well its various components have been designed. An effort should be made to ensure that the components of the existing software solution can be reused. This can be done by using frameworks and patterns. You need to elaborate the concept of applying patterns and frameworks by using the case study of BlueSeas Inc. This will help students to relate their programming skills with the actual practices followed in the software industry.
  • Initiate the session by explaining the session objectives. Tell the students that the success of a software solution depends largely on how well its various components have been designed. An effort should be made to ensure that the components of the existing software solution can be reused. This can be done by using frameworks and patterns. You need to elaborate the concept of applying patterns and frameworks by using the case study of BlueSeas Inc. This will help students to relate their programming skills with the actual practices followed in the software industry.
  • Initiate the session by explaining the session objectives. Tell the students that the success of a software solution depends largely on how well its various components have been designed. An effort should be made to ensure that the components of the existing software solution can be reused. This can be done by using frameworks and patterns. You need to elaborate the concept of applying patterns and frameworks by using the case study of BlueSeas Inc. This will help students to relate their programming skills with the actual practices followed in the software industry.
  • Initiate the session by explaining the session objectives. Tell the students that the success of a software solution depends largely on how well its various components have been designed. An effort should be made to ensure that the components of the existing software solution can be reused. This can be done by using frameworks and patterns. You need to elaborate the concept of applying patterns and frameworks by using the case study of BlueSeas Inc. This will help students to relate their programming skills with the actual practices followed in the software industry.
  • Initiate the session by explaining the session objectives. Tell the students that the success of a software solution depends largely on how well its various components have been designed. An effort should be made to ensure that the components of the existing software solution can be reused. This can be done by using frameworks and patterns. You need to elaborate the concept of applying patterns and frameworks by using the case study of BlueSeas Inc. This will help students to relate their programming skills with the actual practices followed in the software industry.
  • Initiate the session by explaining the session objectives. Tell the students that the success of a software solution depends largely on how well its various components have been designed. An effort should be made to ensure that the components of the existing software solution can be reused. This can be done by using frameworks and patterns. You need to elaborate the concept of applying patterns and frameworks by using the case study of BlueSeas Inc. This will help students to relate their programming skills with the actual practices followed in the software industry.
  • Initiate the session by explaining the session objectives. Tell the students that the success of a software solution depends largely on how well its various components have been designed. An effort should be made to ensure that the components of the existing software solution can be reused. This can be done by using frameworks and patterns. You need to elaborate the concept of applying patterns and frameworks by using the case study of BlueSeas Inc. This will help students to relate their programming skills with the actual practices followed in the software industry.
  • Initiate the session by explaining the session objectives. Tell the students that the success of a software solution depends largely on how well its various components have been designed. An effort should be made to ensure that the components of the existing software solution can be reused. This can be done by using frameworks and patterns. You need to elaborate the concept of applying patterns and frameworks by using the case study of BlueSeas Inc. This will help students to relate their programming skills with the actual practices followed in the software industry.
  • Initiate the session by explaining the session objectives. Tell the students that the success of a software solution depends largely on how well its various components have been designed. An effort should be made to ensure that the components of the existing software solution can be reused. This can be done by using frameworks and patterns. You need to elaborate the concept of applying patterns and frameworks by using the case study of BlueSeas Inc. This will help students to relate their programming skills with the actual practices followed in the software industry.
  • Initiate the session by explaining the session objectives. Tell the students that the success of a software solution depends largely on how well its various components have been designed. An effort should be made to ensure that the components of the existing software solution can be reused. This can be done by using frameworks and patterns. You need to elaborate the concept of applying patterns and frameworks by using the case study of BlueSeas Inc. This will help students to relate their programming skills with the actual practices followed in the software industry.

Net framework session03 Net framework session03 Presentation Transcript

  • Core Development with the Microsoft .NET Framework 2.0 FoundationObjectives In this session, you will learn to: • Configure an assembly by using the Configuration, Configuration Element, Configuration Section classes, and configuration base types available in the .NET Framework 2.0 • Perform various installation tasks related to assembly installation • Describe what event logs are and how to manage them • Manage application processes • Monitor and customize application performance • Debug applications by using Visual Studio 2005 • Trace applications by using .NET Framework 2.0 Ver. 1.0 Slide 1 of 38
  • Core Development with the Microsoft .NET Framework 2.0 FoundationConfiguring an Assembly by Using Configuration Types What are Configuration Files? • A configuration file is an XML file that contains specific configuration settings for an application. • When you configure a configuration file for an application, it eliminates the need to recompile the application every time a setting changes. • Configuration files can be of the following types: Web.config App.config Machine.config Ver. 1.0 Slide 2 of 38
  • Core Development with the Microsoft .NET Framework 2.0 FoundationConfiguring an Assembly by Using Configuration Types (Contd.) Access and Manage Configuration Settings You can access and manage the configuration settings of a computer, an application, or resources by using the Configuration class. You need to use the ConfigurationManager class to read the data from a configuration file into an object of the Configuration class. Ver. 1.0 Slide 3 of 38
  • Core Development with the Microsoft .NET Framework 2.0 FoundationConfiguring an Assembly by Using Configuration Types (Contd.) Manage Configuration Elements • A configuration element is an XML tag in a configuration file that contains a string value, attributes, or other child elements. • Configuration elements can be programmatically managed by using the following classes: ConfigurationElement ConfigurationElementCollection ConfigurationElementProperty Ver. 1.0 Slide 4 of 38
  • Core Development with the Microsoft .NET Framework 2.0 FoundationConfiguring an Assembly by Using Configuration Types (Contd.) Manage Sections in Configuration Files • The following configuration section classes can be used to manage sections within the configuration files: ConfigurationSection: Adds a custom section to the configuration file. ConfigurationSectionCollection: Reads all the configuration sections in a configuration file. ConfigurationSectionGroup: Represents a group of related configuration sections in a configuration file. ConfigurationSectionGroupCollection: Represents a collection of ConfigurationSectionGroup objects. Ver. 1.0 Slide 5 of 38
  • Core Development with the Microsoft .NET Framework 2.0 FoundationConfiguring an Assembly by Using Configuration Types (Contd.) Create a Custom Type to Validate Configuration Values • It is important that the configuration values in the configuration file are valid in type as well as in range. • You can implement the following interfaces to programmatically access application settings, specific sections within a configuration file: IConfigurationSectionHandler ISettingsProviderService IApplicationSettingsProvider Ver. 1.0 Slide 6 of 38
  • Core Development with the Microsoft .NET Framework 2.0 FoundationPerforming Installation Tasks Configure the Run-time Version of .Net Framework You need to configure the runtime version on the computer to execute the applications created in the .NET Framework. To define the runtime version, you can use the supportedRuntime and compatibilityversion elements in the configuration file of the corresponding application. Bootstrapping is the process of installing and configuring the CLR by using various deployment tools. Ver. 1.0 Slide 7 of 38
  • Core Development with the Microsoft .NET Framework 2.0 FoundationPerforming Installation Tasks (Contd.) Configure the Location, Version, and Search Path of an Assembly You should configure the location and version of all the assemblies you reference in your application so that the CLR is able to locate the assemblies easily. You can either use mscorcfg.msc or codebase and probing element to configure assemblies. Ver. 1.0 Slide 8 of 38
  • Core Development with the Microsoft .NET Framework 2.0 FoundationPerforming Installation Tasks (Contd.) Configuring an Application by Using Mscorcfg.msc Mscocrfg.msc allows you to manage and configure assemblies in the global assembly cache, adjust code access security policy, and perform remoting services. You can run this utility at the command prompt. You can also access this utility from Start Menu, Control Panel, Administrative Tools, Microsoft .NET Framework 2.0 Configuration. You can configure applications using mscocrfg.msc under administrator control. Ver. 1.0 Slide 9 of 38
  • Core Development with the Microsoft .NET Framework 2.0 FoundationPerforming Installation Tasks (Contd.) Configure Concurrent Garbage Collection Garbage collection is a feature provided by the .NET Framework to automatically manage the allocation and release of memory for the managed objects in an application. Garbage collector can be configured in the following modes: Concurrent mode: In this mode, the garbage collector runs in a process space that is different from the default domain of the assembly. As a result, the execution of assembly does not have to pause for garbage collection. Non-Concurrent mode: In this mode, garbage collection happens on the same thread as the thread running user code. Ver. 1.0 Slide 10 of 38
  • Core Development with the Microsoft .NET Framework 2.0 FoundationPerforming Installation Tasks (Contd.) Register Remote Objects by Using Configuration Files You can use the configuration files for registering remote assemblies. This eliminates the need for recompiling the code. The remote assemblies communicate with each other through channels. Channels are objects that transport messages between applications across remoting boundaries. Ver. 1.0 Slide 11 of 38
  • Core Development with the Microsoft .NET Framework 2.0 FoundationJust a minute What is bootstrapping? Answer The process of installing and configuring the CLR by using deployment tools is called bootstrapping. Ver. 1.0 Slide 12 of 38
  • Core Development with the Microsoft .NET Framework 2.0 FoundationManaging an Event Log What are Event Logs? • Event logs are similar to a catalog where you can store entries for particular activities and actions that occur within your application. • Windows maintains the following types of event logs: • System Event Log: Logs information that takes place on system level hardware. • Security Event Log: Logs security level events. • Application Log: Contains events logged by applications or programs. • Event logs can be viewed programmatically by using the EventLog class. • EventLogPermission class allows you to specify code access security permissions for event logs. Ver. 1.0 Slide 13 of 38
  • Core Development with the Microsoft .NET Framework 2.0 FoundationManaging an Event Log (Contd.) The following code example demonstrates the creation of a custom event log and a custom event source: class MyEventLog { public static void Main() { //Create the source, if it does not already exist. if (!EventLog.SourceExists("MySource")) { EventLog.CreateEventSource("MySource","MyNewLog"); Console.WriteLine("CreatingEventSource"); } //Create an EventLog instance and assign its source. EventLog myLog = new EventLog(); myLog.Source = "MySource"; myLog.WriteEntry("Writing to event log."); } } Ver. 1.0 Slide 14 of 38
  • Core Development with the Microsoft .NET Framework 2.0 FoundationManaging an Event Log (Contd.) How Entries Are Read and Written in an Event Log? The EventLog class can be used to read and write entries in existing logs. The properties of the EventLog class are: Log MachineName Entries Source WriteEvent WriteEntry Ver. 1.0 Slide 15 of 38
  • Core Development with the Microsoft .NET Framework 2.0 FoundationJust a minute How do you write to an event log? Answer The EventLog class provides properties Source, WriteEvent, and WriteEntry that are used to write entries to an existing event log. Ver. 1.0 Slide 16 of 38
  • Core Development with the Microsoft .NET Framework 2.0 FoundationWorking with Application Processes How a List of All Running Processes Is Retrieved? • The GetProcesses method of the Process class is used to retrieve the list of all the processes running on the computer. • It returns an array that lists all the running processes. How Information About the Current Process Is Retrieved? The GetCurrentProcess method of the Process class is used to retrieve information about the current process. How a List of All Modules Used by a Process Is Retrieved? The Process class provides the Modules method that can be used to retrieve a list of all the modules used by a process. Ver. 1.0 Slide 17 of 38
  • Core Development with the Microsoft .NET Framework 2.0 FoundationWorking with Application Processes (Contd.) How an Application Process Is Started and Stopped? The Start method is used to start a process. The Kill method stops the specified process immediately. It releases the resources allocated to the process. Ver. 1.0 Slide 18 of 38
  • Core Development with the Microsoft .NET Framework 2.0 FoundationManaging Application Performance Monitoring Application Performance by Using the Performance Monitor In Windows 2000 and Windows XP, the Performance Monitor is used to examine the performance of your applications. The System Monitor in the Performance Monitor is used to monitor the execution of processes. Each monitored resource in the Performance Monitor is called a performance object. Each performance object has certain performance counters associated with it. Ver. 1.0 Slide 19 of 38
  • Core Development with the Microsoft .NET Framework 2.0 FoundationManaging Application Performance (Contd.) How Performance Information Is Customized by Using Performance Counter Classes? The System.Diagnostics namespace provides several classes that can be used to create custom performance counters. The important classes are: PerformanceCounter: Evaluates feedback from existing counters. PerformanceCounterCategory: Creates or removes custom categories. CounterCreationData: Creates multiple counters in a category and specifies their types. Ver. 1.0 Slide 20 of 38
  • Core Development with the Microsoft .NET Framework 2.0 FoundationDebugging Applications What is Debugging? • The process of finding and correcting the defects in a block of code is called debugging. • Debugging helps you resolve several kinds of errors. These errors can be divided into the following types: • Syntax error • Run-time error • Logic error • The Microsoft CLR Debugger is run to debug an application. • The Microsoft CLR Debugger is installed when you install Visual Studio 2005. • It is part of the Visual Studio 2005 Software Development Kit (SDK). Ver. 1.0 Slide 21 of 38
  • Core Development with the Microsoft .NET Framework 2.0 FoundationDebugging Applications (Contd.) How the Debugger Class Is Used to Debug Programmatically? The .NET Framework provides the Debugger class, which helps to launch the Visual Studio 2005 debugger programmatically. The primary methods associated with the Debugger class: Break: This method signals a breakpoint to an attached debugger, with a user breakpoint event. Launch: This method launches a debugger and attaches it to the process. Log: This method posts a message for the attached debugger. Ver. 1.0 Slide 22 of 38
  • Core Development with the Microsoft .NET Framework 2.0 FoundationDebugging Applications (Contd.) The following code sample shows the implementation of the Debugger class: private void BreakInCode() { BooleanSwitch assertSwitch = new BooleanSwitch("BreakOnAssert", ""); if (assertSwitch.Enabled) { if (Debugger.IsAttached) Debugger.Break(); else Debugger.Launch(); } } Ver. 1.0 Slide 23 of 38
  • Core Development with the Microsoft .NET Framework 2.0 FoundationDebugging Applications (Contd.) How the Debug Class Is Used to Debug Programmatically? The Debug class provides a set of methods and properties that help in debugging code. Methods in the Debug class can be used to print debug information. A few primary methods associated with the Debug class: Assert: This method checks a condition. If the condition is false, the method displays a message. WriteLine: This method writes information about the debug to the trace listeners in the Listeners collection. WriteLineIf: This method checks a condition, and if the condition holds true, the method writes information about the debug to the trace listeners in the Listeners collection. Ver. 1.0 Slide 24 of 38
  • Core Development with the Microsoft .NET Framework 2.0 FoundationDebugging Applications (Contd.) How User-Defined Types Are Configured by Using Debugger Attributes? The Debugger attributes are a set of classes that can be used to configure user-defined types in a debugger. How Call Stacks Are Managed by Using the StackFrame and StackTrace Classes? StackFrame Class: Provides information about a stack frame. A stack frame is the physical representation of a function call on the call stack for the current thread. The members of the StackFrame class are: GetFileName method: This method is used to retrieve the name of the file that has provided the code in execution. GetFileLineNumber method: This method is used to retrieve the line number in the file that contains the code currently in execution. Ver. 1.0 Slide 25 of 38
  • Core Development with the Microsoft .NET Framework 2.0 FoundationJust a minute What are the different kinds of errors? Answer The different kinds of errors are syntax errors, runtime errors, and logic errors. Ver. 1.0 Slide 26 of 38
  • Core Development with the Microsoft .NET Framework 2.0 FoundationTracing Applications • What Is Application Tracing? Application tracing refers to monitoring an application and recording information about events as they occur in the application. Trace commands such as Trace.Write, Trace.TraceInformation, Trace.TraceError, Trace.Indent, and Trace.Assert enable a user to trace an application. The .NET Framework provides the System.Web.TraceContext class for a Web environment. For a Windows environment, the .NET Framework provides the System.Diagnostics.Trace and System.Diagnostics.Debug classes. Ver. 1.0 Slide 27 of 38
  • Core Development with the Microsoft .NET Framework 2.0 FoundationTracing Applications (Contd.) • How Applications Are Traced Programmatically by Using the Trace Class? The Trace class provides a set of methods and properties that help you to trace applications programmatically. The members of the Trace class are: Assert WriteIf Fail Write WriteLine WriteLineIf With the help of a configuration file, you can use the Trace class programmatically in a console application to implement tracing. Ver. 1.0 Slide 28 of 38
  • Core Development with the Microsoft .NET Framework 2.0 FoundationTracing Applications (Contd.) • How the Source of Tracing Is Identified by Using the TraceSource Class? The .NET Framework provides the TraceSource class that helps to trace the execution of code and associate trace messages with their source. The members of the TraceSource class are: TraceEvent TraceData TraceInformation Name Switch Listeners With the help of a configuration file, you can configure and implement the TraceSource class. Ver. 1.0 Slide 29 of 38
  • Core Development with the Microsoft .NET Framework 2.0 FoundationTracing Applications (Contd.) You can also implement the TraceSource class by using C# to trace an application and associate trace messages with their source. The following code sample shows the implementation of the TraceSource class: using System; using System.Diagnostics; class Tracetest { static TraceSource tS = new TraceSource("TraceTest"); static void Main(string[] args) { tS.Listeners["console"].TraceOutputOp tions |= TraceOptions.Callstack; tS.TraceEvent(TraceEventType.Warning, 1); } } Ver. 1.0 Slide 30 of 38
  • Core Development with the Microsoft .NET Framework 2.0 FoundationTracing Applications (Contd.) • How the Tracing Output Is Configured by Using Trace Switch Classes? The trace switches are used to activate, deactivate, and filter the tracing output. The two types of trace switch classes are: TraceSwitch BooleanSwitch The configuration file is used to add a switch and define its value, remove a switch, or get rid of all switches set up initially by the application. Ver. 1.0 Slide 31 of 38
  • Core Development with the Microsoft .NET Framework 2.0 FoundationTracing Applications (Contd.) The following code sample shows the implementation of the TraceSwitch class. using System; using System.Diagnostics; class Tracetest { // Create a TraceSwitch to use in the entire application class level declaration private static TraceSwitch appSwitch = new TraceSwitch("mySwitch", "Switch in config file"); Ver. 1.0 Slide 32 of 38
  • Core Development with the Microsoft .NET Framework 2.0 FoundationTracing Applications (Contd.) public static void Main(string[] args) { Console.WriteLine("Trace switch {0} configured as {1}", appSwitch.DisplayName,appSwitch.Level.ToString() ); if (appSwitch.TraceError) { //... } } } Ver. 1.0 Slide 33 of 38
  • Core Development with the Microsoft .NET Framework 2.0 FoundationTracing Applications (Contd.) • How the Tracing Output Is Directed by Using Trace Listener Classes? Trace listeners are objects used to send the trace information to an output location, such as a file, a printer, or the Visual Studio 2005 output window. The various trace listener classes are: TraceListener XmlWriterTraceListener DelimitedListTraceListener EventLogTraceListener The TraceFilter class allows you to filter trace information before sending it to an output location. With the help of a configuration file, you can configure and implement the TraceListener class. Ver. 1.0 Slide 34 of 38
  • Core Development with the Microsoft .NET Framework 2.0 FoundationTracing Applications (Contd.) • How Trace Information Is Categorized by Using the CorrelationManager Class? The CorrelationManager class is used to group and classify trace information for later analysis. It is connected with the Thread class by the CorrelationManager property. The namespace for the CorrelationManager class is System.Diagnostics, and the assembly is System (in System.dll). Ver. 1.0 Slide 35 of 38
  • Core Development with the Microsoft .NET Framework 2.0 FoundationJust a minute What is the TraceSource class? Answer The TraceSource class belongs to the System.Diagnostics namespace and is used to trace the execution of code and associate trace messages with their source. Ver. 1.0 Slide 36 of 38
  • Core Development with the Microsoft .NET Framework 2.0 FoundationSummary • In this session, you learned that: The application configuration file helps specify configuration settings for applications other than Web applications. mscorcfg.msc is a .NET Framework utility that helps configure an application so that the application can use the externally referenced assemblies. Garbage collection is a feature provided by the .NET Framework to automatically manage the allocation and release of memory for the managed objects in an application. Event logs contain entries to record important software and hardware events. An instance of an application under execution is called a process. You need to manage the performance of your application to identify operational issues and optimize performance. Ver. 1.0 Slide 37 of 38
  • Core Development with the Microsoft .NET Framework 2.0 FoundationSummary (Contd.) Debugging helps you ensure that the code provides expected results. You can use tracing to monitor the code and the target points where an application deviates from the normal functioning. Ver. 1.0 Slide 38 of 38