Changelog
The notable changes of CsCom, CsCom.Build, CsCom.Runtime and CsCom.Runtime.Dynamic, which are released together with the same version. The versions up to 2.0.0 are not described here.
4.1.0 - 2026-11-24
Changed
- Assembly metadata of the generated code: the generated code has
[assembly: AssemblyMetadata]attributes that name its type libraries, their namespaces, the types that were renamed and the namespace of the generated support code, which the export of a type library reads. They are inCsComAssemblyAttributes.cs, which is now generated for projects as well and not only by CsCom.Build, or at the top of the file with--single-file.
Added
- Type library export:
cscom typelib export <Assembly>writes the type library (.tlb) of an assembly with source-generated COM types, like TlbExp: the public[GeneratedComInterface]interfaces, the public[GeneratedComClass]classes with a[Guid], and the enumerations and structures that they use.[DispId],[ComDefaultInterface],[ComSourceInterfaces],[TypeLibType],[TypeLibFunc],[ComVisible]and[Description]are honoured, and the methods namedget_X,set_Xandputref_Xare the accessors of a property. The library refers to the types of the code that CsCom generated from type libraries, and to those of referenced assemblies whose type libraries were exported before, instead of defining them again. The options set the file, the name, the identifier, the version and the platform (win32orwin64) of the library, the referenced assemblies (--reference-path) and the files of the type libraries that it refers to (--type-library). See Exporting type libraries. - Type library export during the build: with
<CsComExportTypeLibrary>true</CsComExportTypeLibrary>, CsCom.Build exports the type library of the project after the compilation and copies it to the output and publish directories, again only when the assembly or what it refers to changed.CsComTypeLibraryReferenceitems name the type libraries that are not registered, such as that of a referenced project. - Icon: the packages and the documentation site have an icon.
- Readmes: the packages have a readme, which nuget.org shows on their pages: what the package is for, how it is used, and a link to the documentation.
Fixed
- A build failed when an input changed while the cscom tool ran: when a type library or another file that CsCom.Build
reads was written while the tool generated the code, or had a time in the future, the build failed with
CsCom: the cscom tool did not record the generated files. The build now succeeds, and the next build generates the code again.
4.0.0 - 2026-11-20
Added
- Documentation: the documentation is a site, cscom.fedarovich.com, with the API reference of CsCom.Runtime and CsCom.Runtime.Dynamic and new articles on getting started and on migrating from TlbImp; the README links to it.
4.0.0-rc.2 - 2026-11-20
Changed
- Root namespace of several sources:
project create,assembly buildandassembly packgive a project of several sources the root namespaceInterop.<Name>, e.g.Interop.Officefor-n Office(andInterop.Officefor-n Interop.Officetoo), and generate the support code of--support-code publicorinternalinto<RootNamespace>.ComSupport; both were the namespace of the first source, e.g.Interop.ExcelandInterop.Excel.ComSupport. A single source is unchanged: its namespace is the root namespace. - The support code of several sources no longer moves:
cscom.jsonrecords the root namespace, whichproject updatekeeps when the order or the number of the sources changes, also down to a single source. The support code followed the first source, also when the sources were only listed in another order. The projects of several sources of earlier versions, and the projects of a single source that get more sources, keep the namespace of their first source, which the update records.
Added
--namespacewithout a library name with several sources sets their root namespace, which was an error.project update --namespacewithout a library name also sets theRootNamespaceof the project file, when it has one, with a single source too, whose namespace it is;LIBRARY=NAMESPACEleaves the project file alone.
Fixed
- A library named like a C# keyword, e.g.
event, gets the namespaceInterop.event_: its namespace wasInterop.event, which does not compile. - A namespace that is the name of a generated type is reported as an error, e.g. the support code in
Interop.Scripting.Dictionary.ComSupportnext to the coclassInterop.Scripting.Dictionary, or the namespace of a library named like a type of another library: the generated code did not compile (CS0101).
4.0.0-rc.1 - 2026-11-20
Changed
- Interface pointers: the interface pointers in the parameters and return values of the generated interfaces are
marshalled by
ComObjectMarshaller<T>of CsCom.Runtime, which behaves likeComInterfaceMarshaller<T>of .NET unlessComMarshalling.ComWrappersis set.IUnknownpointers hadComInterfaceMarshaller<object>, the other pointers no marshaller. - Managed objects in
VARIANTs:VariantMarshallerexposes a managed object whose class is a[GeneratedComClass]itself, asVT_DISPATCHwhen it implementsIDispatch, and the object of anUnknownWrapperasVT_UNKNOWN; they were left toComVariantMarshallerof .NET.dynamicassigns both to a property withPROPERTYPUTREF, like a COM object; it assigned them by value. AnUnknownWrapperstands for its object in anIUnknownparameter, aSAFEARRAYand as the source of events too, which used a COM interface of the wrapper itself, and forComDynamicandComEnumerator.FromObject, which threw anInvalidCastException; aDispatchWrapperis rejected there with anArgumentException, like in aVARIANT. - Events:
IConnectionPointContainer.FindConnectionPointof CsCom.Runtime returns the connection point in a unique object, andEventConnectionreleases it when the sink is disconnected, so that a disconnected sink does not keep its source alive until the garbage collection.EventConnection.DisconnectreturnsS_FALSEwhile another call is disconnecting the sink, without waiting for it; it returnedS_OK, also when that call then left the sink connected. It returns any success ofIConnectionPoint::UnadviseasS_OK, so thatS_FALSEmeans nothing else. A connection that a busy server refuses to disconnect, e.g. withRPC_E_CALL_REJECTEDorRPC_E_SERVERCALL_RETRYLATER, stays connected like one that is disconnected from the wrong thread, and can be disconnected by another call; it was given up.EventConnection.IsConnectedtells whether the sink is still connected.Disconnectnever throws: the exception of a connection point that is a managed object is returned as itsHRESULT, as through COM. ADisconnectafter the connection has been given up returns the error that ended it; it returnedS_OK.EventConnectionno longer releases a connection point that a managed source returned. A source that fails with another error than one that says that it does not raise the events, e.g. a server that has ended or is busy, throws the exception of itsHRESULT, aCOMException, which can be tried again; it threw anInvalidOperationExceptionthat said that the object does not raise the events, also fordynamicobjects and the generated sinks. - Events stop at once: every connection closes its gate first when it is disconnected or cannot be established; once
it is closed, no handler call of the generated sinks and of the sinks of
AdviseDispatchstarts, also when the source could not be told and still calls the sink. - Generated sink classes implement
IAsyncDisposable, so aDisposeAsyncof your own in a partial part of one conflicts with theirs, and an event namedDisposeAsyncis renamed like the other reserved names.Disposeof the observable style completes the observables once no handler runs any more: at once, or on the thread of a running handler when it returns, where the exception of an observer fails that event call like one ofOnNext. The exception of an observer no longer stops the completion of the other observers and observables: once all of them are completed, it is thrown as it is, or in anAggregateExceptionwhen several observers threw; so doesEventSubject<T>.OnCompleted. - Events of
dynamicobjects:+=returns only when the object is connected, and throws without adding the handler when its connection fails, also when another thread adds or removes handlers at the same time; a+=that fails removes only the handler that it added, not an equal one that another thread added.-=andRemoveEventHandlersnever fail, stop the events at once, and retry a disconnection that the server refused with the next change of the handlers; any other error gives the connection up, also the exception of a connection point that is a managed object, which counts as itsHRESULT. A running event does not call a handler that was removed before the event reached it; one that it had reached can still be called after-=returns. When several threads connect the object at the same time, only one connection passes the events on: the first that receives an event, or else the first that is established; the README describes the events that can still be missed or doubled then. - Interfaces that are no COM interfaces:
ComObjectMarshaller<T>,UniqueComObjectMarshaller<T>andEventArguments.GetUnique<T>fail with aNotSupportedExceptionfor an interface that is not a[GeneratedComInterface], also fornull, and the marshallers with anObjectDisposedExceptionfor a COM object that has been released.ComActivatorfails with theNotSupportedExceptiontoo, also for a class other thanobjectandComObject, e.g. a late-bound wrapper, before anything else: before it looks up a ProgID, creates or gets the object; it threw anInvalidCastExceptionafter starting the server. - Enumerators: when
SetMarshallingmakes_NewEnumunique, theGetEnumerator()of a generated interface releases the enumerator of a COM object when it is disposed, e.g. at the end offoreach, also the COM object of a late-bound wrapper when_NewEnumreturns a dispinterface; one that a managed implementation of the interface returns is not released, nor is a wrapper of yours that is exposed to COM.ComEnumeratorhas a constructor and aFromObjectoverload withownsEnumeratorfor it. Without it,Dispose()still does nothing.FromObjecttakes what a value stands for, likeComMarshalling.Release: the COM object of a late-bound ordynamicwrapper, which it releases withownsEnumerator, and an object that is exposed to COM itself or, when it is no enumerator, through theDispatchthat it provides, which it never releases. When asking a COM object forIEnumVARIANTfails with another error thanE_NOINTERFACE, e.g. of a server that has ended,FromObjectthrows the exception of itsHRESULT; it threw anInvalidCastExceptionthat said that the object does not implementIEnumVARIANT. - Late-bound wrappers and
dynamicobjects passed to anIUnknownparameter of a generated interface are passed as their COM objects, as in aVARIANT; such a parameter got a COM interface of the managed wrapper. So is a late-bound wrapper of yours in a parameter of a COM interface that it implements itself, e.g.IDispatchby forwarding to itsDispatch, whose COM object is asked for the interface, or the COM object that an object of yours in itsDispatchprovides; it failed with anInvalidCastException. A COM object that failsQueryInterfacewith another error thanE_NOINTERFACEthere, e.g. the proxy of a server that has ended, throws the exception of itsHRESULT; it threw anInvalidCastExceptionthat said that the object does not implement the interface. A managed object that is exposed to COM ([GeneratedComClass]) is passed itself, also when it implementsIDispatchProvider, in aVARIANT, aSAFEARRAYand anIUnknownparameter alike, so that its pointer converts back to it; aVARIANTheld itsDispatch. ASAFEARRAYofIDispatchstill gets itsDispatchwhen it does not implementIDispatchitself. As the source of events, such an object is connected itself when it implementsIConnectionPointContainer, and itsDispatchotherwise, as it always was. A late-bound wrapper converts it back to an interface that it implements, and otherwise asks the COM object of itsDispatch; a dispinterface wrapper,ComDynamicand the results ofdynamiccalls wrap it itself when it implementsIDispatch, events included, and itsDispatchotherwise. Such a wrapper stands for it with the same rule, also as the source of events, inComEnumerator.FromObjectand in the conversions of late-bound wrappers to interfaces. A late-bound wrapper of your own that is such an object is passed itself as a parameter of its type too when it implementsIDispatch, and converts back to itself. The pointer of such an object converts back to it only for an interface that it implements: for another declaration of the interface, e.g. of another interop assembly, it gets a COM object of its own, which calls it through COM: a new one for each conversion, also of a shared parameter, whichComMarshalling.Releasereleases. It failed with anInvalidCastException, as withComInterfaceMarshaller<T>of .NET. Such an object that comes back from aVARIANTor aSAFEARRAYitself gets a COM object of its own too where a late-bound wrapper,EventArguments.Get<T>or an array converts it to another declaration of the interface, e.g. an argument of a dual event that the source raises throughIDispatch::Invoke; it failed with anInvalidCastException. IDispatchWrapper<T>derives fromIDispatchProvider, which declares itsDispatchproperty, so that a late-bound wrapper of your own is passed as its COM object and released byComMarshalling.Releaselike a generated one; aVARIANTrejected it, and anIUnknownparameter got a COM interface of the wrapper. A wrapper that implementsIDispatchWrapper<T>.Dispatchexplicitly implementsIDispatchProvider.Dispatchinstead.SetMarshallingwarns that nothing matches when none of its attributes applies to the matching types: onlySafeArraysapplies to dispinterfaces, and onlyDates,Currencies,BooleansandBstrsto structures;Interfacesonly applies to interface pointers that are not passed in and out. Such an element had no effect and no warning.
Added
- Unique objects: the methods of
ComActivator(CreateInstance<T>,CreateDispatchInstance<T>,GetActiveInstance<T>,TryGetActiveInstance<T>andBindToMoniker<T>) have overloads with auniqueparameter, which return a COM object in a managed object of its own, and so hasCreateof the generated coclasses, e.g.Dictionary.Create(unique: true).ComMarshalling.Releaseof CsCom.Runtime, likeComObject.FinalRelease()of .NET, releases such an object at once, without waiting for the garbage collector; it also takes a late-bound wrapper and the object of anUnknownWrapper, rejects aDispatchWrapper, and leaves a managed object that is exposed to COM ([GeneratedComClass]) alone, also when it implementsIDispatchProvider;ComMarshalling.IsExposedToComtells whether an object is one. A unique object whose COM object does not implement the requested interface is released before theInvalidCastExceptionis thrown. - Unique interface pointers: the
Interfacesattribute ofSetMarshallingselectsuniqueobjects for the interface pointers of single methods and parameters, withUniqueComObjectMarshaller<T>of CsCom.Runtime. Such an object belongs to the code that receives it. A pointer that is passed in and out (ref) is always a shared object, because it is passed back. A handler of a dual event interface gets the unique object also when the event is raised throughIDispatch::Invoke, whichEventArguments.GetUnique<T>andGetUniqueWrapper<T>read from itsVARIANT. - Custom
ComWrappers:ComMarshalling.ComWrapperssets theStrategyBasedComWrappersthat creates the managed objects of the generated code and of the support code: of the interface pointers of the generated interfaces, ofComActivator, ofVARIANTs andSAFEARRAYs, of the late-bound wrappers and of the event sinks. - Event gates: every
EventConnectionhas anEventGateof its own, which a sink enters withTryEnterand exits withExitaround each handler call.EventConnection.Advise(source, iid, Func<EventGate, object>)creates a hand-written sink with the gate of its connection, andDispatchEventSink.InvokeHandler(gate, handler, …)passes an invocation ofIDispatch::Invoketo a handler through the gate.EventConnection.DisposeAsyncandDisposeAsyncof the generated sink classes disconnect, and complete when no handler call that entered the gate is running any more; the observable style then completes the observables, in the synchronization context of the caller. UnlikeDispose, they throw aCOMExceptionthen when the sink could not be disconnected, e.g. after anawaitthat resumed on another thread than that of a single-threaded apartment object, and no other call has disconnected it by then; when an observer throws too, the observable style throws both in anAggregateException, theCOMExceptionfirst.EventConnection.DisposeWithCompletion(Action completion)disconnects without waiting, and calls the completion then: at once, or on the thread of the last running handler call when it returns. The completions run one at a time, in the order of the calls, and an exception of one does not stop the others.EventSubject.CompleteandEventSubject.CompleteAfterAsync, of the new base class ofEventSubject<T>, complete several observables that way.
Fixed
- Collections whose
_NewEnumreturns a dispinterface: theGetEnumerator()of a generated interface andComEnumerator.FromObjectenumerate the COM object of the late-bound wrapper; they threw anInvalidCastException. - Objects and arrays passed by reference in
VARIANTs: an object passed by reference whose pointer is null, like aByRefobject variable of Visual Basic that isNothing, isnull, and so is an object, an array or aVARIANTpassed by reference without a reference, also as the argument of an event; they failed. - The
publicandinternalsupport code compiles when a type of the library or of the application in or around its namespace has the name of a type of .NET that it uses, e.g.Actionof Excel,Exceptionof Outlook orTaskof Word, also with aCsComSupportNamespaceof your own, and when a namespace around it is namedSystem: it names the types of .NET withglobal::and calls their extension methods through their classes, and imports them in its own namespace. EventConnection.AdviseDispatchwith the identifier ofIDispatch, e.g. for a source whose generic connection point raises the events throughIDispatchitself, overflowed the stack: the sink asked itself forIDispatchwithout end.- Exceptions of the handlers of dispinterface events (
DispatchEventSink.InvokeHandler): one whoseHResultis no error code, e.g. aCOMExceptionofS_FALSE, is returned to the source asE_FAIL, also in the error information; the source took it for a success. One whoseMessagethrows is returned without its description; the event call failed with the exception of the message instead, and leaked the string of its source.
3.0.0 - 2026-11-13
Changed
- Named indexers of late-bound wrappers: the indexer of the proxy of a property that only has a setter declares the
default values of its optional indexes, e.g.
sheet.Note["A1"] = textwith an optional second index.
Fixed
- Null objects in
VARIANTs: aVARIANTof the type of an object whose pointer is null, likeNothingof Visual Basic, isnull; it failed with anArgumentNullException, e.g. as the result of a late-bound call, as anoutobject that the callee leaves null, or as an argument of an event. - Late-bound calls: the
COMExceptionof an error without any code isDISP_E_EXCEPTION; since 3.0.0-rc.1 it was0x800A0000. - The class of the marshallers of the arrays with a known rank,
CsComSafeArrayMarshallers, could have the name of a type of the library; it gets a trailing underscore then, like the other generated types. - An interface that derives from an interface without methods whose own base interface has no GUID got no placeholders for the vtable slots of that base, so its methods were called at the wrong slots.
assembly buildandassembly pack: since 3.0.0-rc.1,dotnetwas taken fromDOTNET_ROOTbefore the directories ofPATH, which fails whenDOTNET_ROOTis an installation without the SDK;PATHcomes first again. Ctrl+C had no visible effect while the code was generated; a second Ctrl+C now ends the tool at once.DispatchObject.InvokeByRefandInvokeMethodByRefwithout the types of the arguments failed with anIndexOutOfRangeExceptionwhen the object rejected an argument with a type mismatch; theCOMExceptionis thrown again.
3.0.0-rc.1 - 2026-11-13
Changed
- Property setters with optional indexes: a
nulloptionalVARIANTindex of a setter is omitted, like that of the getter; it was passed as an emptyVARIANT. This applies to theset_andputref_methods of the interfaces and the late-bound wrappers and to the indexers that call them. The index parameters of the setter methods stay required in C#, since the value follows them. - Late-bound calls: the
COMExceptionof an error that only has a 16-bit code (wCode), as Basic raises them, has theHRESULTthat Visual Basic gives it, e.g.0x800A000Bfor the error 11; it was0x8004000B. assembly buildandassembly pack: Ctrl+C stops the build with the processes that it started and deletes the temporary project, which was left behind. The temporary projects that are kept (--keep-temp, or a build that failed) are deleted by a run of these commands a week later.
Added
AssemblyGenerator.BuildAssemblyandPackAssemblytake aCancellationToken.
Fixed
- A method named like its interface made the generated interface fail to compile; it gets a trailing underscore, like the members of the late-bound wrappers already did.
- The types that are generated next to an interface (the extensions class, the event handler interface, the event sink and
the delegates or the classes of the event arguments) could have the name of a type of the library, e.g.
IShapeExtensions. Such a generated type gets a trailing underscore. - An
objectfield withoutMarshalAsof a structure of an interop assembly was read as aVARIANT, which gave the structure the wrong layout. The runtime marshals it as anIUnknownpointer, and so does the generated structure; a field withUnmanagedType.Struct, which TlbImp writes, stays aVARIANT. - CsCom.Build: the generated files of an output folder (
CsComOutputPath) whose path has a%followed by two hexadecimal digits, e.g.Generated%20Code, were passed to the compiler with the wrong paths. A project whose own directory has such a name cannot be built anyway: the .NET SDK fails to restore it. - An event sink cleared the result variable of the source before it set the result of an event, which fails or frees memory that is not allocated when the source did not initialize the variable. The sinks initialize it now, and a handler that fails leaves no result behind.
3.0.0-beta.2 - 2026-11-12
Changed
- CsCom.Build: the state of the generation (
cscom.state,cscom.request.json) is always kept in the intermediate output. A folder of the project that the code is generated into (CsComOutputPath) only gets the generated files, and the state files that earlier versions wrote there are deleted. A rebuild now generates the code again in that mode. - CsCom.Build: the code is generated before the build records the items of the compiler, so the build after the first generation no longer compiles the project again.
cscom.jsonrecords the type libraries and interop assemblies of the project directory by their relative paths, so a project can be updated from another copy of its directory. Files outside of the directory keep their full paths.project createfails when a package source or a packages folder is specified and the directory already has anuget.config, which it used to replace.SetTypeonly requires itsTotype when something matches its selectors; otherwise it reports that nothing matches, like the other transformers.Tocan name a type of another library that is generated with the library.- Late-bound wrappers pass a by-reference
SAFEARRAYas a reference to aVARIANTfirst and, when the object rejects that argument, as a reference to theSAFEARRAYof the declared type. - Generated interfaces: an
[out, retval] void*parameter stays a parameter and is no longer returned as avoid*. - Generated interfaces: a default value that does not fit the type of its parameter is not generated; the parameter is
required. A value stored as an unsigned number with the bits of a 32-bit value keeps its bits, e.g.
0xFFFFFFFFis-1. - Registered type libraries: the highest registered version whose file exists is used, whichever view of the registry (64-bit or 32-bit) it is in.
- The merged models of library sets (
LibrarySetGenerator.Transform) have no imported types:ImportedFromis cleared like the lists of the imported libraries and files.TypeDefinition.ImportedFromcan be set.
Added
LibrarySetGenerator.Transformhas an overload that returns the files that were read.TransformationContext.Libraries: the models of the libraries that are generated together.EventConnection.Disconnectreturns theHRESULTof the disconnection. A connection that could not be disconnected from another thread (RPC_E_WRONG_THREAD) stays usable and can be disconnected from the right thread.BuildRequest.StateDirectoryand theStateDirectoryparameter of theCsComGeneratetask.
Fixed
- The references to an interface without a GUID, which is not generated, made the generated code fail to compile. Pointers
to it are now
IUnknownorIDispatchpointers, and an interface that derives from it gets placeholders for its vtable slots. SafeArrayMarshaller<T>failed to convert the returned arrays ofComDate,ComCurrencyandComBool.ComDispatch.Invokewith arguments passed by reference and no output failed after the member was invoked; the output is checked before the invocation.- A COM object implemented in .NET that replaced the
SAFEARRAYof an[in, out]parameter leaked the new array when the array of the caller could not be destroyed. - The tool ran
dotnetby its name whenDOTNET_HOST_PATHwas not set, which Windows looks for in the current directory first. It is now run by its full path. - The file of a type or the folder of a namespace named after a device, e.g.
AuxorCon, could not be written; such files and folders get a trailing underscore, e.g.Aux_.cs. - A help string with a Unicode line or paragraph separator or a next-line character ended its documentation comment, so the rest of it was generated as code.
- A dispinterface property that a configuration renamed to the former name of a renamed method got the new name of the method.
- A
SAFEARRAYwhose number of elements does not fit a .NET array is rejected; the number was computed without a check. - Setting a
VARIANTelement of aSAFEARRAYwhose old value cannot be cleared leaked the new value. - The event sink of a source interface that derives from
IEnumVARIANTdid not implement the methods ofIEnumVARIANT, so the generated code failed to compile. They returnE_NOTIMPL.
3.0.0-beta.1 - 2026-11-12
Code generated by an earlier version must be generated again and used with the CsCom.Runtime of this version.
Changed
- Late-bound wrappers pass
refandoutarguments as references of the types of the parameters, e.g.VT_BYREF | VT_I4for along*, which the objects that check the arguments with their type information require. The generated code calls new overloads ofDispatchObject.InvokeMethodByRefandInvokeByRef. - Late-bound wrappers pass a single array argument as one argument; its elements were passed as separate arguments.
[lcid]parameters of interface methods default to0x0400(LOCALE_USER_DEFAULT), so the optional parameters before them keep their default values. Properties and indexers pass this value and no longer have the[lcid]parameter as an index.VARIANTparameters with a default value of interface methods are required: C# cannot express the value as the default of anobjectparameter, and nothing applies it in a call through the vtable. With--overloads-for-default-values, an overload passes the value.- Pointer parameters without
[in]and[out]arerefparameters, like those of TlbImp; they wereinparameters or, in late-bound wrappers, passed by value. - Interfaces derived from
IEnumVARIANTderive from it, so that their methods have the right vtable slots. dynamic: with the type information of the object, a method that is read without parentheses is not invoked but gives a value to call, and a property whose getter takes arguments is indexed with them, also when all of them are optional (range.Value[...]). A property whose read once failed withDISP_E_MEMBERNOTFOUNDis read again later, and an object is assigned by value only when the property has no setter by reference.project updateonly sets theLangVersionof the project file with--csharp-version, and keeps the text and the encoding of the parts of the project file that it does not change. Thereferencecommands keep them too.- Generated files: only the files that CsCom generated are deleted from the
CsComOutputPathof CsCom.Build and from theGeneratedfolder of a directory that a project is created in.project updatestill replaces theGeneratedfolder. ExcludeTyperefuses to remove a structure that is the element of an array passed by pointer, e.g. of aSAFEARRAY(Record)*retval.- One-dimensional arrays of
byte,ushort,uintandulongareSAFEARRAYs of the unsigned types; they were created with the signed types. Achar[]is no longer accepted. - An omitted optional
VARIANTthat an interface implemented in .NET receives isnull, not the integer ofDISP_E_PARAMNOTFOUND. InvokePutRefof the late-bound wrappers assigns by value when the object has no setter by reference.- CsCom.Build: the state file ends with an
endline, so the code is generated once again after the update. - New warnings: a type that is renamed because another type has its name, the copy of a type of another version of a library, and a structure of an interop assembly whose packing is less than the alignment of its fields.
Added
ComDispatch.GetMemberKindsandDispatchMemberKinds: how the type information of an object describes a member.--package-sourceaccepts the URL of a feed.- CsCom.Build: the warnings of the generator are reported by every build, also by those that do not run it; the files that the generator read are inputs of the fast up-to-date check of Visual Studio; and the compiler runs again after a generation that only deleted files.
Fixed
- Aliases of pointers to, or arrays of, other aliases left references to aliases that were removed from the model.
- The reader marked the
[lcid]and[retval]parameters and the value of a property setter as optional in place of the optional parameters before them. - A pointer to an interface that a type library declares with the identifier of
IUnknownorIDispatchwas read as a pointer to an interface pointer. - A type library that uses a library that is not registered failed with an unexpected error that named no type.
- An interop assembly with a parameter or a source interface of another kind of interface, e.g. an
IInspectableone, failed to be read. - Rename patterns that can match nothing, e.g.
(.*), added the new name twice. - The copies of the types that another version of a library imported could get the name of a type of the library.
- A handler that left a by-reference string, object or array argument of an event
nullmade the event fail before the arguments that follow were written back. - The finalizer of a
ComSafeArray<T>or aComBstrcould release it while one of its members was still using it. - An input file that changed while the generator of CsCom.Build ran was recorded as up to date, and a state file whose writing was interrupted was accepted.
- Empty values of
--config,--reference-pathand--output, a regular expression that takes too long, and a generated file outside of its folder were reported as unexpected errors.
3.0.0-alpha1 - 2026-11-12
The changes since 2.0.0.
Changed
- Late-bound wrappers and dispinterface events: a one-dimensional
SAFEARRAYof an enum is an array of the enum, e.g.Color[], like in the early-bound interfaces; it was aSystem.Array. This changes the types of the generated members. Enums referenced through aliases are recognized too. - Late-bound wrappers: the one-dimensional typed
SAFEARRAYs that a server returns are converted element by element, so aSAFEARRAYofVARIANTs that VB or a script returns for aSAFEARRAY(BSTR)no longer fails. - Arrays: an array is only returned as it is when it has exactly the requested type; an
int[]was returned as an array of an enum and astring[]as anobject[], because the runtime considers them compatible. The same applies to therefandoutvariables ofdynamiccalls and to the arguments ofdynamicevent handlers. dynamic: the named arguments of indexes (d[...],d.Name[...]and their assignments) and of invocations of the default member (d(...)) are resolved by their names; they were passed in the order of the call. Named arguments of the default member of an object without type information throwNotSupportedException.- Modules: the unsigned
VARIANTconstants get the first ofint,uint,longandulongthat can hold them, like C# integer literals; a value aboveint.MaxValuedid not compile and one abovelong.MaxValuewas dropped. - The merged models of library sets (
LibrarySetGenerator.Transform) no longer list the files of the libraries that their types were imported from.
Added
DispatchObject.ToArray<T>, which converts the elements of a returned array.ComDispatch.GetMemberName, which reads the name of a member from the type information of an object.TypeLibrary.ImportedFiles: the files of the libraries that a model imports types from.
Fixed
- The overloads for default values passed
Missing.Valuefor everyVARIANTparameter: the code of by-referenceVARIANTs did not compile, and anullrequiredVARIANTwas sent as an omitted argument. - Reading a
decimaldefault value of an interop assembly whose parts are 2^31 or more failed. - The property accessors of dispinterfaces with by-reference parameters were invoked as methods, which objects reject,
and their setters did not pass the value as the
DISPID_PROPERTYPUTargument. - CsCom.Build did not generate the code again when a library that types are imported from changed, e.g. the type library of Office for Excel or an assembly of the reference path.
- An event named
connectionor__connectionmade the generated event sink fail to compile. - Index parameters named
valuenext tovalue_got the same name in the generated indexers. dynamicevent handlers and the default member with named arguments read signatures and type information on every call; they are read once.