.NET Tuning, Debugging, and Optimization

Size: px
Start display at page:

Download ".NET Tuning, Debugging, and Optimization"

Transcription

1 .NET Tuning, Debugging, and Optimization Robert J. Oberg Student Guide Revision Object Innovations Course 404

2 .NET Tuning, Debugging, and Optimization Rev Student Guide Information in this document is subject to change without notice. Companies, names and data used in examples herein are fictitious unless otherwise noted. No part of this document may be reproduced or transmitted in any form or by any means, electronic or mechanical, for any purpose, without the express written permission of Object Innovations. Product and company names mentioned herein are the trademarks or registered trademarks of their respective owners. Copyright 2004 Object Innovations, Inc. All rights reserved. Object Innovations, Inc Printed in the United States of America. Rev Copyright 2004 Object Innovations, Inc. ii

3 Table of Contents (Overview) Chapter 1 Chapter 2 Chapter 3 Chapter 4 Chapter 5 Chapter 6 Chapter 7 Chapter 8 Chapter 9 Chapter 10 Chapter 11 Overview of.net Debuggers Error and Exception Handling Debugging and Tracing Debugging Web Forms Applications Debugging Web Services More About Tracing Fundamentals of Optimization Application Profiling Optimizing ASP.NET Applications and Web Services Remote Debugging Tuning Appendix A Appendix B Mixed-Mode Debugging Learning Resources Rev Copyright 2004 Object Innovations, Inc. iii

4 Rev Copyright 2004 Object Innovations, Inc. iv

5 Table of Contents (Detailed) Chapter 1 Overview of.net Debuggers...1 Compile-Time Errors...3 Compile-Time Demo...4 Runtime Errors...5 Debugging...6.NET Debuggers...7 Bytes Sample Program...8 Project Configurations...9 Release Configuration...10 Creating a New Configuration...11 Setting Build Settings for a Configuration...12 Customizing a Toolbar...13 Using the Visual Studio Debugger...14 Just-in-Time Debugging...15 Standard Debugging -- Breakpoints...16 Standard Debugging -- Watch Variables...17 Debugger Options...18 Stepping with the Debugger...19 Demo: Stepping with the Debugger...20 The Call Stack...21 Program Debug Database...22 Dumping a.pdb File...23 Lab 1A...24 Microsoft CLR Debugger...25 Using DbgCLR...26 Lab 1B...28 Runtime Debugger CorDbg...29 CorDbg Documentation...30 Using CorDbg...31 Lab 1C (Optional)...32 JIT Debugging in Windows Apps...33 Configuration File...34 Debugged Version of WinBytes...36 Summary...37 Chapter 2 Error and Exception Handling...43 Exceptions...45 Exception Example...46 Checked Integer Arithmetic...47 Throwing New Exceptions...48 finally...49 Exceptions Dialog Box...50 Exceptions Dialog Box Demo...51 Rev Copyright 2004 Object Innovations, Inc. v

6 $exception Pseudovariable...53 A Specific Exception...54 A Different Exception...55 A User Defined Exception...56 Exceptions List...57 Exception Handling Best Practices...58 Avoid Unnecessary Exceptions...59 Lab Summary...61 Chapter 3 Debugging and Tracing...65 Attaching to Processes...67 Order Application...68 JIT Debugging: Review...70 Attaching to Processes...72 Processes Dialog...73 Attach to Process Dialog...74 Debugging Multiple Processes...75 Lab 3A...76 Tracing...77 Instrumenting an Application...78 Debug and Trace Classes...79 Tracing Example...80 Viewing Trace Output...81 Debug Statements...82 Debug Output...83 Assert...84 More Debug Output...85 WriteLine Syntax...86 Lab 3B...87 Event Logs...88 Viewing Event Logs...89 Event Log Entry Types...90.NET EventLog Component...91 Quick EventLog Demo...92 Full-Blown EventLog Demo...94 Retrieving Entries from an Event Log...95 DisplayEventLog Sample Program...96 Handling EventLog Events...97 Lab 3C...98 Debugging a Class Library...99 Summary Chapter 4 Debugging Web Forms Applications Web Application Fundamentals Setting up the Web Examples Creating a Virtual Directory Rev Copyright 2004 Object Innovations, Inc. vi

7 Debugging ASP.NET Applications Using Visual Studio Configuring Web Server Connection Configuring a Web Application Calculator Example Debugging Calculator Application-Level Tracing Tracing Calculator Using the Page Cache Page-Level Tracing Tracing the Calculator Page Conditional Tracing Trace Category Trace Warning Exceptions in Trace An ASP.NET Page Without VS Attaching to VS Debugger Preparing to Debug Class Libraries and ASP.NET Web Factorial Program Using an Event Log Event Logs and ASP.NET Lab 4A Debugging Client-Side Scripts Enabling Script Debugging Client-Side Script Breakpoints Client-Side Script Example Lab 4B Summary Chapter 5 Debugging Web Services Web Services Created Using Visual Studio Hello World Web Service Debugging Hello World Configuring for Debugging Attaching a Debugger A Web Service Without Code Behind Debugging Without Code Behind Factorial Web Service Debugging Factorial Web Service State in Web Services XML and Web Services The Art of Debugging Web Services Web Services Security Web Services Debugging Demo Configuration Error Configuring as an Application Rev Copyright 2004 Object Innovations, Inc. vii

8 A Simple Project That Works Web Services Debugging Demo II Web Service Clients Demo: A Web Service Client HTTP Headers Lab 5A Lab 5B Summary Chapter 6 More About Tracing Trace Switches BooleanSwitch Sample Program Using a Configuration File TraceSwitch SwitchDemo Trace Listeners DefaultTraceListener Listener Example Program A Stream Listener A Custom Listener Trace Output to a Window An Event Log Listener Tracing in the Order Application Trace Output Lab Summary Chapter 7 Fundamentals of Optimization Compiler Optimization Optimization Ramifications Optimized Code in the Debugger Performance Measurements Measurement Example Repeated Measurements Comparative Results Optimizing Data Structures and Algorithms Order Example Generating Random Input Data Comparing Data Structures : Array Comparing Data Structures : Hashtable Analyzing Order Simulation A New Set of Parameters Saved Parameters A Single Order Hashtable vs. Array Coding with a Hashtable Rev Copyright 2004 Object Innovations, Inc. viii

9 Iterating a Hashtable Responsive User Interfaces Multithreading Thread Class Starting the Thread Best Practices Lab Summary Chapter 8 Application Profiling Profiling an Application Instrumenting an Application Instrumentation Example Instrumentation Walkthrough Implementation Code Using Performance Counters Performance Counters Performance Monitor Custom Performance Counters Performance Counters in.net Performance Counters in VS.NET Performance Counter Demo Garbage Collection Processor Performance Counters Custom Performance Counters PerfWrite Example Program CounterCreationData PerformanceCounterCategory Writing to Performance Counters PerformanceCounterType Displaying Categories and Counters CLR Profiling CLR Profiling Architecture DevPartner Profiler Profiler Output Lab Summary Chapter 9 Optimizing ASP.NET Applications and Web Services What is Caching? Caching in ASP.NET Output OutputCache Directive Output Cache Example Storing Product Lists Fetching a Product List ASP.NET Performance Counters Rev Copyright 2004 Object Innovations, Inc. ix

10 Custom Performance Counters Creating the Categories Creating the Counters Using the Performance Counters Security Considerations Viewing the Performance Counters Application Center Test Using ACT Testing Web Services Calculator Web Service Creating Performance Counters Calculator Driver Sample Test Run Sample Run Using ACT Best Practices Lab Summary Chapter 10 Remote Debugging Remote Debugging Setup Remote Debugging Permissions Remote Debugging Demo Running Locally Debugging Remotely Debugging Remote Web Apps OrderWeb Demo Deploying a Web Application Using Project Copy Project Remote Debugging Demo Debugging Remote Web Services Lab Summary Chapter 11 Tuning Configuration Files Multi-level Configuration Application Settings Programmatic Access to Configuration Files Application Settings Example Configuration File and Visual Studio Performance Tuning Tuning Overview The Tuning Cycle Lab 11A Tuning ASP.NET Applications Configuration Files in ASP.NET Configuring Session State Rev Copyright 2004 Object Innovations, Inc. x

11 Mode Attribute Other Attributes Session State Demo Lab 11B Summary Appendix A Mixed-Mode Debugging What Is Mixed-Mode Debugging? Configuring Mixed-Mode Debugging Demo: Debugging a COM Component Summary Appendix B Learning Resources Rev Copyright 2004 Object Innovations, Inc. xi

12 Rev Copyright 2004 Object Innovations, Inc. xii

13 .NET Tuning, Debugging and Optimization NetDbg Chapter 1 Chapter 1 Overview of.net Debuggers Rev Copyright 2004 Object Innovations, Inc. 1

14 .NET Tuning, Debugging and Optimization NetDbg Chapter 1 Overview of.net Debuggers Objectives After completing this unit you will be able to: Discuss the role of compile-time errors and runtime errors in program development. Configure Visual Studio.NET for debug, release and special builds. Use the Visual Studio.NET debugger, including features such single step, breakpoints, and examining variables. Use the Windows-based Microsoft CLR debugger for.net applications when you have the.net Framework SDK but not Visual Studio. Use the command-line CorDbg debugger to debug managed code and to examine runtime characteristics of your.net program. Rev Copyright 2004 Object Innovations, Inc. 2

15 .NET Tuning, Debugging and Optimization NetDbg Chapter 1 Compile-Time Errors Compile-time errors can be detected by the compiler as part of building the program. Modern strongly-typed languages, such as C#, enable many errors to be caught at compile-time. As an example of an error we would like to have caught at compile-time, consider this C program: See Chap01\CompileTimeVc6 or Chap01\CompileTimeVc7. /* CompileTime.c */ #include <stdio.h> int main() { char* onetwothree = "123"; int number = (int) onetwothree; printf("number = %d\n", number); } If you build this using VC6, you will get no errors and no warnings! (In VC7 you will at least get a warning.) Compiling... CompileTime.c Linking... CompileTimeC.exe - 0 error(s), 0 warning(s) But if you run it, you get nonsensical data (treating a pointer as an integer): number = Rev Copyright 2004 Object Innovations, Inc. 3

16 .NET Tuning, Debugging and Optimization NetDbg Chapter 1 Compile-Time Demo As a simple demonstration of compile-time errors, consider a similar program in C#. See Demos\CompileTime. using System; class CompileTime { static void Main(string[] args) { string onetwothree = "123"; int number = (int) onetwothree; Console.WriteLine("number = {1:F2}", number); } } The compiler will generate an error message, pinpointing the location of the error. compiletime.cs(10,17): error CS0030: Cannot convert type 'string' to 'int' Comment out the line with the error and do the conversion in the proper way with the Convert class. string onetwothree = "123"; //int number = (int) onetwothree; int number = Convert.ToInt32(onetwothree); Console.WriteLine("number = {1:F2}", number); Now you will get a clean compile. Ship it, right? Rev Copyright 2004 Object Innovations, Inc. 4

17 .NET Tuning, Debugging and Optimization NetDbg Chapter 1 Runtime Errors If you run this program, you encounter a runtime error: Unhandled Exception: System.FormatException: Index (zero based) must be greater than or equal to zero and less than the size of the argument list. at System.Text.StringBuilder.AppendFormat( IFormatProvider provider, String format, Object[] args) at System.String.Format(IFormatProvider provider, String format, Object[] args) at System.IO.TextWriter.WriteLine(String format, Object arg0) at System.IO.SyncTextWriter.WriteLine(String format, Object arg0) at System.Console.WriteLine(String format, Object arg0) at CompileTime.Main(String[] args) in c:\oic\netdbg\chap01\compiletime\step1\ compiletime.cs:line 12 In this case, an exception was thrown, and the location of the error is pinpointed. Here is the fix, with the erroneous lines commented out. string onetwothree = "123"; //int number = (int) onetwothree; int number = Convert.ToInt32(onetwothree); //Console.WriteLine("number = {1:F2}", number); Console.WriteLine("number = {0:F2}", number); Final program is in Chap01\CompileTime\Step2. Rev Copyright 2004 Object Innovations, Inc. 5

18 .NET Tuning, Debugging and Optimization NetDbg Chapter 1 Debugging Run-time errors are typically referred to as bugs, and debugging is the art of finding and eliminating such errors in your code. This course is concerned with debugging in the.net environment, including in complex scenarios involving multiple computers and Web protocols. But erroneous functional behavior is not the only kind of problem that may appear in software. Software may fail to scale and behave improperly under heavy loads. Software may give correct results, but have unacceptably slow performance. Software may have defects that cause it to lack security. We will examine a number of techniques to help us build robust software in the.net environment. These include: Tracing program behavior Profiling programs to reveal hotspots, enabling optimizations to be performed during development Tuning deployed programs to enhance program performance. Rev Copyright 2004 Object Innovations, Inc. 6

