Starting the Component Inspector
The Component Inspector can either be run as a separate application or inside SharpDevelop. The standalone Component Inspector application can be found in the bin\Tools\ComponentInspector folder. The Component Inspector integrated into SharpDevelop can be viewed by selecting the menu option Tools | Component Inspector.
The user interfaces are essentially the same for both the standalone Component Inspector and the integrated version so the rest of the information presented here will specifically refer to the integrated Component Inspector.Opening an Assembly
You can open an Assembly into the Component Inspector by either selecting the menu option Inspector | Open Assembly and then browsing to the file, or by dragging the assembly from Windows Explorer onto the Component Inspector. The opened assembly is then displayed in the Assemblies/Types View and its methods, fields, properties and events can be browsed.
Previously opened assemblies are remembered by the Component Inspector and it will also show all assemblies that have been opened by SharpDevelop.Creating an Object
To create an object, select a class in the Assembly View, right click and select Create Object, or, if it is a control, drag it to the design surface. When an object has been created it appears in the Objects panel. The screenshot below shows two created objects, System.Xml.XmlDocument and NAnt.Core.Tasks.AttribTask.Creating an Object with Overloaded Constructors
If you try to create an object that has several constructors you will be prompted to choose one. If you picked one that requires no parameters then the object will be created. If it requires parameters the selected constructor will be displayed in the Parameters panel where you can supply the parameters. Alternatively you can select the constructor required from the Assemblies panel and click the Create Object button in the Parameters panel.
When the constructor requires parameters you can specify values in the Parameters panel. Clicking the Create Object button will then create an object and display it in the Objects panel. The screenshot below shows one of the System.Net.Uri class constructors selected, the url and UriKind have been entered into the Parameters panel before the object was created.
The Parameters panel also allows you to use objects already created and being displayed in the Objects panel. The screenshot below shows the use of the previously created Uri object being passed in to construct another Uri object.Adding an Object to a Collection
Once you have created a collection object, a type that implements IList, for example the System.Collections.Specialized.StringCollection class, you can then create an object and it to the collection. To add the object to the collection, select the newly created object in the Objects panel, then cut and paste the object into the collection object.Creating a Control
If you have a class that is derived from System.Windows.Forms.Control it will be created and displayed on the design surface as well as being added to the Objects panel. To create a control object, select the class in the Assemblies panel, then either drag it to the design surface, or right click and select Create Object, or click the Create Object in the Parameters panel. The screenshot below shows a System.Windows.Forms.Form object created and displayed on the design surface.Running an Application
As well as being able to create objects from an assembly you can also run a .NET application from inside the Component Inspector. An assembly that can be executed is displayed with bold text in the Assemblies panel. Select the assembly, right click and select Create Object in the same way that you would create an object. When the application has been started the object passed to the System.Windows.Forms.Application.Run method is added to the Objects panel and can be inspected.Inspecting Objects
Once an object has been created you can modify its fields, properties, call its methods and monitor its events.Setting a Field
Browse to the field in the Objects panel and then you can modify the field value from the Parameters panel. Set the field to the value you want and then click the Set Field button. Setting a Property
Changing the value of a property is done in the same way as with a field, select the property in the Objects panel, modify the value in the Parameters panel and then click the Set Prop button.Invoking a Method
Created objects can have their methods invoked or executed. From the Objects panel, select the method, enter any parameters required in the Parameters panel, and then click the Invoke Method button. If the method has a return value the result will be shown as the method node's value.Removing an Object
To remove an object select it from the Objects panel, right click and select the Delete menu option. This can be used to remove an object from a collection or from the top level objects displayed in the Objects panel.Event Logging
You can log an individual event or all events for an object. Events being monitored are added to the Events Being Logged Panel.
Log entries are added to the Event Log panel.
To log an individual event, select the event in the Objects panel, right click and select the Event Logging menu option.
To log all events for an object, select the object (not an event) in the Objects panel, right click and select the Event Logging menu option. All the events will then be added to the Events Being Logged panel.
The "Inc" column is the incarnation number and tells you what events occur due to a single action. The MouseDown event usually causes a Click event so these are given the same incarnation number.Searching
The Component Inspector can search the Objects panel and the Assemblies panel. To open up the search dialog select the menu option Inspector | Find.Opening a Type Library or ActiveX Control
A type library or ActiveX Control can be opened inside the Component Inspector either from the ActiveX panel, by selecting one of the type library nodes and expanding it, or by dragging the file from Windows Explorer onto the Component Inspector. Once opened the type library is added to the Favourite/Recently Acessed Type Libraries tree node in the ActiveX panel.Creating a COM Object
Once the type library has been opened an object can be created from any class it defines by selecting the class, right clicking and selecting Create Object. If it is a type library then the object will be added to the Objects panel. If it is an ActiveX control the control will be added to the design surface as well. Once created the object can be inspected and modified from the Objects panel.Closing an Assembly
To close an assembly, select it in the Assemblies/Types View, and then close the assembly by either right clicking and selecting Close or by selecting the menu option Inspector | Close Assembly. Note that you cannot close assemblies that have been loaded by SharpDevelop itself.Configuring the Component Inspector
Various configuration options for the Component Inspector can be viewed and set by selecting the menu option Tools | Options, then selecting the Component Inspector options.General Options
From this panel you can choose whether to display some extra panels. The Assembly panel shows all opened assemblies. The Controls panel shows all classes that are subclasses of the System.Windows.Forms.Control class. The GAC panel shows the contents of the Global Assembly Cache.
The ActiveX/COM options allow you to choose whether the COM objects in the Running Object Table are displayed on starting the Component Inspector and whether properties for COM objects are automatically read when they are displayed or only when they are clicked.Object Tree Options
The Object Tree options affect how data is displayed in the Objects panel, allowing you to show or hide properties, methods, events for the objects on display.
The "Show member categories" option will group all events together under an Events parent node in the Objects panel. Properties, methods and fields are also grouped together under their own parent group node.
The "Show base class categories" option will group all events, methods, fields and properties under a single parent node.
You can also specify whether both the above groupings, base class categories and member categories, will only occur if the total number of members exceeds a specified threshold.
The "Show Object members in base category" option determine whether the members of the standard base classes, System.Object, System.__ComObject and System.MarshalByRefObject, are always shown for an object in the Objects view.Type Handler Options
The Component Inspector has its own special handlers for IEnumerator, IList and EventHandlerList types that display the contained objects in a more user friendly way. The Type Handler options panel allows you to enable or disable the special handling of these types.