This project is read-only.

FindThrowPlatformType Sample Walkthrough

CCI Metadata

FindThrowPlatformType is an example of a Common Compiler Infrastructure (CCI) Metadata analysis application. FindThrowPlatformType loads an assembly and determines whether it can throw a System.ArgumentNullException.
FindThrowPlatformType uses the following programming pattern. For details on how to obtain the FindThrowPlatformType sample, see How to Compile and Run FindThrowPlatformType.

Create a Host

The CCI libraries are not associated with any particular application environment. From a CCI perspective, issues such as file locations or the targeted .NET version are matters of application policy. An application host object handles the details of implementing application policies and presents the results to CCI through a standard interface.
FindThrowPlatformType uses the default host, and the host creation code is identical to that used by the HelloIL example. See Create a Host for details. For a general discussion of hosts, see Hosts.

Load the Assembly

The host’s LoadUnitFrom method loads a specified assembly and returns the contents as a CCI Metadata object. FindThrowPlatformType operates on PE files stored on the hard drive and uses DefaultHost as its host object, so it calls DefaultHost.LoadUnitFrom to load the assembly. For more discussion of how to load assemblies, see FindGeneric Sample Walkthrough.

Next: Create a Type Reference for ArgumentNullException

Last edited Jan 15, 2010 at 4:21 PM by Guy_Smith, version 1

Comments

No comments yet.