19 .NET Tuning, Debugging and Optimization NetDbg Chapter 1.NET Debuggers There are three main debuggers supplied with.net. The built-in Visual Studio.NET debugger, that is part of the Visual Studio IDE. The Microsoft CLR debugger, which is a Windows-based debugger that can be used for programs developed with the.net Framework SDK. Its look and feel is similar to VS.NET, but has somewhat fewer features. The low-level, command-line debugger CorDbg. In this chapter we will look at all three of these debuggers. In order to use any of them, you must compile your project with a Debug configuration. Rev Copyright 2004 Object Innovations, Inc. 7

20 .NET Tuning, Debugging and Optimization NetDbg Chapter 1 Bytes Sample Program To illustrate debugging, we will use another very simple example. See Demos\Bytes. This version of the program is also saved in Chap01\Bytes\Step1Debug. class Bytes { public static void Main(String[] args) { int kilo = 1024; int mega = kilo * kilo; int giga = kilo * mega; int tera = kilo * giga; Console.WriteLine("kilo = {0} bytes", kilo); Console.WriteLine("mega = {0} bytes", mega); Console.WriteLine("giga = {0} bytes", giga); Console.WriteLine("tera = {0} bytes", tera); } } The output is a little strange: kilo = 1024 bytes mega = bytes giga = bytes tera = 0 bytes Rev Copyright 2004 Object Innovations, Inc. 8

21 .NET Tuning, Debugging and Optimization NetDbg Chapter 1 Project Configurations A project configuration specifies build settings for a project. Every project in a Visual Studio solution has two default configurations, Debug and Release. By default, a Visual Studio projects builds with the Debug configuration. You can choose the configuration from the main toolbar or use the menu Build Configuration Manager, which will bring up the Configuration Manager dialog (shown below). Rev Copyright 2004 Object Innovations, Inc. 9

22 .NET Tuning, Debugging and Optimization NetDbg Chapter 1 Release Configuration After your program has been debugged, you will normally want to build your program with a Release configuration. A Release configuration by default performs a number of optimizations to make your code more efficient. We will discuss optimization later in the course. When building with Release configuration, there will be no symbol information created (in a.pdb file), and you will not be able to use the debuggers for symbolic debugging. To make sure that your configuration setting persists, don t delete the.suo file of your project. As an example of a program that is built with a Release configuration, open the solution at Chap01\Bytes\Step1Release. Rev Copyright 2004 Object Innovations, Inc. 10

23 .NET Tuning, Debugging and Optimization NetDbg Chapter 1 Creating a New Configuration Sometimes it is useful to create additional configurations, which can save alternate build settings. As an example, let s create a configuration for a checked build. (The /checked+ compiler switch turns on runtime checking of integer overflow.) 1. Bring up the Configuration Manager dialog. 2. From the Active Solution Configuration: dropdown, choose <New...>. The New Solution Configuration dialog will come up. 3. Type CheckedDebug as the configuration name. Choose Copy Settings from Debug. Check Also create new project configuration(s) (see below). Click OK. Rev Copyright 2004 Object Innovations, Inc. 11

24 .NET Tuning, Debugging and Optimization NetDbg Chapter 1 Setting Build Settings for a Configuration Next, we will set the build settings for the new configuration. Check the toolbar to verify that the new CheckedDebug is the currently-active configuration. 1. Right-click over Bytes in the Solution Explorer and choose Properties. The Bytes Property Pages dialog comes up. 2. In Configuration Properties, select Build. Change the setting for Check for Overflow/Underflow to True (see below). Click OK. Rev Copyright 2004 Object Innovations, Inc. 12

25 .NET Tuning, Debugging and Optimization NetDbg Chapter 1 Customizing a Toolbar To make it convenient to exercise a program without the debugger, we will add the "Start Without Debugging" command (a red exclamation point) to the Debug toolbar. 1. Select menu Tools Customize Select the Commands tab. 3. In Categories, select Debug. In Commands, select Start Without Debugging. 4. Drag the selected command onto the Debug toolbar, positioning it next to the wedge shaped Start button. 5. Close the Customize dialog. Rev Copyright 2004 Object Innovations, Inc. 13

26 .NET Tuning, Debugging and Optimization NetDbg Chapter 1 Using the Visual Studio Debugger To be able to benefit from debugging at the source code level, you should have built your executable using a Debug configuration, as discussed previously. There are three ways to enter the debugger: Just-in-Time Debugging. You run normally and, if an exception occurs, you will be allowed to enter the debugger. The program has crashed, so you will not be able to run further from here to single step, set breakpoints, and so on. But you will be able to see the value of variables, and the point at which the program failed. Standard Debugging. You start the program under the debugger. You may set breakpoints, single step, and so on. Attach to a running process. You start the program normally, and then from Visual Studio you attach to it. We will discuss this approach in Chapter 3. Rev Copyright 2004 Object Innovations, Inc. 14

27 .NET Tuning, Debugging and Optimization NetDbg Chapter 1 Just-in-Time Debugging Build and run (without debugging) the Bytes program from the previous section, making sure to use the CheckedDebug configuration. This time, the program will not run through smoothly to completion, but an exception will be thrown. A Just-In-Time Debugging dialog will be shown (see below). Click Yes to debug. Rev Copyright 2004 Object Innovations, Inc. 15

28 .NET Tuning, Debugging and Optimization NetDbg Chapter 1 Standard Debugging -- Breakpoints The way you typically perform standard debugging is to set a breakpoint and then run, using the debugger. The easiest way to set a breakpoint is by clicking in the gray bar to the left of the source code window. You can also set the cursor on the desired line and click the hand toolbar button to toggle a breakpoint (set if not set, and remove if a breakpoint is set). If you want to remove all breakpoints, you can use the menu Debug Clear All Breakpoints, or you can use the toolbar button A yellow arrow over the red dot of the breakpoint shows where the breakpoint has been hit. Rev Copyright 2004 Object Innovations, Inc. 16

29 .NET Tuning, Debugging and Optimization NetDbg Chapter 1 Standard Debugging -- Watch Variables The easiest way to inspect the value of a variable is to slide the mouse over the variable you are interested in, and the value will be shown as a yellow tool tip. You can also right-click over a variable and choose Quick Watch (or use the eyeglass toolbar button ). This illustration shows a typical Quick Watch window. When you are stopped in the debugger, you can add a variable to the Watch window by right-clicking over it and choosing Add Watch. Rev Copyright 2004 Object Innovations, Inc. 17

30 .NET Tuning, Debugging and Optimization NetDbg Chapter 1 Debugger Options You can change debugger options from the menu Tools Options, and select Debugging from the list. Here we specify the hexadecimal display, which was used in the Watch window on the preceding page. Rev Copyright 2004 Object Innovations, Inc. 18

31 .NET Tuning, Debugging and Optimization NetDbg Chapter 1 Stepping with the Debugger When you are stopped in the debugger, you can step through instructions, either one at a time or by set amounts. There are a number of single step buttons. The most common are (in the order shown on the toolbar): Step Into Step Over Step Out There is also a Run to Cursor button. This special checked configuration of the program is saved in Chap01\Bytes\Step1Checked. To make sure that the current configuration is saved, don t delete the file Bytes.suo. Rev Copyright 2004 Object Innovations, Inc. 19

32 .NET Tuning, Debugging and Optimization NetDbg Chapter 1 Demo: Stepping with the Debugger Build the Chap01\Bytes\Step2 project. Multiplication by 1024 has been replaced by a function call. (Also, the long data type is used, resolving the integer overflow problem.) Set a breakpoint at the first function call, start the program ( ), and then Step Into ( ). Note that there is a red dot at the breakpoint and a yellow arrow in the function. Rev Copyright 2004 Object Innovations, Inc. 20

33 .NET Tuning, Debugging and Optimization NetDbg Chapter 1 The Call Stack When debugging, Visual Studio maintains a Call Stack. In our simple example, the Call Stack is just two calls deep. Note that the call stack also shows the language. In.NET it is quite possible to implement mixed-language program, and a called method may be in a different language from the calling method. Rev Copyright 2004 Object Innovations, Inc. 21

34 .NET Tuning, Debugging and Optimization NetDbg Chapter 1 Program Debug Database What allows you to perform source-level debugging is a program debug database that is created when you build with debugging enabled. This database is stored in a file with the extension.pdb, created in the same directory as the.exe file. This file contains symbol table and source line number information allowing debuggers to debug symbolically. Microsoft does not publish the format of the.pdb file, because it may frequently change. Instead it provides a COM API, the Debug Interface Access or DIA. An SDK is provided for using this API. Rev Copyright 2004 Object Innovations, Inc. 22

35 .NET Tuning, Debugging and Optimization NetDbg Chapter 1 Dumping a.pdb File The DIA SDK provides a sample program dia2dump.exe that allows you to dump the contents of a.pdb file. As an example, here is a dump of bytes.pdb from the Step 2 of the Bytes example. >dia2dump bytes.pdb Found table: Symbols sym name: bytes sym name: Bytes sym name: COM+_Entry_Point (COM+_Entry_Point) sym name: Main line 15 at 0x1:0x0 found line 15 at 0x1:0x0 line 16 at 0x1:0x7 line 17 at 0x1:0xe line 18 at 0x1:0x15 line 19 at 0x1:0x1c line 20 at 0x1:0x2c line 21 at 0x1:0x3c line 22 at 0x1:0x4c line 23 at 0x1:0x5c sym name: sym name: System sym name: kilo sym name: mega sym name: giga sym name: tera sym name: OneK line 26 at 0x1:0x5d found line 26 at 0x1:0x5d line 27 at 0x1:0x68... Rev Copyright 2004 Object Innovations, Inc. 23

36 .NET Tuning, Debugging and Optimization NetDbg Chapter 1 Lab 1A Debugging Using Visual Studio In this lab you will use Visual Studio to debug a simple application. Since you should already have basic experience with the Visual Studio debugger, only general instructions will be given. It will be up to you to figure out the problem(s)! This lab is intended to review some aspects of C# and the.net Framework, as well as the Visual Studio debugger. Detailed instructions are contained in the Lab 1A write-up at the end of the chapter. Suggested time: 30 minutes. Rev Copyright 2004 Object Innovations, Inc. 24

37 .NET Tuning, Debugging and Optimization NetDbg Chapter 1 Microsoft CLR Debugger The Microsoft CLR Debugger is a Windows-based tool designed for debugging applications compiled for the common language runtime. It has some limitations compared with the Visual Studio debugger. The practical reason for using the Microsoft CLR Debugger is to debug an application developed using the.net Framework SDK when you don t have Visual Studio. You can actually use Visual Studio to debug an application that was built using the SDK, as we shall see in Chapter 3. Some of the limitations of the Microsoft CLR Debugger include: No support for debugging Win32 native code applications. Remote debugging is not implemented. Register information is not provided. There is no F1 help. You start the Microsoft CLR Debugger by running DbgCLR.exe, which is in the GuiDebug directory of your.net SDK installation. Rev Copyright 2004 Object Innovations, Inc. 25

38 .NET Tuning, Debugging and Optimization NetDbg Chapter 1 Using DbgCLR As an example of using DbgCLR.exe, let s debug an SDK version of the Bytes program. See Chap01\Bytes\Step1Sdk. Be sure to use the Visual Studio 2003.NET command prompt. Compile at the command-line, using csc. Be sure to compile with the /debug option. csc /debug bytes.cs Now start DbgCLR.exe from the GuiDebug directory of your.net SDK installation. Choose Program to Debug from the Debug menu. Navigate to the EXE you want to debug. Now do File Open and navigate to the source file you want to debug. Repeat for multiple source files. Rev Copyright 2004 Object Innovations, Inc. 26

39 .NET Tuning, Debugging and Optimization NetDbg Chapter 1 Using DbgCLR (Cont d) You will now see a solution created and a GUI interface that looks somewhat like Visual Studio. You may set breakpoints just like in Visual Studio. You may now run in the debugger, single step, examine variables in watch windows, etc., just as in Visual Studio. When you are done, you may save your work in a debugger solution (.dln) file. This will save you from repeating the tedious steps of finding the.exe and each source file. Rev Copyright 2004 Object Innovations, Inc. 27

40 .NET Tuning, Debugging and Optimization NetDbg Chapter 1 Lab 1B Debugging Using the Microsoft CLR Debugger In this lab you will use the Microsoft CLR Debugger, DbgCLR, to debug the same program you worked with in the previous lab. At this point, you are familiar with the programming issues. The intent of this lab is to walk you through the operational details of using DbgCLR. The starter code is a version of the program that is built just using the.net Framework SDK. Also, the starting code is cleaned up somewhat so that you get a clean compiler from the getgo, without any warnings. Detailed instructions are contained in the Lab 1B write-up at the end of the chapter. Suggested time: 20 minutes. Rev Copyright 2004 Object Innovations, Inc. 28

41 .NET Tuning, Debugging and Optimization NetDbg Chapter 1 Runtime Debugger CorDbg The.NET Framework SDK includes a low-level, command-line debugger CorDbg. As with other debuggers, to use it you must compile your files with the /debug option. CorDbg provides a large number of features, allowing you to perform these and other tasks: Start and stop a process Single step, both into and over source and native instructions Show source-code lines. Set and display breakpoints Continue execution to a breakpoint Set and display the value of a variable. Display application domains, assemblies, loaded modules, classes, and global functions. Obtain help by the command help or? Rev Copyright 2004 Object Innovations, Inc. 29

