BUG: Type Library Importer Imports VARIANT_BOOL Field as Int16 (317203)
The information in this article applies to:
- Microsoft .NET Framework 1.1
- Microsoft .NET Framework 1.0
This article was previously published under Q317203 SYMPTOMS When you import a structure that contains a field of type VARIANT_BOOL that is defined in a type library into a managed application,
either by using Tlbimp.exe or by adding a reference to the COM server from
Microsoft Visual Studio .NET, Tlbimp.exe or Visual Studio .NET converts this
field into an int16 data type instead of a bool data type. This does not occur if you declare a method parameter
as VARIANT_BOOL. RESOLUTION To resolve this problem, edit the interop assembly. To do
this, follow these steps:
- At a command prompt, use Tlbimp.exe to create an interop
assembly, as follows:
TLBIMP.exe COMServer.dll /out:iop.COMServer.dll - At a command prompt, use Ildasm.exe to generate the
Microsoft intermediate language (MSIL) code for the interop assembly, as
follows:
ILDASM.exe iop.COMServer.dll /out:iop.COMServer.il - Open Iop.comserver.il in Notepad or another text editor.
Locate the structure and the field that you need to edit, and then change int32 to bool.
- At a command prompt, use the MSIL Assembler (ILASM) to
create a new interop assembly, as follows:
ILASM /dll iop.COMServer.il
STATUSMicrosoft has confirmed that this is a bug in the Microsoft
products that are listed at the beginning of this article.
REFERENCES For more information, visit the following Microsoft Developer Network (MSDN) Web site:
Modification Type: | Major | Last Reviewed: | 8/13/2003 |
---|
Keywords: | kbCOMInterop kbbug kbnofix KB317203 |
---|
|