Chapter: 3

Embedding configuration, diagnostic, management, and installation features into a .NET Framework application

ApplicationScopedSettingAttribute class

The ApplicationScopedSettingAttribute class is used to specify that an application settings property has a common value for all users of an application. It cannot be inherited.

ConfigurationManager class

The ConfigurationManager class is used to provide access to configuration files for client applications.

Building blocks of .NET Framework

There are three building blocks of .NET Framework, which are as follows:

  1. Common Language Runtime (CLR)
  2. Common Type System (CTS)
  3. Common Language Specification(CLS)
Process.Start

The Process.Start method is used to start a Windows application and is registered in the system registry on a computer.

Demand

The Demand method is used to decide at runtime whether all callers in the call stack have been granted the permission specified by a current permission object by implementing class library.

Application configuration file

An application configuration file is used to install it on a client computer along with an application and ensure that the settings in the application configuration file are applied.

Account property

The Account property is used to specify the security context of the Windows service application. In the Properties window of the Visual Studio .NET Component Designer, you can set the Account property to LocalService, LocalSystem, NetworkService, or User value.

Settings for services

Use the following properties to specify the individual settings for each service in a service database:

  • DisplayName
  • ServiceName
  • ServicesDependOn
  • StartType
Publisher policy configuration file

The Publisher policy configuration file contains compatibility information issued by the publisher of a shared component. It ensures that the latest version of the shared component is used by all applications using the component.

Gacutil.exe

The Global Assembly Cache (Gacutil.exe) tool is used to view and manipulate the contents of the global assembly cache. Microsoft Management Console (MMC) is a Windows utility designed to manage servers and services through a common user interface.

Publisher policy files

Publisher policy files contain compatibility information issued by the publisher of a shared component. These files ensure that the latest version of the shared component is used by all applications using the component.

TypeLoadException

The TypeLoadException exception is thrown when the common language runtime (CLR) is unable to find an assembly or the type within the assembly, or cannot load the type.

Sn.exe

The Strong Name (Sn.exe) tool is used to sign assemblies with strong names. It also provides signature generation, signature verification, and key management.

Binding policy

For deploying shared assemblies, the binding policy that is a set of rules determines the place to search for the assembly and version to bind to the application. The searching process of the CLR involves the following three stages of the binding policy resolution:

  1. Application policy resolution
  2. Publisher policy resolution
  3. Administrator policy resolution
Correct version of an assembly

The following are the steps that determine the correct version of an assembly:

  1. The CLR examines the application configuration file.
  2. It examines the publisher policy file.
  3. It examines the machine configuration file.
Dispose method

Use components that provide services and resources and release the resources explicitly by the components using the Dispose method.

EventLog.Source

The Source property of the EventLog class is used to specify the source name to register and use when writing to the event log.

CreateEventSource

The CreateEventSource method of the EventLog class establishes an application as a valid event source for writing event information to a particular event log on a computer.

Event log

Develop an application to log important information of the application while it is executing and to write message text to the event log.

Debug class

Perform an integration testing for an application and ensure that when the Write() method of the Debug class or the Trace class is called, each time only one entry is added to the event log.

SystemException

The SystemException class throws an exception when an error occurs in an application using the Common Language Runtime (CLR).

Process class

The Process class can be used to print a word document with the help of the Print attribute.

ProcessModule and the ProcessModuleCollection class

The ProcessModule and ProcessModuleCollection classes can be used to get the complete information about modules used in a given application.

Breakpoint

The Breakpoint is used to analyze variables, data records, and other settings in an application.

Data Breakpoint

The Data Breakpoint is used during the execution of an application to change the value of the variables defined in the application.

Cordbg.exe

The Runtime Debugger (Cordbg.exe) is a tool that provides command-line debugging services.

Locals window

The Locals window is a debugging window and its contents change to reflect only the variables applicable to the current procedure. Global variables and variables in other projects are not accessible from the Locals window.

Write method

The Write method of the Debug class displays messages and writes variable values to the Output window, when an application is either stopped or paused.

Immediate mode

The Immediate mode of the Command window is used for debugging .NET applications. This mode evaluates expressions, executes command statements, and prints values of variables defined in the application code.

Print method

The Print method of the Debug class can be used to display a message with a line terminator in the trace listeners collection.

Trace switch

Trace switch is an object that exists in the application code that allows filtering information. It allows enabling, disabling, and filtering of output in an application.

Output debugging window

The Output debugging window is used to display status messages at runtime. Its content is cleared each time the application is compiled or run.

Call Stack debugging window

The Call Stack debugging window displays a list of currently active procedure calls during break mode.

Client-activated .NET Remoting object

A client-activated .NET Remoting object is created to ensure that an object logs error and warning messages to a log file and Windows application log.

Watch window

The Watch window is used to see the values of variables within different scopes, i.e., module level, procedure level, and global variables.

Assert

The Assert method of the Trace class is used to check for a condition and displays a message if the condition is false.

Cordbg.exe

The Cordbg.exe tool is used to debug the application from a command prompt. It provides command-line debugging services. It also helps to find and fix bugs in programs that target the .NET Framework common language runtime.

Call Stack debugging window

The Call Stack debugging window is used for viewing the list of currently active procedure calls.

Log method

The Log method of the Debugger class writes tracing and debugging messages that are displayed in the output window of the IDE.

TraceSwitch class

Use the TraceSwitch class within a code and whenever the code uses Trace logging, it consults with the TraceSwitch level to verify whether or not to log information.

Query property

The Query property of the ManagementEventWatcher class is used to get or set the criteria to apply to events.

Management class

The Management class is used to represent a Common Information Model (CIM) management class. It is a WMI class such as Win32_LogicalDisk and Win32_Process.

AuthenticationLevel enumeration

Use the Unchanged member of the AuthenticationLevel enumeration to specify that the authentication level should remain the same as before.

base

The base keyword can be used when a subclass needs to refer to its immediate baseclass.

Share
Tagged with:
 

Leave a Reply