42 .NET Tuning, Debugging and Optimization NetDbg Chapter 1 CorDbg Documentation CorDbg is documented as one of the tools in the.net Framework SDK. Rev Copyright 2004 Object Innovations, Inc. 30

43 .NET Tuning, Debugging and Optimization NetDbg Chapter 1 Using CorDbg As a simple demonstration, let s debug our Step 1 Bytes program. 1. Start a Visual Studio.NET 2003 command prompt. 2. Make sure that the files Bytes.exe and Bytes.pdb exist in the folder Chap01\Bytes\Step1Sdk. If not, rebuild using build.bat. 3. Start the debugger using the command cordbg. 4. You will now see the <cordbg> prompt. Start the Bytes.exe process by the command run bytes. 5. Display the local variables by the command p. 6. Display the next few lines of source code by the command sh. 7. Set a breakpoint at the line where tera is assigned by the command b Go to this breakpoint by the command cont. 9. Again display the local variables by the command p. 10. Quit this debugging session by the command q. Rev Copyright 2004 Object Innovations, Inc. 31

44 .NET Tuning, Debugging and Optimization NetDbg Chapter 1 Lab 1C (Optional) Debugging Using CorDbg In this lab you will use the command-line debugger, CorDbg, to debug the same program you worked with in the previous labs. At this point, you are familiar with the programming issues. The intent of this lab is to introduce you to the basic features of CorDbg. The starter code is the same as the starter code in Lab 1B. Detailed instructions are contained in the Lab 1C write-up at the end of the chapter. Suggested time: 30 minutes. Rev Copyright 2004 Object Innovations, Inc. 32

45 .NET Tuning, Debugging and Optimization NetDbg Chapter 1 JIT Debugging in Windows Apps Just-in-time (JIT) debugging is enabled by default in console applications. For Windows applications, you have to explicitly enable it. As a demo, open up a Windows version of the Bytes application, WinBytes, in the Demos directory. Build and run. You will see this dialog: Click the Details button and you will see helpful directions for turning on JIT debugging: Rev Copyright 2004 Object Innovations, Inc. 33

46 .NET Tuning, Debugging and Optimization NetDbg Chapter 1 Configuration File We need to create a configuration file for our application. Configuration files will be discussed in more detail in Chapter 11. For right now, just do the following: 1. Right-click over the WinBytes project and from the context menu select Add Add New Item. Choose Application configuration file and click Open. Rev Copyright 2004 Object Innovations, Inc. 34

47 .NET Tuning, Debugging and Optimization NetDbg Chapter 1 Configuration File (Cont d) 2. A configuration file App.config will be created for you. Add the line that was suggested: <?xml version="1.0" encoding="utf-8"?> <configuration> <system.windows.forms jitdebugging="true" /> </configuration> 3. Build and run again. Now you should see the familiar JIT Debugging dialog: Rev Copyright 2004 Object Innovations, Inc. 35

