Exception Handling Basic QuickStart
This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
|The latest Enterprise Library information can be found at the Enterprise Library site.|
The Exception Handling Basic QuickStart demonstrates the following scenarios:
- Walkthrough: Propagating the Original Exception. This walkthrough demonstrates how the original exception can be processed by configured handlers before it is propagated unchanged to higher layers of the application.
- Walkthrough: Wrapping One Exception in Another. This walkthrough demonstrates how you can wrap the original exception, together with additional information, inside another exception.
- Walkthrough: Replacing One Exception with Another. This walkthrough demonstrates how you can replace the original exception with another exception.
- Walkthrough: Processing and Resuming Execution. This walkthrough demonstrates how you can use handlers to process an exception and return it to the application. This causes the application to resume executing.
The QuickStart ships as source code, which means that you must compile it before running it. You use Visual Studio to build the QuickStart.
To build the Exception Handling Basic QuickStart
- Ensure the Enterprise Library Source Code is installed.
- On the taskbar, click Start, point to All Programs, point to Microsoft patterns & practices, point to Enterprise Library 4.0 — May 2008, and then click Enterprise Library 4.0 Source Folder.
- To run the factory version of the QuickStart, open the QuickStarts folder, open the ExceptionHandling folder, and then open the CS folder (for C#) or the VB folder (for Visual Basic .NET).
- To run the version of the QuickStart that demonstrates integration with the Unity Application Block, open the QuickStarts folder, open the ExceptionHandling folder, and then open the CS-UnityIntegration folder (for C#) or the VB-UnityIntegration folder (for Visual Basic .NET).
- Double-click the ExceptionHandlingBasicQuickStart.sln solution file.
- Visual Studio opens, displaying the solution file. On the Build menu, click Rebuild Solution. By default, this is a debug build.
- Press F5 to run the QuickStart.
The walkthroughs in the Exception Handling Basic QuickStart are shipped with a defined configuration, which is included in the App.config file. This file is located in the same folder as the QuickStart project file.
To change or view these settings, use the Enterprise Library configuration tools to open the App.config file in the directory that contains the QuickStart project file. The App.config file contains the configuration data.
|This QuickStart uses a custom exception-handling provider. When the configuration tools open the QuickStart application configuration file, they attempt to load the custom exception handling provider assembly. Before you use the configuration tools to open the QuickStart configuration file, you must copy the QuickStart assembly named ExceptionHandlingBasicQuickStart.exe to the directory that contains the configuration tools.|
Each time you build the code, Visual Studio copies the App.config file to the output directory for the project (the same directory where the QuickStart executable is created) and renames it to ExceptionHandlingBasicQuickStart.exe.config.
This means that if you want to use the configuration tools to change any of the configuration settings, such as the exception message, and you are planning to rebuild the solution, you must change the settings by opening the App.config file located in the QuickStart source directory. You can change the application configuration by opening the ExceptionHandlingBasicQuickStart.exe.config file with the Enterprise Library configuration tools. However, these changes will be overwritten during the next successful build.