C# (CSharp) Microsoft.Scripting.ComInterop Namespace

Classes

Name Description
ArgBuilder ArgBuilder provides an argument value used by the MethodBinder. One ArgBuilder exists for each physical parameter defined on a method. Contrast this with ParameterWrapper which represents the logical argument passed to the method.
BoolArgBuilder
BoundDispEvent
ComBinder Provides helper methods to bind COM objects dynamically.
ComBinder.ComGetMemberBinder Special binder that indicates special semantics for COM GetMember operation.
ComBinderHelpers
ComClassMetaObject
ComDispIds
ComEventDesc
ComEventSink This class implements an event sink for a particular RCW. Unlike the implementation of events in TlbImp'd assemblies, we will create only one event sink per RCW (theoretically RCW might have several ComEventSink evenk sinks - but all these implement different source intefaces). Each ComEventSink contains a list of ComEventSinkMethod objects - which represent a single method on the source interface an a multicast delegate to redirect the calls. Notice that we are chaining multicast delegates so that same ComEventSinkMedhod can invoke multiple event handlers). ComEventSink implements an IDisposable pattern to Unadvise from the connection point. Typically, when RCW is finalized the corresponding Dispose will be triggered by ComEventSinksContainer finalizer. Notice that lifetime of ComEventSinksContainer is bound to the lifetime of the RCW.
ComEventSink.ComEventSinkMethod Contains a methods DISPID (in a string formatted of "[DISPID=N]" and a chained list of delegates to invoke
ComEventSinkProxy ComEventSinkProxy class is responsible for handling QIs for sourceIid on instances of ComEventSink. Background: When a COM even sink advises to a connection point it is supposed to hand over the dispinterface. Now, some hosts will trust the COM client to pass the correct pointer, but some will not. E.g. Excel's implementation of Connection Points will not cause a QI on the pointer that has been passed, however Word will QI the pointer to return the required interface. ComEventSink does not, strongly speaking, implements the interface that it claims to implement - it is just "faking" it by using IReflect. Thus, Word's QIs on the pointer passed to ICP::Advise would fail. To prevent this we take advangate of RealProxy's ability of "dressing up" like other classes and hence successfully respond to QIs for interfaces that it does not really support( it is OK to say "I implement this interface" for event sinks only since the common practice is to use IDistpach.Invoke when calling into event sinks).
ComFallbackMetaObject
ComHresults
ComInvokeAction Invokes the object. If it falls back, just produce an error.
ComInvokeBinder
ComMetaObject
ComMethodDesc
ComObject This is a helper class for runtime-callable-wrappers of COM instances. We create one instance of this type for every generic RCW instance.
ComRuntimeHelpers
ComTypeClassDesc
ComTypeDesc
ComTypeEnumDesc
ComTypeLibDesc
ComTypeLibInfo
ComUnwrappedMetaObject
ConversionArgBuilder
ConvertArgBuilder
ConvertibleArgBuilder
CurrencyArgBuilder
DispCallable This represents a bound dispmember on a IDispatch object.
DispatchArgBuilder
ExcepInfo
IDispatchComObject An object that implements IDispatch This currently has the following issues: 1. If we prefer ComObjectWithTypeInfo over IDispatchComObject, then we will often not IDispatchComObject since implementations of IDispatch often rely on a registered type library. If we prefer IDispatchComObject over ComObjectWithTypeInfo, users get a non-ideal experience. 2. IDispatch cannot distinguish between properties and methods with 0 arguments (and non-0 default arguments?). So obj.foo() is ambiguous as it could mean invoking method foo, or it could mean invoking the function pointer returned by property foo. We are attempting to find whether we need to call a method or a property by examining the ITypeInfo associated with the IDispatch. ITypeInfo tell's use what parameters the method expects, is it a method or a property, what is the default property of the object, how to create an enumerator for collections etc. 3. IronPython processes the signature and converts ref arguments into return values. However, since the signature of a DispMethod is not available beforehand, this conversion is not possible. There could be other signature conversions that may be affected. How does VB6 deal with ref arguments and IDispatch? We also support events for IDispatch objects: Background: COM objects support events through a mechanism known as Connect Points. Connection Points are separate objects created off the actual COM object (this is to prevent circular references between event sink and event source). When clients want to sink events generated by COM object they would implement callback interfaces (aka source interfaces) and hand it over (advise) to the Connection Point. Implementation details: When IDispatchComObject.TryGetMember request is received we first check whether the requested member is a property or a method. If this check fails we will try to determine whether an event is requested. To do so we will do the following set of steps: 1. Verify the COM object implements IConnectionPointContainer 2. Attempt to find COM object's coclass's description a. Query the object for IProvideClassInfo interface. Go to 3, if found b. From object's IDispatch retrieve primary interface description c. Scan coclasses declared in object's type library. d. Find coclass implementing this particular primary interface 3. Scan coclass for all its source interfaces. 4. Check whether to any of the methods on the source interfaces matches the request name Once we determine that TryGetMember requests an event we will return an instance of BoundDispEvent class. This class has InPlaceAdd and InPlaceSubtract operators defined. Calling InPlaceAdd operator will: 1. An instance of ComEventSinksContainer class is created (unless RCW already had one). This instance is hanged off the RCW in attempt to bind the lifetime of event sinks to the lifetime of the RCW itself, meaning event sink will be collected once the RCW is collected (this is the same way event sinks lifetime is controlled by PIAs). Notice: ComEventSinksContainer contains a Finalizer which will go and unadvise all event sinks. Notice: ComEventSinksContainer is a list of ComEventSink objects. 2. Unless we have already created a ComEventSink for the required source interface, we will create and advise a new ComEventSink. Each ComEventSink implements a single source interface that COM object supports. 3. ComEventSink contains a map between method DISPIDs to the multicast delegate that will be invoked when the event is raised. 4. ComEventSink implements IReflect interface which is exposed as custom IDispatch to COM consumers. This allows us to intercept calls to IDispatch.Invoke and apply custom logic - in particular we will just find and invoke the multicast delegate corresponding to the invoked dispid.
IDispatchMetaObject
NativeMethods
NullArgBuilder ArgBuilder which always produces null.
SimpleArgBuilder SimpleArgBuilder produces the value produced by the user as the argument value. It also tracks information about the original parameter and is used to create extended methods for params arrays and param dictionary functions.
SplatCallSite
SplatInvokeBinder Splats the arguments to another nested dynamic site, which does the real invocation of the IDynamicMetaObjectProvider.
StringArgBuilder
TypeEnumMetaObject
TypeLibInfoMetaObject
TypeLibMetaObject
TypeUtils
UnsafeMethods This class contains methods that either cannot be expressed in C#, or which require writing unsafe code. Callers of these methods need to use them extremely carefully as incorrect use could cause GC-holes and other problems.
VarEnumSelector
Variant
Variant.Record
Variant.TypeUnion
Variant.UnionTypes
VariantArgBuilder
VariantArray
VariantArray1
VariantArray2
VariantArray4
VariantArray8
VariantBuilder VariantBuilder handles packaging of arguments into a Variant for a call to IDispatch.Invoke