48 .NET Tuning, Debugging and Optimization NetDbg Chapter 1 Debugged Version of WinBytes In the debugged version of the program you will see information displayed in a multi-line textbox. See Chap01\WinBytes\Step2. private void Form1_Load(object sender, System.EventArgs e) { string NL = Environment.NewLine; int kilo = 1024; txtbytes.text = string.format( "kilo = {0} bytes", kilo) + NL; int mega = kilo * kilo; txtbytes.text += string.format( "mega = {0} bytes", mega) + NL; int giga = kilo * mega; txtbytes.text += string.format( "giga = {0} bytes", giga) + NL; //int tera = kilo * giga; long tera = kilo * (long) giga; txtbytes.text += string.format( "tera = {0} bytes", tera) + NL; } Rev Copyright 2004 Object Innovations, Inc. 36

49 .NET Tuning, Debugging and Optimization NetDbg Chapter 1 Summary Strongly-typed languages such as C# facilitate early detection of many errors by the compiler. Debugging is the process of diagnosing runtime errors not detected at compile-time. Visual Studio can be configured for Debug, Release and special builds. Visual Studio provides an integrated debugger, including features such single step, breakpoints, and examining variables. With the Windows-based Microsoft CLR debugger you can debug.net applications when you have the.net Framework SDK but not Visual Studio. You can use the command-line CorDbg debugger to debug managed code and to examine runtime characteristics of your.net program. You can enable JIT (just-in-time) debugging in Windows applications by adding a line to the application s configuration file. Rev Copyright 2004 Object Innovations, Inc. 37

50 .NET Tuning, Debugging and Optimization NetDbg Chapter 1 Introduction Lab 1A Debugging Using Visual Studio In this lab you will use Visual Studio to debug a simple application. Since you should already have basic experience with the Visual Studio debugger, only general instructions will be given. It will be up to you to figure out the problem(s)! This lab is intended to review some aspects of C# and the.net Framework, as well as the Visual Studio debugger. Suggested Time: 30 minutes. Root Directory: OIC\NetDbg Directories: Labs\Lab1A\SimpleItem (do your work here) Chap01\SimpleItem\Step1 (backup copy of starter files) Chap01\SimpleItem\Step2 (contains lab solution) Instructions 1. Build and run the starter application. What problems do you see? 2. The first problem is that the display for an item is rather uninformative, just Item. The compiler in fact gives a warning (not an error) message. Fix this problem and build and run again. 3. Another problem is that an exception is hit on the last statement of the program. Make sure that you can discover in the debugger that it is this last statement that causes the problem. Since this issue is rather obvious, just comment out the last statement. 4. Now investigate the substantive bug in the program. You will see that the main program adds 5 items to the list and prints them out sorted and unsorted. Then the same 5 items are added in two batches. After the first batch of 3 items are added, the list is sorted, and then the 2 remaining items are added. When the list of items is shown, two of the original items are missing! Why? Fix the problem. Rev Copyright 2004 Object Innovations, Inc. 38

51 .NET Tuning, Debugging and Optimization NetDbg Chapter 1 Introduction Lab 1B Debugging Using the Microsoft CLR Debugger In this lab you will use the Microsoft CLR Debugger, DbgCLR, to debug the same program you worked with in the previous lab. At this point, you are familiar with the programming issues. The intent of this lab is to walk you through the operational details of using DbgCLR. The starter code is a version of the program that is built just using the.net Framework SDK. Also, the starting code is cleaned up somewhat so that you get a clean compiler from the getgo, without any warnings. Suggested Time: 20 minutes. Root Directory: OIC\NetDbg Directories: Labs\Lab1B\SimpleItem (do your work here) Chap01\SimpleItem\Step1Sdk (backup copy of starter files) Chap01\SimpleItem\Step2Sdk (contains lab solution) Instructions 1. Start up a Visual Studio.NET 2003 command prompt and compile the starter program with the debug option. Create a simple batch file so that you could rebuild the program by running your batch file. 2. You should get a clean compile. Make sure that both.exe and.pdb files were created. Run the.exe file from the command line. You should see some output, and then an exception is thrown. The Just-In-Time Debugging dialog comes up. From the list of possible debuggers, choose New Instance of Microsoft CLR Debugger (Note that you could use Visual Studio to debug the program, even though it was not built using Visual Studio!). Click Yes and then Break. 3. You will now be in DbgCLR. We re not going to do any debugging at this point, as the array out of bounds bug is obvious. But getting into the debugger this way provides a quick way to set up a debugger solution. Do File Open and add the file SimpleItem.cs to the solution. 4. Exit the debugger. Say Yes to saving the.dln solution file. 5. Now start DbgCLR from the GuiDebug directory of your.net Framework SDK installation. This time you will not need to separately add the EXE and source files to your solution, but you can simply open the solution file previously created. Do File Open Solution and navigate to the solution file you saved in the previous step. Rev Copyright 2004 Object Innovations, Inc. 39

52 .NET Tuning, Debugging and Optimization NetDbg Chapter 1 6. Open the file SimpleItem.cs and set a breakpoint at the second call to SortItems(), after adding the three items to the new list. This is the first point at which the code for the first batch and the second batch differ, and so the first opportunity for something to go astray. 7. Click the wedge-shaped Continue button. You should hit the breakpoint. Step Into. 8. You will now be at the call to Array.Sort() in the SortItems() method. In the Locals window, expand this and array. You should now be looking at an array of length 5, where the elements at index positions 3 and 4 have undefined values. 9. Single-step again. Now the undefined values are at the beginning of the array! 10. The reason for the erroneous output should now be obvious. Fix the program and run again. Rev Copyright 2004 Object Innovations, Inc. 40

53 .NET Tuning, Debugging and Optimization NetDbg Chapter 1 Introduction Lab 1C Debugging Using CorDbg In this lab you will use the command-line debugger, CorDbg, to debug the same program you worked with in the previous labs. At this point, you are familiar with the programming issues. The intent of this lab is to introduce you to the basic features of CorDbg. The starter code is the same as the starter code in Lab 1B. Suggested Time: 30 minutes. Root Directory: OIC\NetDbg Directories: Labs\Lab1C\SimpleItem (do your work here) Chap01\SimpleItem\Step1Sdk (backup copy of starter files) Chap01\SimpleItem\Step2CorDbg (contains lab solution) Instructions 1. Start up a Visual Studio.NET 2003 command prompt and compile the starter program with the debug option. Create a simple batch file so that you could rebuild the program by running your batch file. 2. You should get a clean compile. Make sure that both.exe and.pdb files were created. 3. Start the debugger by entering the command cordbg at the command prompt. You should now see the prompt <cordbg> to remind you that you are in the debugger. 4. See if there are any running processes by the command pro. 5. Start the SimpleItem.exe program by the command run simpleitem. You should now see the first line of the program displayed. Try the pro command again. 6. At this point you are going to need to see the line numbers of the SimpleItem.cs file in order to set a breakpoint properly. You may use any text editor that displays line numbers (including the Visual Studio editor). Or, you may use the sh command in the debugger. Try sh Set a breakpoint at the line of the second call to SortItems(), after you have added three items to the second list. Use the b command. 8. Run to this breakpoint by the continue or go command (cont or g). Rev Copyright 2004 Object Innovations, Inc. 41

54 .NET Tuning, Debugging and Optimization NetDbg Chapter 1 9. Step into by the s command. You will now be in the SortItems() method in ItemList.cs. 10. Examine the array by the command p this.array. You will see that the last two array elements are null. 11. Step Over by the Next command n. Examine the array again. Now, as you have already discovered, the first two elements of the array are null. 12. Let s examine in detail the third element in the array, at index 2. Enter the command p this.array[2]. You will see ProductId and Quantity displayed, but they are in hex. 13. Turn off the hex display mode by the command m h Now display this array element again. It should be as you expect, with the values displayed in decimal. 15. Exit the debugger by the Quit command, q or the Exit command, ex. 16. Fix the program as before, rebuild, and again go into this section of code. Verify that the program is now behaving properly. 17. If you have some additional time, try some additional experiments. For example, you can create a new object instance of a class by the command newobj (for clarity, we did not abbreviate this command). Try newobj Item. 18. It doesn t work. Add a default constructor to the Item class, rebuild, and try again. You are now asked to choose which constructor. Pick the default one. You should see a new object has been created and stored in the variable $result. 19. Assign a value to the ProductId field by set $result.productid Verify that this value has indeed been assigned by p $result. 21. Perform other experiments as you desire. Rev Copyright 2004 Object Innovations, Inc. 42

55 .NET Tuning, Debugging and Optimization NetDbg Chapter 6 Chapter 6 More About Tracing Rev. 1.0 Copyright 2004 Object Innovations, Inc. 205

56 .NET Tuning, Debugging and Optimization NetDbg Chapter 6 More About Tracing Objectives After completing this unit you will be able to: Use the BooleanSwitch and TraceSwitch classes in the System.Diagnostics namespace to control the amount of debug and trace output. Set these switches both programmatically and through a configuration file. Use Debug and Trace Listeners to control the target of debug and trace output. Use Listener classes to direct trace output to files and event logs. Implement a custom Listener class to direct trace output to a window. Rev. 1.0 Copyright 2004 Object Innovations, Inc. 206

57 .NET Tuning, Debugging and Optimization NetDbg Chapter 6 Trace Switches We have seen how to instrument our application with Debug and Trace information. Debug output will not appear in a Release build, while Trace output will appear. So far the only control we ve had over the amount of trace information is building the project in Debug versus Release mode. With trace switches you can enable, disable and filter trace output. These switches can be controlled at runtime by a configuration file. Thus if a problem occurs with an application in the field, you can turn on tracing by a configuration setting without having to recompile the application. You can also instrument your program so that tracing can be enabled programmatically. There are two kinds of trace switch classes provided in the System.Diagnostics namespace. BooleanSwitch can be used as a toggle, either enabling or disabling trace statements. TraceSwitch allows you to specify a trace level, so that trace statements at or below this level appear. You can also define a custom switch class. Rev. 1.0 Copyright 2004 Object Innovations, Inc. 207

58 .NET Tuning, Debugging and Optimization NetDbg Chapter 6 BooleanSwitch With the BooleanSwitch class you can implement an on/off switch to control debug and trace output. To use the switch to the following: Construct an instance, specifying the display name and a description: BooleanSwitch s = new BooleanSwitch("DemoSwitch", "Switch for controlling debug output"); Turn the switch on or off with the Enabled property: s.enabled = true; You can then conditionally write debugging (or trace) output using the WriteLineIf() method. Debug.WriteLineIf(s.Enabled, "Second attempt"); Rev. 1.0 Copyright 2004 Object Innovations, Inc. 208

59 .NET Tuning, Debugging and Optimization NetDbg Chapter 6 Sample Program A sample program provides an illustration. See Chap06\SimpleSwitch\Step1. // SimpleSwitch.cs using System; using System.Diagnostics; class SimpleSwitch { static void Main(string[] args) { BooleanSwitch s = new BooleanSwitch( "DemoSwitch", "Switch for controlling debug output"); Debug.WriteLine(s.DisplayName); string msg = string.format( "Enabled: {0}", s.enabled.tostring()); Debug.WriteLine(msg); Debug.WriteLineIf(s.Enabled, "1st attempt"); s.enabled = true; msg = string.format( "Enabled: {0}", s.enabled.tostring()); Debug.WriteLine(msg); Debug.WriteLineIf(s.Enabled, "2nd attempt"); } } Output: DemoSwitch Enabled: False Enabled: True Second attempt Rev. 1.0 Copyright 2004 Object Innovations, Inc. 209

60 .NET Tuning, Debugging and Optimization NetDbg Chapter 6 Using a Configuration File You can specify a value of a switch in the application s configuration file. Use 0 for false and 1 for true. Use the display name to refer to the switch. <?xml version="1.0" encoding="utf-8"?> <configuration> <system.diagnostics> <switches> <add name="demoswitch" value="1" /> </switches> </system.diagnostics> </configuration> Here is the output of the same program with use of this configuration file. See Chap06\SimpleSwitch\Step2. DemoSwitch Enabled: True First attempt Enabled: True Second attempt Rev. 1.0 Copyright 2004 Object Innovations, Inc. 210

61 .NET Tuning, Debugging and Optimization NetDbg Chapter 6 TraceSwitch The TraceSwitch class provides a switch with 5 levels, which you can use to filter messages based on their importance. Trace levels can be specified using the TraceLevel enumeration. Trace Level Configuration File Value Off 0 Error 1 Warning 2 Info 3 Verbose 4 The TraceSwitch class has corresponding bool properties which are true if the level is at or below the level specified. For example, TraceInfo is true if the level is less than or equal to 3. Rev. 1.0 Copyright 2004 Object Innovations, Inc. 211

62 .NET Tuning, Debugging and Optimization NetDbg Chapter 6 SwitchDemo A slightly more elaborate example demonstrates use of both BooleanSwitch and TraceSwitch classes. See Chap05\SwitchDemo. Here is the configuration file: <?xml version="1.0" encoding="utf-8"?> <configuration> <system.diagnostics> <switches> <add name="mainswitch" value="1" /> <add name="traceswitch" value="4" /> </switches> </system.diagnostics> </configuration> MainSwitch is on, and TraceSwitch is at verbose. Here is the code: static BooleanSwitch s1 = new BooleanSwitch("MainSwitch", "Main switch"); static TraceSwitch s2 = new TraceSwitch("TraceSwitch", "Trace switch"); static void Main(string[] args) { Console.WriteLine("{0} Enabled: {1}", s1.displayname, s1.enabled); Console.WriteLine("{0} Level: {1}", s2.displayname, s2.level); Console.WriteLine("{0} Error: {1}", s2.displayname, s2.traceerror); Console.WriteLine("{0} Warning: {1}", s2.displayname, s2.tracewarning); Console.WriteLine("{0} Info: {1}", Rev. 1.0 Copyright 2004 Object Innovations, Inc. 212

63 .NET Tuning, Debugging and Optimization NetDbg Chapter 6 SwitchDemo (Cont d) s2.displayname, s2.traceinfo); Console.WriteLine("{0} Verbose: {1}", s2.displayname, s2.traceverbose); string msg; //int[] inputs = {5, 10, -1, 15}; int[] inputs = {5}; for (int i = 0; i < inputs.length; i++) { try { int num = inputs[i]; Trace.WriteLineIf(s2.TraceInfo, "Calling Factorial, num = " + num); long fact = Factorial(num); msg = string.format( "{0} factorial is {1}", num, fact); Trace.WriteLineIf(s1.Enabled, msg); } catch (Exception ex) { Console.WriteLine(ex.Message); Trace.WriteLineIf(s2.TraceError, ex.message); } } Console.WriteLine("Press enter to exit"); Console.ReadLine(); } static long Factorial(int num) { Trace.WriteLineIf(s2.TraceVerbose, "Entering Factorial, num = " + num); if (num == 0) return 1L; else return num * Factorial(num - 1); } Rev. 1.0 Copyright 2004 Object Innovations, Inc. 213

64 .NET Tuning, Debugging and Optimization NetDbg Chapter 6 SwitchDemo (Cont d) Here is the output at the console: MainSwitch Enabled: True TraceSwitch Level: Verbose TraceSwitch Error: True TraceSwitch Warning: True TraceSwitch Info: True TraceSwitch Verbose: True Press enter to exit Here is the output at the Output window (debug and trace output): Calling Factorial, num = 5 Entering Factorial, num = 5 Entering Factorial, num = 4 Entering Factorial, num = 3 Entering Factorial, num = 2 Entering Factorial, num = 1 Entering Factorial, num = 0 5 factorial is 120 You can experiment with different sets of input numbers and trace settings in the configuration file. Rev. 1.0 Copyright 2004 Object Innovations, Inc. 214

65 .NET Tuning, Debugging and Optimization NetDbg Chapter 6 Trace Listeners A trace listener provides a mechanism to collect and store trace messages. A listener directs output to a suitable target, such as a window (e.g. the Output window in Visual Studio), a file or an event log. Listeners work with both the Debug and Trace classes. There are three predefined listeners: DefaultTraceListener TextWriterTraceListener EventLogTraceListener You can also define your own custom listener by defining a class that inherits from the abstract class TraceListener. The Trace and Debug classes have a property Listeners that is a collection of type TraceListenerCollection Trace output is directed to all the listeners in the Listeners collection. Rev. 1.0 Copyright 2004 Object Innovations, Inc. 215

66 .NET Tuning, Debugging and Optimization NetDbg Chapter 6 DefaultTraceListener A DefaultTraceListener sends messages to a debug window via the Win32 API call OutputDebugString(). The Visual Studio debugger Output window displays all such messages. The SDK utility DBWin also displays these messages. DefaultTraceListener also sends messages via the Log method of the Debugger class. DefaultTraceListener is automatically included in every Listeners collection. All of the Debug and Trace messages we ve seen so far in this class have gone to the DefaultTraceListener. Rev. 1.0 Copyright 2004 Object Innovations, Inc. 216

67 .NET Tuning, Debugging and Optimization NetDbg Chapter 6 Listener Example Program We can illustrate listeners with a sample program that allows you to select which listeners to use. See Chap06\ListenDemo. Rev. 1.0 Copyright 2004 Object Innovations, Inc. 217

68 .NET Tuning, Debugging and Optimization NetDbg Chapter 6 A Stream Listener Tracing to a file is done by a Stream listener. Listener and Stream objects are defined: private TextWriterTraceListener filelistener; private Stream tracestream; The Stream object is created to write to a file: private void Form1_Load(object sender, System.EventArgs e) { trcform = new TraceForm(); winlistener = new WinListen(trcForm.txtTrace); tracestream = File.Create(txtFile.Text); ShowListeners(); } The listener is created and added to the Listeners collection. private void chkfile_checkedchanged(object sender, System.EventArgs e) { if (chkfile.checked) { filelistener = new TextWriterTraceListener( tracestream, "File Listener"); Trace.WriteLine(fileListener.Name); Trace.Listeners.Add(fileListener); } else { Trace.Listeners.Remove(fileListener); } ShowListeners(); } Rev. 1.0 Copyright 2004 Object Innovations, Inc. 218

69 .NET Tuning, Debugging and Optimization NetDbg Chapter 6 A Custom Listener You can create a custom listener class by inheriting from the abstract class TraceListener. You must override at least the Write() and WriteLine() methods. public class WinListen : TraceListener { private TextBox txt; private string NL = Environment.NewLine; } public WinListen(TextBox t) { txt = t; } public override void Write(string msg) { txt.text += msg; } public override void WriteLine(string msg) { txt.text += msg + NL; } Rev. 1.0 Copyright 2004 Object Innovations, Inc. 219

70 .NET Tuning, Debugging and Optimization NetDbg Chapter 6 Trace Output to a Window Our WinListen class directs trace output to a window. A listener object is defined: private WinListen winlistener; The listener object is created: private void Form1_Load(object sender, System.EventArgs e) { trcform = new TraceForm(); winlistener = new WinListen(trcForm.txtTrace); tracestream = File.Create(txtFile.Text); ShowListeners(); } The listener is added to the Listeners collection. private void chkwindow_checkedchanged(object sender, System.EventArgs e) { if (chkwindow.checked) { trcform.show(); Trace.Listeners.Add(winListener); } else { trcform.hide(); Trace.Listeners.Remove(winListener); } ShowListeners(); } Rev. 1.0 Copyright 2004 Object Innovations, Inc. 220

71 .NET Tuning, Debugging and Optimization NetDbg Chapter 6 An Event Log Listener Another example illustrates an event log listener. See Chap06\TraceOrder\Step2. A listener object is defined: public class TC {... public static EventLogTraceListener eventlistener;... An event log is set up in the usual way: evlog = new EventLog("Object Innovations"); evlog.source = "Orders"; The listener object is created and added to the Listeners collection: if (chkevent.checked) { TC.eventListener = new EventLogTraceListener(ItemList.evLog); Debug.WriteLine(TC.eventListener.Name); Trace.Listeners.Add(TC.eventListener);... Rev. 1.0 Copyright 2004 Object Innovations, Inc. 221

72 .NET Tuning, Debugging and Optimization NetDbg Chapter 6 Tracing in the Order Application Our final example applies our knowledge of tracing to implement tracing functionality in the Orders application. A tabbed user interface adds pages for controlling tracing and displaying a trace window output. Rev. 1.0 Copyright 2004 Object Innovations, Inc. 222

73 .NET Tuning, Debugging and Optimization NetDbg Chapter 6 Trace Output Various outputs are consolidated as trace output, which will be directed to targets chosen by selecting the desired listeners. Previous file output is replaced by using a stream listener. This same output is therefore displayed by the other listeners. Rev. 1.0 Copyright 2004 Object Innovations, Inc. 223

74 .NET Tuning, Debugging and Optimization NetDbg Chapter 6 Lab 6 Tracing in the Order Application In this lab you will implement tracing functionality in the Order application by using a variety of trace listeners. The intent of this lab is to demonstrate use of the various listeners, not to exemplify typical usage. For example, the event log tracing as implemented in this lab loses some information (level of event) that was present in the previous implementation. Detailed instructions are contained in the Lab 6 write-up at the end of the chapter. Suggested time: 60 minutes. Rev. 1.0 Copyright 2004 Object Innovations, Inc. 224

75 .NET Tuning, Debugging and Optimization NetDbg Chapter 6 Summary You can use the BooleanSwitch and TraceSwitch classes in the System.Diagnostics namespace to control the amount of debug and trace output. These switches can be set both programmatically and through a configuration file. You can use listeners to control the target of debug and trace output. Predefined Listener classes are provided to direct trace output to files and event logs. You can implement a custom Listener class to direct trace output to a window. Rev. 1.0 Copyright 2004 Object Innovations, Inc. 225

76 .NET Tuning, Debugging and Optimization NetDbg Chapter 6 Introduction Lab 6 Tracing in the Order Application In this lab you will implement tracing functionality in the Order application by using a variety of trace listeners. The intent of this lab is to demonstrate use of the various listeners, not to exemplify typical usage. For example, the event log tracing as implemented in this lab loses some information (level of event) that was present in the previous implementation. Suggested Time: 60 minutes. Root Directory: OIC\NetDbg Directories: Labs\Lab6\TraceOrder (do your work here) Chap06\TraceOrder\Step0 (backup of starter code) Chap06\TraceOrder\Step1 (answer to Part 1) Chap06\TraceOrder\Step2 (answer to Part 2) Part 1. Using a Trace Switch In Part 1 you will implement the basic infrastructure to control the level of tracing. You are provided with a small class TC in the file Trace.cs that encapsulates a TraceSwitch as a public static member. A static constructor creates the switch. You are also provided with the user interface in the form of a tab control with three pages. The first page corresponds to the Order application from Chapter 3. The second page is for controlling tracing, and the third page provides a window to show trace output through a custom listener. 1. Build and run the starter program. Make sure you understand the various trace outputs. Examine the code in Trace.cs. 2. In Form1.cs implement a method ShowTraceLevel() that will display the current Level of TC.Switch. For the time being, just display this via a Debug.WriteLine(). Call this from Form1_Load(). Build and run. What is the starting trace level? 3. The default starting trace level is level 0, Off. Add a configuration file to your project to initialize the trace switch to level 4, Verbose. Build and run, and verify that the value of the trace switch is indeed picked up from the configuration file. 4. Add code to ShowTraceLevel() to set the radio buttons for the Trace Level appropriately. Rev. 1.0 Copyright 2004 Object Innovations, Inc. 226

77 .NET Tuning, Debugging and Optimization NetDbg Chapter 6 5. Next, add handlers for the checked changed event of the radio buttons. Implement a method SetTraceLevel() that will change TC.Switch based on the new value specified by the radio buttons. 6. Build and test. You should now be able to specify the desired level of tracing, and see this confirmed in the radio buttons and in debugging trace output. 7. Modify the code in TraceAllOrders() to trace at the TraceInfo level or lower. 8. Modify the code in ItemArray.cs to trace at the TraceInfo level, except for the warning when the array has been grown three times, which should be at the level TraceWarning. 9. Modify the code in the OrderServer constructor to trace at the TraceInfo level. 10. Build and test. Exercise at various levels of tracing and observe the outputs. Part 2. Using Trace Listeners In Part 2 you will provide the capability to send the output to several other trace listeners, besides the default: a file, an event log, and a window. 1. First, we ll add a file listener. Begin by adding a public static member filelistener of type TextWriterTraceListener to the TC class. Also, add a public static member tracestream of type Stream. 2. In the OrderServer constructor initialize TC.traceStream by this code: TC.traceStream = File.Create("orders.txt"); 3. Add a handler for the checked changed event for the file check box. If the box has been checked, create a new listener object and add it to the listeners collection. If the box has been unchecked, remove it from the listeners collection. 4. Implement a method ShowListeners() to display all the current listeners in the listbox that is provided in the UI. Call this method at the end of your handler for the checked changed event. 5. Build and run. You should always see the default listener, and the file listener depending on whether the check box has been checked. 6. In the OrderServer.WriteOrderToFile() method, replace the file stream IO code by conditional trace statements at the Verbose level. Note that we are changing the behavior of the program. This is intended to illustrate the tracing mechanism. 7. Build and run. Can you see the proper output in orders.txt? Rev. 1.0 Copyright 2004 Object Innovations, Inc. 227

78 .NET Tuning, Debugging and Optimization NetDbg Chapter 6 8. There is an issue in the listener being flushed and the stream being closed. In Form1.cs add a handler for the Closed event. If TC.fileListener is not null, you should flush TC.fileListener and close TC.traceStream. 9. Build and test. Observe tracing to the two targets at various trace levels. 10. Implement an event log trace listener and replace your event logging code by appropriate tracing statements. Notice that, as with use of the file listener, this changes the behavior of the program. 11. Implement a custom trace listener that will direct output to the multi-line textbox in the Output page. 12. Exercise your program thoroughly, observing trace output in the various trace targets. Rev. 1.0 Copyright 2004 Object Innovations, Inc. 228

79 .NET Tuning, Debugging and Optimization NetDbg Chapter 10 Chapter 10 Remote Debugging Rev Copyright 2004 Object Innovations, Inc. 345

80 .NET Tuning, Debugging and Optimization NetDbg Chapter 10 Remote Debugging Objectives After completing this unit you will be able to: Explain how to set up for remote debugging. Debug a remote application that is built locally. Debug an ASP.NET Web application that is deployed remotely. Debug a Web service that is deployed remotely. Rev Copyright 2004 Object Innovations, Inc. 346

81 .NET Tuning, Debugging and Optimization NetDbg Chapter 10 Remote Debugging Setup Visual Studio supports three methods for remote debugging. DCOM and the Machine Debug Manager (MDM) support remote debugging of managed code in a manner that is largely transparent. The Remote Debug Manager with pipes can be used to debug native C and C++ programs. The Remote Debug Manager can also be used with TCP/IP to debug native C and C++ programs. The Remote Debug Manager is installed in the VS.NET 2003 Common7\Packages\Debugger directory. By default the Remote Debug Manager starts in Pipe mode msvcmon You can start it in TCP/IP mode by supplying the tcpip option. msvcmon tcpip In the rest of this chapter we will focus on the use of the Machine Debug Manager for the remote debugging of C# programs. Rev Copyright 2004 Object Innovations, Inc. 347

82 .NET Tuning, Debugging and Optimization NetDbg Chapter 10 Remote Debugging Permissions On the local machine you should have a full install of Visual Studio. On the remote machine you only need to install the remote debugging components of Visual Studio. When you install Visual Studio, the installing user is placed in the Debugger Users group. For another user to perform remote debugging, that user must be placed in the Debugger Users group. Note that there is a security risk associated with permission to debug, so you should only place the users in that group who are required to be there. You must also have DCOM installed on both the local and the remote machine. Rev Copyright 2004 Object Innovations, Inc. 348

83 .NET Tuning, Debugging and Optimization NetDbg Chapter 10 Remote Debugging Demo Let s illustrate remote debugging by debugging an executable that was built locally and deployed on a remote machine. We use a version of our bytes program from Chapter 1. Build the program in Demos\WinRemote. (This program is backed up in the directory Chap10\WinRemote\Step1.) Note that we have supplied a debugging trace statement to display the name of the machine the program is running on. private void Form1_Load(object sender, System.EventArgs e) { Debug.WriteLine( "Machine = " + Environment.MachineName); } Rev Copyright 2004 Object Innovations, Inc. 349

84 .NET Tuning, Debugging and Optimization NetDbg Chapter 10 Running Locally 1. Start the program without debugging. Click Calculate. You will see the Just-In-Time Debugging dialog. You can break into where the program failed. 2. Recall that to enable JIT debugging in a Windows Forms application you need to make an entry in the application s configuration file. <?xml version="1.0" encoding="utf-8"?> <configuration> <system.windows.forms jitdebugging="true" /> </configuration> 3. Terminate the JIT debugging session. 4. Start the program in the debugger. Observe that in the Visual Studio Output window there is displayed a line showing the name of the machine, which should be your local computer. 5. Terminate the debugging session. Rev Copyright 2004 Object Innovations, Inc. 350

85 .NET Tuning, Debugging and Optimization NetDbg Chapter 10 Debugging Remotely You will need a remote computer (e.g. that of one of your classmates). Operating system should be Windows 2000 Professional or Windows XP Professional (or higher). This will include DCOM. Visual Studio.NET remote debugging components should be installed. If it does not already exist, create the directory c:\oic\remote where you will deploy remote programs. 1. Copy the file WinBytes.exe to the remote directory. 2. Open the property page for your project. 3. Select Debugging under Configuration Properties. 4. Set Debug Mode to Program. 5. Set Enable Remote Debugging to True. 6. Specify Remote Debug Machine to be the name of the computer where you will debug remotely. 7. Click OK, and then open the property page again. For Start Application enter the following path: c:\oic\remote\winbytes.exe Rev Copyright 2004 Object Innovations, Inc. 351

86 .NET Tuning, Debugging and Optimization NetDbg Chapter 10 Debugging Remotely (Cont d) 8. The property page should now look like this (with the appropriate name for Remote Debug Machine). 9. Click OK and start in the debugger. 10. After a pause, you should see a line in the Output window giving the Machine, which should now be the remote computer. You should see the Show Bytes main window displayed on the remote computer. Rev Copyright 2004 Object Innovations, Inc. 352

87 .NET Tuning, Debugging and Optimization NetDbg Chapter 10 Debugging Remotely (Cont d) 11. Try setting a breakpoint at the first line of the handler for the Calculate button. 12. You will see a question mark inside the red dot, and if you slide the cursor over it, you will see a message The breakpoint will not currently be hit. No symbols have been loaded for this document. 13. Terminate the debugging session. Scrolling back in the Output window you should see this message was displayed as part of the messages pertaining to the loading of the program that is being debugged: 'WinBytes': Loaded 'c:\oic\remote\winbytes.exe', No symbols loaded. Rev Copyright 2004 Object Innovations, Inc. 353

88 .NET Tuning, Debugging and Optimization NetDbg Chapter 10 Debugging Remotely (Cont d) 14. Copy over the symbol file WinBytes.pdb to the remote directory. (Note: Behavior is sometimes a little flaky, and you might have to rebuild the project and copy both the.exe and.pdb files over together.) 15. Again start under the debugger. This time you should see that the symbols are loaded, and you can set the breakpoint. 16. Run under the debugger. Now click the Calculate button, and the breakpoint will be hit. 17. You may now single-step, examine variables, and so on. Terminate the debugging session. 18. Fix the overflow problem by changing to a long data type. long giga = kilo * mega; txtbytes.text += string.format( "giga = {0} bytes", giga) + NL; long tera = kilo * giga; txtbytes.text += string.format( "tera = {0} bytes", tera) + NL; 19. Rebuild. Be sure to recopy the.exe and.pdb files over to the remote machine. Now you should be able to start under the debugger, and the program will run successfully. Rev Copyright 2004 Object Innovations, Inc. 354

89 .NET Tuning, Debugging and Optimization NetDbg Chapter 10 Debugging Remote Web Apps Visual Studio lets you debug ASP.NET Web applications on either a local or remote server. The debugging process is transparent, and you can use the same features on both machines. There are some prerequisites: The Visual Studio remote debugging components must be installed on the remote server. You must be a member of the Debugger User group or an Administrator on the remote machine. You must have Administrator privileges on the machine where ASP.NET runs. Rev Copyright 2004 Object Innovations, Inc. 355

90 .NET Tuning, Debugging and Optimization NetDbg Chapter 10 OrderWeb Demo The instructor will demo deploying a Web application remotely and then debugging it. Just watch this demo, don t follow along on your computer. The Web application is in Chap10\OrderWeb. It relies on a class library built in Chap10\OrderLib. First, run locally: Rev Copyright 2004 Object Innovations, Inc. 356

91 .NET Tuning, Debugging and Optimization NetDbg Chapter 10 Deploying a Web Application Developing a Web application using Visual Studio is quite straightforward. You can do all your work within Visual Studio, including testing your application. When you start a Web application within Visual Studio, Internet Explorer will be brought up automatically. And it is easy to debug. Deploying a Web application created using Visual Studio is also easy, but you need to be aware of a few things. 1. The Project Copy Project... menu can be used to deploy a Web project from Visual Studio. 2. Visual Studio precompiles Web pages, storing the libraries in the bin folder. 3. The directory containing the Web pages must be marked as a Web application. This marking is performed automatically by Visual Studio when you deploy the application. 4. If you copy the files to another directory, possibly on another system, you must perform the marking as an application yourself, which you can do using Internet Services Manager. Rev Copyright 2004 Object Innovations, Inc. 357

92 .NET Tuning, Debugging and Optimization NetDbg Chapter 10 Using Project Copy Project... To illustrate using Visual Studio to deploy a Web project, let s deploy the OrderWeb application. We will deploy it to a new directory OrderWeb in the directory c:\oic\remote on the remote computer. 1. Use Windows Explorer on the remote computer to verify that the C drive has the default share name C$. 2. Using Windows Explorer, create a new directory OrderWeb underneath c:\oic\remote on the remote computer. 3. Make c:\oic\remote a virtual directory with alias Remote. 4. Bring up the Copy Project dialog from the menu Project Copy Project. 5. Enter the following information (see the screen capture on the next page). for Destination project folder File share for Web access method \\<remote-computer>\c$\oic\remote\orderweb for Path Only files needed to run this application for Copy Rev Copyright 2004 Object Innovations, Inc. 358

93 .NET Tuning, Debugging and Optimization NetDbg Chapter 10 Project Copy Project... (Cont d) 6. After a pause, you should see a dialog for files being copied. 7. You can test the deployment by using Internet Explorer. Enter the following URL: Rev Copyright 2004 Object Innovations, Inc. 359

94 .NET Tuning, Debugging and Optimization NetDbg Chapter 10 Remote Debugging Demo 1. In Internet Explorer enter the URL for the application on the remote computer. The application will encounter an error: 2. Make the suggested correction to the configuration file (at the remote location). 3. Run again in IE. Try to place an order. You will get an error again, this time with more information. Rev Copyright 2004 Object Innovations, Inc. 360

95 .NET Tuning, Debugging and Optimization NetDbg Chapter 10 Remote Debugging Demo (Cont d) 4. There is still not enough information to pinpoint the error. So let s debug! 5. To ensure that the Web application will start fresh when you begin debugging, stop and start the World Wide Web Publishing Service on the remote computer. Rev Copyright 2004 Object Innovations, Inc. 361

96 .NET Tuning, Debugging and Optimization NetDbg Chapter 10 Remote Debugging Demo (Cont d) 6. In Visual Studio open the property page for the project (local computer), and set debugger options for remote debugging. This will be analogous to what we did before in remote debugging a Windows Forms applications, but this time we will specify a URL for Debug Mode. Enter the remote URL for Start URL. 7. Set a breakpoint in Application_Start() in the file Global.asax.cs. 8. Start under the debugger. Rev Copyright 2004 Object Innovations, Inc. 362

97 .NET Tuning, Debugging and Optimization NetDbg Chapter 10 Remote Debugging Demo (Cont d) 9. You should hit the breakpoint. 10. Step Into. Single step in the OrderServer() constructor. 11. Step again. We will hit an error. See the screen capture on the next page. Rev Copyright 2004 Object Innovations, Inc. 363

98 .NET Tuning, Debugging and Optimization NetDbg Chapter 10 Remote Debugging Demo (Cont d) 12. The Orders subdirectory does not exist in c:\remote\data on the remote computer. Terminate this debugging session. 13. Create the Orders subdirectory on the remote computer. Set a breakpoint (local machine) at the entry to the handler for the Place Order button. Rev Copyright 2004 Object Innovations, Inc. 364

99 .NET Tuning, Debugging and Optimization NetDbg Chapter 10 Remote Debugging Demo (Cont d) 14. Start the application again in the debugger. Depending on your timing, the Web application may still be loaded on the remote computer, and you may not hit the breakpoint in Application_Start(). You should see Internet Explorer brought up (on the local computer) with the Web form displayed. 15. Add an item to an order and place the order. Now you should hit the breakpoint in the handler for this button. 16. Single-step and inspect the variable os. It has not been set! The problem is that the old application object is still running. Terminate this debugging session. 17. Stop and start the WWW service on the remote computer, and debug again. This time you should hit both breakpoint. In cmdplace_click() single-step again and inspect the variable os. Now it should be set. 18. Clear breakpoints and run. You should be able to place a number of orders, and see the results recorded in the file c:\oic\remote\data\orders.txt. This concludes the demonstration. Rev Copyright 2004 Object Innovations, Inc. 365

100 .NET Tuning, Debugging and Optimization NetDbg Chapter 10 Debugging Remote Web Services The same principles used in debugging remote ASP.NET Web applications apply to debugging remote Web services. To exercise a remote Web service, you will need to create your own client using a proxy. The browser test form is not available for remote Web services. The actual mechanics of debugging is more transparent with Web services than with Web Forms applications. You can build the client project in debug mode and then step into calls to the Web service, and you will be debugging remotely in a very transparent manner. The lab illustrates debugging a Web service remotely. Rev Copyright 2004 Object Innovations, Inc. 366

101 .NET Tuning, Debugging and Optimization NetDbg Chapter 10 Lab 10 Debugging Order Web Service Remotely In this lab you will gain practice deploying and debugging the Order Web service. First, you will deploy the entire project to the Lab area of the local computer. Then you ll deploy just the runtime files to a remote computer. Next you will implement a client test program that calls two Web services, one of them local (the Item service) and one remote (the Order service). Finally, you will practice using the debugger with your client program and remote Web service. Detailed instructions are contained in the Lab 10 write-up at the end of the chapter. Suggested time: 45 minutes. Rev Copyright 2004 Object Innovations, Inc. 367

102 .NET Tuning, Debugging and Optimization NetDbg Chapter 10 Summary You can perform remote debugging of managed code using DCOM and the Machine Debug Manager. By setting local project properties appropriately, you can debug a remote application that is built locally. An ASP.NET Web application that is deployed remotely can be debugged in a similar manner by setting local project properties for remote debugging. A Web service that is deployed remotely can be debugged in Visual Studio in a largely transparent manner. Rev Copyright 2004 Object Innovations, Inc. 368

103 .NET Tuning, Debugging and Optimization NetDbg Chapter 10 Introduction Lab 10 Debugging Order Web Service Remotely In this lab you will gain practice deploying and debugging the Order Web service. First, you will deploy the entire project to the Lab area of the local computer. Then you ll deploy just the runtime files to a remote computer. Next you will implement a client test program that calls two Web services, one of them local (the Item service) and one remote (the Order service). Finally, you will practice using the debugger with your client program and remote Web service. Suggested Time: 45 minutes. Root Directory: OIC\NetDbg Directories: Labs\Lab10\OrderService (do your server work here) Labs\Lab10\OrderServiceClient (do your client work here) Chap10\OrderService (Order Web service) Chap10\ItemService (Item Web service) Chap10\OrderServiceClient\Step1 (backup of client starter code) Chap10\OrderServiceClient\Step2 client answer) Remote directory: OIC\Remote\OrderService (remote server location) Part 1. Deploying a Web Service Locally 1. Build and run the ItemService Web service. Notice that you can exercise it in the test form. 2. Build and run the OrderService Web service. Notice that you can exercise two methods in the test form (working with some hardcoded test data), but there is no test form available to exercise the PlaceOrder() method. 3. Build and run the starter code (in Lab10\OrderServiceClient) for the client program. Notice that this program has two proxies. See the screen capture on the next page. Rev Copyright 2004 Object Innovations, Inc. 369

104 .NET Tuning, Debugging and Optimization NetDbg Chapter Now let s deploy OrderService from Chap10\OrderService to another location on the local computer. Open up the project and choose Project Copy Project. Enter the following: a. for Destination project folder. b. File share for Web access method. c. c:\oic\netdbg\labs\lab10\orderservice for Path. d. All project files for Copy. 5. Click OK and observe that the project files have indeed been copied over. (There is no solution file.sln, but one will be created when you open the.csproj file in Visual Studio and build the project.) Build and run to the extent you can with the IE test form. Run under the debugger, and notice the debugging trace statements in the Output window that identify the current machine, which is the local machine. 6. Add trace statements to each of the Web methods in OrderService to display Lab 10. Build and test out in the debugger with IE test client. 7. Run Lab10\OrderServiceClient and verify that the Lab 10 version of OrderService is not being called. 8. Modify the code in Lab10\OrderServiceClient to use the Lab 10 Web service. Rev Copyright 2004 Object Innovations, Inc. 370

Visual Studio.NET. Although it is possible to program.net using only the command OVERVIEW OF VISUAL STUDIO.NET

Visual Studio.NET. Although it is possible to program.net using only the command OVERVIEW OF VISUAL STUDIO.NET Chapter. 03 9/17/01 6:08 PM Page 35 Visual Studio.NET T H R E E Although it is possible to program.net using only the command line compiler, it is much easier and more enjoyable to use Visual Studio.NET.

More information

Fundamental C# Programming

Fundamental C# Programming Part 1 Fundamental C# Programming In this section you will find: Chapter 1: Introduction to C# Chapter 2: Basic C# Programming Chapter 3: Expressions and Operators Chapter 4: Decisions, Loops, and Preprocessor

More information

12/14/2016. Errors. Debugging and Error Handling. Run-Time Errors. Debugging in C# Debugging in C# (continued)

12/14/2016. Errors. Debugging and Error Handling. Run-Time Errors. Debugging in C# Debugging in C# (continued) Debugging and Error Handling Debugging methods available in the ID Error-handling techniques available in C# Errors Visual Studio IDE reports errors as soon as it is able to detect a problem Error message

More information

Chapter 1 Getting Started

Chapter 1 Getting Started Chapter 1 Getting Started The C# class Just like all object oriented programming languages, C# supports the concept of a class. A class is a little like a data structure in that it aggregates different

More information

Using the Xcode Debugger

Using the Xcode Debugger g Using the Xcode Debugger J Objectives In this appendix you ll: Set breakpoints and run a program in the debugger. Use the Continue program execution command to continue execution. Use the Auto window

More information

Saikat Banerjee Page 1

Saikat Banerjee Page 1 1. What s the advantage of using System.Text.StringBuilder over System.String? StringBuilder is more efficient in the cases, where a lot of manipulation is done to the text. Strings are immutable, so each

More information

Introduction. Key features and lab exercises to familiarize new users to the Visual environment

Introduction. Key features and lab exercises to familiarize new users to the Visual environment Introduction Key features and lab exercises to familiarize new users to the Visual environment January 1999 CONTENTS KEY FEATURES... 3 Statement Completion Options 3 Auto List Members 3 Auto Type Info

More information

Student Guide Revision 1.0

Student Guide Revision 1.0 Robert J. Oberg Student Guide Revision 1.0 Object Innovations Course 411 C# Essentials Rev. 1.0 Student Guide Information in this document is subject to change without notice. Companies, names and data

More information

Getting Started (1.8.7) 9/2/2009

Getting Started (1.8.7) 9/2/2009 2 Getting Started For the examples in this section, Microsoft Windows and Java will be used. However, much of the information applies to other operating systems and supported languages for which you have

More information

Introduction to C/C++ Programming

Introduction to C/C++ Programming Chapter 1 Introduction to C/C++ Programming This book is about learning numerical programming skill and the software development process. Therefore, it requires a lot of hands-on programming exercises.

More information

2 Getting Started. Getting Started (v1.8.6) 3/5/2007

2 Getting Started. Getting Started (v1.8.6) 3/5/2007 2 Getting Started Java will be used in the examples in this section; however, the information applies to all supported languages for which you have installed a compiler (e.g., Ada, C, C++, Java) unless

More information

Introduction to Programming Using Java (98-388)

Introduction to Programming Using Java (98-388) Introduction to Programming Using Java (98-388) Understand Java fundamentals Describe the use of main in a Java application Signature of main, why it is static; how to consume an instance of your own class;

More information

Debugging and Handling Exceptions

Debugging and Handling Exceptions 12 Debugging and Handling Exceptions C# Programming: From Problem Analysis to Program Design C# Programming: From Problem Analysis to Program Design 1 4th Edition Chapter Objectives Learn about exceptions,

More information

Programming Logic - Beginning

Programming Logic - Beginning Programming Logic - Beginning 152-101 Debugging Applications Quick Links & Text References Debugging Concepts Pages Debugging Terminology Pages Debugging in Visual Studio Pages Breakpoints Pages Watches

More information

INFORMATICS LABORATORY WORK #2

INFORMATICS LABORATORY WORK #2 KHARKIV NATIONAL UNIVERSITY OF RADIO ELECTRONICS INFORMATICS LABORATORY WORK #2 SIMPLE C# PROGRAMS Associate Professor A.S. Eremenko, Associate Professor A.V. Persikov 2 Simple C# programs Objective: writing

More information

Supplement: Visual C++ Debugging

Supplement: Visual C++ Debugging Supplement: Visual C++ Debugging For Introduction to C++ Programming By Y. Daniel Liang Note: The screen shots are taken from VC++ 2010. It is the same for the later version. 1 Introduction The debugger

More information

After completing this appendix, you will be able to:

After completing this appendix, you will be able to: 1418835463_AppendixA.qxd 5/22/06 02:31 PM Page 879 A P P E N D I X A A DEBUGGING After completing this appendix, you will be able to: Describe the types of programming errors Trace statement execution

More information

Using the KD30 Debugger

Using the KD30 Debugger ELEC3730 Embedded Systems Tutorial 3 Using the KD30 Debugger 1 Introduction Overview The KD30 debugger is a powerful software tool that can greatly reduce the time it takes to develop complex programs

More information

EEE-425 Programming Languages (2013) 1

EEE-425 Programming Languages (2013) 1 2 Computer programming: creating a sequence of instructions to enable the computer to do something Programmers do not use machine language when creating computer programs. Instead, programmers tend to

More information

1 Introduction to MARS

1 Introduction to MARS 1 Introduction to MARS 1.1 Objectives After completing this lab, you will: Get familiar with the MARS simulator Learn how to assemble, run, and debug a MIPS program 1.2 The MARS Simulator MARS, the MIPS

More information

3 Getting Started with Objects

3 Getting Started with Objects 3 Getting Started with Objects If you are an experienced IDE user, you may be able to do this tutorial without having done the previous tutorial, Getting Started. However, at some point you should read

More information

Exploring Code with Microsoft Pex

Exploring Code with Microsoft Pex Exploring Code with Microsoft Pex Tutorial for Automated Whitebox Testing for.net Applications Abstract Microsoft Pex 2010 is a Microsoft Visual Studio add-in that provides a runtime code analysis tool

More information

11Debugging and Handling. C# Programming: From Problem Analysis to Program Design 2nd Edition. David McDonald, Ph.D. Director of Emerging Technologies

11Debugging and Handling. C# Programming: From Problem Analysis to Program Design 2nd Edition. David McDonald, Ph.D. Director of Emerging Technologies 11Debugging and Handling 11Exceptions C# Programming: From Problem Analysis to Program Design 2nd Edition David McDonald, Ph.D. Director of Emerging Technologies Chapter Objectives Learn about exceptions,

More information

Cookbook for using SQL Server DTS 2000 with.net

Cookbook for using SQL Server DTS 2000 with.net Cookbook for using SQL Server DTS 2000 with.net Version: 1.0 revision 15 Last updated: Tuesday, July 23, 2002 Author: Gert E.R. Drapers (GertD@SQLDev.Net) All rights reserved. No part of the contents of

More information

Unit 1: Visual Basic.NET and the.net Framework

Unit 1: Visual Basic.NET and the.net Framework 1 Chapter1: Visual Basic.NET and the.net Framework Unit 1: Visual Basic.NET and the.net Framework Contents Introduction to.net framework Features Common Language Runtime (CLR) Framework Class Library(FCL)

More information

H8 C-SPY. User Guide WINDOWS WORKBENCH VERSION

H8 C-SPY. User Guide WINDOWS WORKBENCH VERSION H8 C-SPY User Guide WINDOWS WORKBENCH VERSION COPYRIGHT NOTICE Copyright 1998 IAR Systems. All rights reserved. No part of this document may be reproduced without the prior written consent of IAR Systems.

More information

Visual Profiler. User Guide

Visual Profiler. User Guide Visual Profiler User Guide Version 3.0 Document No. 06-RM-1136 Revision: 4.B February 2008 Visual Profiler User Guide Table of contents Table of contents 1 Introduction................................................

More information

Developing Microsoft.NET Applications for Windows (Visual Basic.NET)

Developing Microsoft.NET Applications for Windows (Visual Basic.NET) Developing Microsoft.NET Applications for Windows (Visual Basic.NET) Course Number: 2565 Length: 5 Day(s) Certification Exam This course will help you prepare for the following Microsoft Certified Professional

More information

Visual Studio.NET.NET Framework. Web Services Web Forms Windows Forms. Data and XML classes. Framework Base Classes. Common Language Runtime

Visual Studio.NET.NET Framework. Web Services Web Forms Windows Forms. Data and XML classes. Framework Base Classes. Common Language Runtime Intro C# Intro C# 1 Microsoft's.NET platform and Framework.NET Enterprise Servers Visual Studio.NET.NET Framework.NET Building Block Services Operating system on servers, desktop, and devices Web Services

More information

VB Net Debugging (Console)

VB Net Debugging (Console) VB Net Debugging (Console) Introduction A bug is some sort of error in the code which can prevent your program from running properly. When. you write a substantial program always assume that it contains

More information

Introduce C# as Object Oriented programming language. Explain, tokens,

Introduce C# as Object Oriented programming language. Explain, tokens, Module 2 98 Assignment 1 Introduce C# as Object Oriented programming language. Explain, tokens, lexicals and control flow constructs. 99 The C# Family Tree C Platform Independence C++ Object Orientation

More information

Chapter 1: A First Program Using C#

Chapter 1: A First Program Using C# Chapter 1: A First Program Using C# Programming Computer program A set of instructions that tells a computer what to do Also called software Software comes in two broad categories System software Application

More information

SQL Server. Management Studio. Chapter 3. In This Chapter. Management Studio. c Introduction to SQL Server

SQL Server. Management Studio. Chapter 3. In This Chapter. Management Studio. c Introduction to SQL Server Chapter 3 SQL Server Management Studio In This Chapter c Introduction to SQL Server Management Studio c Using SQL Server Management Studio with the Database Engine c Authoring Activities Using SQL Server

More information

Department of Computer Applications

Department of Computer Applications MCA 512:.NET framework and C# [Part I : Medium Answer type Questions] Unit - 1 Q1. What different tools are available and used to develop.net Applications? Hint a).net Framework SDK b) ASP.NET Web Matrix

More information

RVDS 4.0 Introductory Tutorial

RVDS 4.0 Introductory Tutorial RVDS 4.0 Introductory Tutorial 402v02 RVDS 4.0 Introductory Tutorial 1 Introduction Aim This tutorial provides you with a basic introduction to the tools provided with the RealView Development Suite version

More information

Laboratory Assignment #4 Debugging in Eclipse CDT 1

Laboratory Assignment #4 Debugging in Eclipse CDT 1 Lab 4 (10 points) November 20, 2013 CS-2301, System Programming for Non-majors, B-term 2013 Objective Laboratory Assignment #4 Debugging in Eclipse CDT 1 Due: at 11:59 pm on the day of your lab session

More information

About this exam review

About this exam review Final Exam Review About this exam review I ve prepared an outline of the material covered in class May not be totally complete! Exam may ask about things that were covered in class but not in this review

More information

NetBeans Tutorial. For Introduction to Java Programming By Y. Daniel Liang. This tutorial applies to NetBeans 6, 7, or a higher version.

NetBeans Tutorial. For Introduction to Java Programming By Y. Daniel Liang. This tutorial applies to NetBeans 6, 7, or a higher version. NetBeans Tutorial For Introduction to Java Programming By Y. Daniel Liang This tutorial applies to NetBeans 6, 7, or a higher version. This supplement covers the following topics: Getting Started with

More information

C#.Net. Course Contents. Course contents VT BizTalk. No exam, but laborations

C#.Net. Course Contents. Course contents VT BizTalk. No exam, but laborations , 1 C#.Net VT 2009 Course Contents C# 6 hp approx. BizTalk 1,5 hp approx. No exam, but laborations Course contents Architecture Visual Studio Syntax Classes Forms Class Libraries Inheritance Other C# essentials

More information

COPYRIGHTED MATERIAL. Contents. Part I: C# Fundamentals 1. Chapter 1: The.NET Framework 3. Chapter 2: Getting Started with Visual Studio

COPYRIGHTED MATERIAL. Contents. Part I: C# Fundamentals 1. Chapter 1: The.NET Framework 3. Chapter 2: Getting Started with Visual Studio Introduction XXV Part I: C# Fundamentals 1 Chapter 1: The.NET Framework 3 What s the.net Framework? 3 Common Language Runtime 3.NET Framework Class Library 4 Assemblies and the Microsoft Intermediate Language

More information

Pace University. Fundamental Concepts of CS121 1

Pace University. Fundamental Concepts of CS121 1 Pace University Fundamental Concepts of CS121 1 Dr. Lixin Tao http://csis.pace.edu/~lixin Computer Science Department Pace University October 12, 2005 This document complements my tutorial Introduction

More information

Lab 3-2: Exploring the Heap

Lab 3-2: Exploring the Heap Lab 3-2: Exploring the Heap Objectives Become familiar with the Windows Embedded CE 6.0 heap Prerequisites Completed Lab 2-1 Estimated time to complete this lab: 30 minutes Lab Setup To complete this lab,

More information

.Net. Course Content ASP.NET

.Net. Course Content ASP.NET .Net Course Content ASP.NET INTRO TO WEB TECHNOLOGIES HTML ü Client side scripting langs ü lls Architecture ASP.NET INTRODUCTION ü What is ASP.NET ü Image Technique and code behind technique SERVER SIDE

More information

BUILDING C# APPLICATIONS

BUILDING C# APPLICATIONS BUILDING C# APPLICATIONS The C# Command-Line Compiler (csc.exe) Configuring the C# Command-Line Compiler To equip your development machine to compile *.cs files from any directory, follow these steps (which

More information

HPCC - Hrothgar. Getting Started User Guide TotalView. High Performance Computing Center Texas Tech University

HPCC - Hrothgar. Getting Started User Guide TotalView. High Performance Computing Center Texas Tech University HPCC - Hrothgar Getting Started User Guide TotalView High Performance Computing Center Texas Tech University HPCC - Hrothgar 2 Table of Contents *This user guide is under development... 3 1. Introduction...

More information

C# Programming: From Problem Analysis to Program Design. Fourth Edition

C# Programming: From Problem Analysis to Program Design. Fourth Edition C# Programming: From Problem Analysis to Program Design Fourth Edition Preface xxi INTRODUCTION TO COMPUTING AND PROGRAMMING 1 History of Computers 2 System and Application Software 4 System Software 4

More information

ASP.NET Web Forms Programming Using Visual Basic.NET

ASP.NET Web Forms Programming Using Visual Basic.NET ASP.NET Web Forms Programming Using Visual Basic.NET Duration: 35 hours Price: $750 Delivery Option: Attend training via an on-demand, self-paced platform paired with personal instructor facilitation.

More information

Laboratory 0 Week 0 Advanced Structured Programming An Introduction to Visual Studio and C++

Laboratory 0 Week 0 Advanced Structured Programming An Introduction to Visual Studio and C++ Laboratory 0 Week 0 Advanced Structured Programming An Introduction to Visual Studio and C++ 0.1 Introduction This is a session to familiarize working with the Visual Studio development environment. It

More information

MODEL-BASED DEVELOPMENT -TUTORIAL

MODEL-BASED DEVELOPMENT -TUTORIAL MODEL-BASED DEVELOPMENT -TUTORIAL 1 Objectives To get familiar with the fundamentals of Rational Rhapsody. You start with the simplest example possible. You end with more complex functionality, and a more

More information

Creating and Running Your First C# Program

Creating and Running Your First C# Program Creating and Running Your First C# Program : http://eembdersler.wordpress.com Choose the EEE-425Programming Languages (Fall) Textbook reading schedule Pdf lecture notes Updated class syllabus Midterm and

More information

EEE-425 Programming Languages (2013) 1

EEE-425 Programming Languages (2013) 1 Creating and Running Your First C# Program : http://eembdersler.wordpress.com Choose the EEE-425Programming Languages (Fall) Textbook reading schedule Pdf lecture notes Updated class syllabus Midterm and

More information

JCreator. Starting JCreator

JCreator. Starting JCreator 1 of 12 9/29/2005 2:31 PM JCreator JCreator is a commercial Java environment available from http://www.jcreator.com. Inexpensive academic licenses and a free "limited edition" are available. JCreator runs

More information

Eclipse Tutorial. For Introduction to Java Programming By Y. Daniel Liang

Eclipse Tutorial. For Introduction to Java Programming By Y. Daniel Liang Eclipse Tutorial For Introduction to Java Programming By Y. Daniel Liang This supplement covers the following topics: Getting Started with Eclipse Choosing a Perspective Creating a Project Creating a Java

More information

PROGRAMMING IN VISUAL BASIC WITH MICROSOFT VISUAL STUDIO Course: 10550A; Duration: 5 Days; Instructor-led

PROGRAMMING IN VISUAL BASIC WITH MICROSOFT VISUAL STUDIO Course: 10550A; Duration: 5 Days; Instructor-led CENTER OF KNOWLEDGE, PATH TO SUCCESS Website: PROGRAMMING IN VISUAL BASIC WITH MICROSOFT VISUAL STUDIO 2010 Course: 10550A; Duration: 5 Days; Instructor-led WHAT YOU WILL LEARN This course teaches you

More information

Dot Net Online Training

Dot Net Online Training chakraitsolutions.com http://chakraitsolutions.com/dotnet-online-training/ Dot Net Online Training DOT NET Online Training CHAKRA IT SOLUTIONS TO LEARN ABOUT OUR UNIQUE TRAINING PROCESS: Title : Dot Net

More information

CSCI0330 Intro Computer Systems Doeppner. Lab 02 - Tools Lab. Due: Sunday, September 23, 2018 at 6:00 PM. 1 Introduction 0.

CSCI0330 Intro Computer Systems Doeppner. Lab 02 - Tools Lab. Due: Sunday, September 23, 2018 at 6:00 PM. 1 Introduction 0. CSCI0330 Intro Computer Systems Doeppner Lab 02 - Tools Lab Due: Sunday, September 23, 2018 at 6:00 PM 1 Introduction 0 2 Assignment 0 3 gdb 1 3.1 Setting a Breakpoint 2 3.2 Setting a Watchpoint on Local

More information

M Introduction to Visual Basic.NET Programming with Microsoft.NET 5 Day Course

M Introduction to Visual Basic.NET Programming with Microsoft.NET 5 Day Course Module 1: Getting Started This module introduces Visual Basic.NET and explains how it fits into the.net platform. It explains how to use the programming tools in Microsoft Visual Studio.NET and provides

More information

C#: framework overview and in-the-small features

C#: framework overview and in-the-small features Chair of Software Engineering Carlo A. Furia, Marco Piccioni, Bertrand Meyer C#: framework overview and in-the-small features Chair of Software Engineering Carlo A. Furia, Marco Piccioni, Bertrand Meyer

More information

CS354 gdb Tutorial Written by Chris Feilbach

CS354 gdb Tutorial Written by Chris Feilbach CS354 gdb Tutorial Written by Chris Feilbach Purpose This tutorial aims to show you the basics of using gdb to debug C programs. gdb is the GNU debugger, and is provided on systems that

More information

NEW CEIBO DEBUGGER. Menus and Commands

NEW CEIBO DEBUGGER. Menus and Commands NEW CEIBO DEBUGGER Menus and Commands Ceibo Debugger Menus and Commands D.1. Introduction CEIBO DEBUGGER is the latest software available from Ceibo and can be used with most of Ceibo emulators. You will

More information

Saleae Device SDK Starting a Device SDK Project on Windows Starting a Device SDK Project on Linux... 7

Saleae Device SDK Starting a Device SDK Project on Windows Starting a Device SDK Project on Linux... 7 Contents Starting a Device SDK Project on Windows... 2 Starting a Device SDK Project on Linux... 7 Debugging your Project with GDB... 9 Starting a Device SDK Project on Mac... 11 Build Script / Command

More information

Introduction to Computation and Problem Solving

Introduction to Computation and Problem Solving Class 3: The Eclipse IDE Introduction to Computation and Problem Solving Prof. Steven R. Lerman and Dr. V. Judson Harward What is an IDE? An integrated development environment (IDE) is an environment in

More information

CPE 323: Laboratory Assignment #1 Getting Started with the MSP430 IAR Embedded Workbench

CPE 323: Laboratory Assignment #1 Getting Started with the MSP430 IAR Embedded Workbench CPE 323: Laboratory Assignment #1 Getting Started with the MSP430 IAR Embedded Workbench by Alex Milenkovich, milenkovic@computer.org Objectives: This tutorial will help you get started with the MSP30

More information

RVDS 3.0 Introductory Tutorial

RVDS 3.0 Introductory Tutorial RVDS 3.0 Introductory Tutorial 338v00 RVDS 3.0 Introductory Tutorial 1 Introduction Aim This tutorial provides you with a basic introduction to the tools provided with the RealView Development Suite version

More information

Microsoft.NET Programming (C#, ASP.NET,ADO.NET, VB.NET, Crystal Report, Sql Server) Goal: Make the learner proficient in the usage of MS Technologies

Microsoft.NET Programming (C#, ASP.NET,ADO.NET, VB.NET, Crystal Report, Sql Server) Goal: Make the learner proficient in the usage of MS Technologies Microsoft.NET Programming (C#, ASP.NET,ADO.NET, VB.NET, Crystal Report, Sql Server) Goal: Make the learner proficient in the usage of MS Technologies for web applications development using ASP.NET, XML,

More information

The NetBeans IDE is a big file --- a minimum of around 30 MB. After you have downloaded the file, simply execute the file to install the software.

The NetBeans IDE is a big file --- a minimum of around 30 MB. After you have downloaded the file, simply execute the file to install the software. Introduction to Netbeans This document is a brief introduction to writing and compiling a program using the NetBeans Integrated Development Environment (IDE). An IDE is a program that automates and makes

More information

Visual Studio 2008 Load Symbols Manually

Visual Studio 2008 Load Symbols Manually Visual Studio 2008 Load Symbols Manually Microsoft Visual Studio 2008 SP1 connects to the Microsoft public symbol are loaded manually if you want to load symbols automatically when you launch. Have you

More information

VB.NET. Exercise 1: Creating Your First Application in Visual Basic.NET

VB.NET. Exercise 1: Creating Your First Application in Visual Basic.NET VB.NET Module 1: Getting Started This module introduces Visual Basic.NET and explains how it fits into the.net platform. It explains how to use the programming tools in Microsoft Visual Studio.NET and

More information

Migrate Your Skills to Microsoft.NET Framework 2.0 and 3.0 using Visual Studio 2005 (C#)

Migrate Your Skills to Microsoft.NET Framework 2.0 and 3.0 using Visual Studio 2005 (C#) Migrate Your Skills to Microsoft.NET Framework 2.0 and 3.0 using Visual Studio 2005 (C#) Course Length: 5 Days Course Overview This instructor-led course teaches developers to gain in-depth guidance on

More information

CS 3 Introduction to Software Engineering. 3: Exceptions

CS 3 Introduction to Software Engineering. 3: Exceptions CS 3 Introduction to Software Engineering 3: Exceptions Questions? 2 Objectives Last Time: Procedural Abstraction This Time: Procedural Abstraction II Focus on Exceptions. Starting Next Time: Data Abstraction

More information

An Introduction to Komodo

An Introduction to Komodo An Introduction to Komodo The Komodo debugger and simulator is the low-level debugger used in the Digital Systems Laboratory. Like all debuggers, Komodo allows you to run your programs under controlled

More information

Programming in Visual Basic with Microsoft Visual Studio 2010

Programming in Visual Basic with Microsoft Visual Studio 2010 Programming in Visual Basic with Microsoft Visual Studio 2010 Course 10550; 5 Days, Instructor-led Course Description This course teaches you Visual Basic language syntax, program structure, and implementation

More information

Assoc. Prof. Marenglen Biba. (C) 2010 Pearson Education, Inc. All rights reserved.

Assoc. Prof. Marenglen Biba. (C) 2010 Pearson Education, Inc. All rights reserved. Assoc. Prof. Marenglen Biba Exception handling Exception an indication of a problem that occurs during a program s execution. The name exception implies that the problem occurs infrequently. With exception

More information

C# Syllabus. MS.NET Framework Introduction

C# Syllabus. MS.NET Framework Introduction C# Syllabus MS.NET Framework Introduction The.NET Framework - an Overview Framework Components Framework Versions Types of Applications which can be developed using MS.NET MS.NET Base Class Library MS.NET

More information

Lab 0 Introduction to the MSP430F5529 Launchpad-based Lab Board and Code Composer Studio

Lab 0 Introduction to the MSP430F5529 Launchpad-based Lab Board and Code Composer Studio ECE2049 Embedded Computing in Engineering Design Lab 0 Introduction to the MSP430F5529 Launchpad-based Lab Board and Code Composer Studio In this lab, you will be introduced to the Code Composer Studio

More information

UNIT I An overview of Programming models Programmers Perspective

UNIT I An overview of Programming models Programmers Perspective UNIT I An overview of Programming models Programmers Perspective 1. C/Win32 API Programmer It is complex C is short/abrupt language Manual Memory Management, Ugly Pointer arithmetic, ugly syntactic constructs

More information

IT 374 C# and Applications/ IT695 C# Data Structures

IT 374 C# and Applications/ IT695 C# Data Structures IT 374 C# and Applications/ IT695 C# Data Structures Module 2.1: Introduction to C# App Programming Xianrong (Shawn) Zheng Spring 2017 1 Outline Introduction Creating a Simple App String Interpolation

More information

embos Real-Time Operating System embos plug-in for IAR C-Spy Debugger Document: UM01025 Software Version: 3.1 Revision: 0 Date: May 3, 2018

embos Real-Time Operating System embos plug-in for IAR C-Spy Debugger Document: UM01025 Software Version: 3.1 Revision: 0 Date: May 3, 2018 embos Real-Time Operating System Document: UM01025 Software Version: 3.1 Revision: 0 Date: May 3, 2018 A product of SEGGER Microcontroller GmbH www.segger.com 2 Disclaimer Specifications written in this

More information

Changing the Embedded World TM. Module 3: Getting Started Debugging

Changing the Embedded World TM. Module 3: Getting Started Debugging Changing the Embedded World TM Module 3: Getting Started Debugging Module Objectives: Section 1: Introduce Debugging Techniques Section 2: PSoC In-Circuit Emulator (ICE) Section 3: Hands on Debugging a

More information

Programming Studio #9 ECE 190

Programming Studio #9 ECE 190 Programming Studio #9 ECE 190 Programming Studio #9 Concepts: Functions review 2D Arrays GDB Announcements EXAM 3 CONFLICT REQUESTS, ON COMPASS, DUE THIS MONDAY 5PM. NO EXTENSIONS, NO EXCEPTIONS. Functions

More information

10/9/2012. Sample C# program:

10/9/2012. Sample C# program: Creating and Running Your First C# Program Text Book : C# Programming From Problem Analysis to Program design, Barbara Doyle Grading : Homeworks 20% Lecture Presentation 20% Final : % 20 Project : 40%

More information

JDB - QUICK GUIDE JDB - INTRODUCTION

JDB - QUICK GUIDE JDB - INTRODUCTION http://www.tutorialspoint.com/jdb/jdb_quick_guide.htm JDB - QUICK GUIDE Copyright tutorialspoint.com JDB - INTRODUCTION Debugging is a technical procedure to find and remove bugs or defects in a program

More information

Introduction to Programming Microsoft.NET Framework Applications with Microsoft Visual Studio 2005 Course #MS4994A 5 Days COURSE OUTLINE

Introduction to Programming Microsoft.NET Framework Applications with Microsoft Visual Studio 2005 Course #MS4994A 5 Days COURSE OUTLINE COURSE OVERVIEW This five-day instructor-led course enables introductorylevel developers who are not familiar with the Microsoft.NET Framework or Microsoft Visual Studio 2005 to gain familiarity with the

More information

C# Programming in the.net Framework

C# Programming in the.net Framework 50150B - Version: 2.1 04 May 2018 C# Programming in the.net Framework C# Programming in the.net Framework 50150B - Version: 2.1 6 days Course Description: This six-day instructor-led course provides students

More information

2559 : Introduction to Visual Basic.NET Programming with Microsoft.NET

2559 : Introduction to Visual Basic.NET Programming with Microsoft.NET 2559 : Introduction to Visual Basic.NET Programming with Microsoft.NET Introduction Elements of this syllabus are subject to change. This five-day instructor-led course provides students with the knowledge

More information

Project Debugging with MDK-ARM

Project Debugging with MDK-ARM Project Debugging with MDK-ARM Notes: This document assumes MDK-ARM Version 5.xx (µvision5 ) is installed with the required ST-Link USB driver, device family pack (STM32F4xx for STM32F4-Discovery board;

More information

CSE 101 Introduction to Computers Development / Tutorial / Lab Environment Setup

CSE 101 Introduction to Computers Development / Tutorial / Lab Environment Setup CSE 101 Introduction to Computers Development / Tutorial / Lab Environment Setup Purpose: The purpose of this lab is to setup software that you will be using throughout the term for learning about Python

More information

Introduction to Microsoft.NET Framework Programming using VS 2005 (C#)

Introduction to Microsoft.NET Framework Programming using VS 2005 (C#) Introduction to Microsoft.NET Framework Programming using VS 2005 (C#) Course Length: 5 Days Course Overview This instructor-led course teaches introductory-level developers who are not familiar with the

More information

HPE.NET Add-in Extensibility

HPE.NET Add-in Extensibility HPE.NET Add-in Extensibility Software Version: 14.02 Developer Guide Go to HELP CENTER ONLINE https://admhelp.microfocus.com/uft/ Document Release Date: November 21, 2017 Software Release Date: November

More information

To get started with Visual Basic 2005, I recommend that you jump right in

To get started with Visual Basic 2005, I recommend that you jump right in In This Chapter Chapter 1 Wading into Visual Basic Seeing where VB fits in with.net Writing your first Visual Basic 2005 program Exploiting the newfound power of VB To get started with Visual Basic 2005,

More information

3 TUTORIAL. In This Chapter. Figure 1-0. Table 1-0. Listing 1-0.

3 TUTORIAL. In This Chapter. Figure 1-0. Table 1-0. Listing 1-0. 3 TUTORIAL Figure 1-0. Table 1-0. Listing 1-0. In This Chapter This chapter contains the following topics: Overview on page 3-2 Exercise One: Building and Running a C Program on page 3-4 Exercise Two:

More information

Required Setup for 32-bit Applications

Required Setup for 32-bit Applications 1 of 23 8/25/2015 09:30 Getting Started with MASM and Visual Studio 2012 Updated 4/6/2015. This tutorial shows you how to set up Visual Studio 2012 (including Visual Studio 2012 Express for Windows Desktop)

More information

The C# Programming Language. Overview

The C# Programming Language. Overview The C# Programming Language Overview Microsoft's.NET Framework presents developers with unprecedented opportunities. From web applications to desktop and mobile platform applications - all can be built

More information

COPYRIGHTED MATERIAL. Part I The C# Ecosystem. ChapTEr 1: The C# Environment. ChapTEr 2: Writing a First Program

COPYRIGHTED MATERIAL. Part I The C# Ecosystem. ChapTEr 1: The C# Environment. ChapTEr 2: Writing a First Program Part I The C# Ecosystem ChapTEr 1: The C# Environment ChapTEr 2: Writing a First Program ChapTEr 3: Program and Code File Structure COPYRIGHTED MATERIAL 1The C# Environment What s in This ChapTEr IL and

More information

Java: framework overview and in-the-small features

Java: framework overview and in-the-small features Chair of Software Engineering Carlo A. Furia, Marco Piccioni, Bertrand Meyer Java: framework overview and in-the-small features Chair of Software Engineering Carlo A. Furia, Marco Piccioni, Bertrand Meyer

More information

Hands-on Lab Session 9909 Introduction to Application Performance Management: Monitoring. Timothy Burris, Cloud Adoption & Technical Enablement

Hands-on Lab Session 9909 Introduction to Application Performance Management: Monitoring. Timothy Burris, Cloud Adoption & Technical Enablement Hands-on Lab Session 9909 Introduction to Application Performance Management: Monitoring Timothy Burris, Cloud Adoption & Technical Enablement Copyright IBM Corporation 2017 IBM, the IBM logo and ibm.com

More information

Get an Easy Performance Boost Even with Unthreaded Apps. with Intel Parallel Studio XE for Windows*

Get an Easy Performance Boost Even with Unthreaded Apps. with Intel Parallel Studio XE for Windows* Get an Easy Performance Boost Even with Unthreaded Apps for Windows* Can recompiling just one file make a difference? Yes, in many cases it can! Often, you can achieve a major performance boost by recompiling

More information

Murach s Beginning Java with Eclipse

Murach s Beginning Java with Eclipse Murach s Beginning Java with Eclipse Introduction xv Section 1 Get started right Chapter 1 An introduction to Java programming 3 Chapter 2 How to start writing Java code 33 Chapter 3 How to use classes

More information

DNWSH - Version: 2.3..NET Performance and Debugging Workshop

DNWSH - Version: 2.3..NET Performance and Debugging Workshop DNWSH - Version: 2.3.NET Performance and Debugging Workshop .NET Performance and Debugging Workshop DNWSH - Version: 2.3 8 days Course Description: The.NET Performance and Debugging Workshop is a practical

More information

Should you know scanf and printf?

Should you know scanf and printf? C-LANGUAGE INPUT & OUTPUT C-Language Output with printf Input with scanf and gets_s and Defensive Programming Copyright 2016 Dan McElroy Should you know scanf and printf? scanf is only useful in the C-language,

More information