Previous | Index | Next 

[PRB] .NET 4.0 TlbImp tool generates wrong wrappers for optional Boolean parameters

Assume that the VB6 project being migrated references a COM DLL or type library that exposes the following function:

    Public Function DoSomething(Optional ByVal boolValue As Boolean = False) As Integer

When migrating on a computer that only has Visual Studio 2005 and 2008 all works well. However, when running on a computer that only has Visual Studio 2010 a problem occurs, because the .NET TlbImp tool that comes with .NET 4 mistakenly converts the function as follows:

    Public Function DoSomething(Optional ByVal boolValue As Boolean = True) As Integer

This bug is documented in this article, which explains that the bug has been solved in Visual Studio 2011.

The only solution for this problem is installing the TlbImp tool that comes with a previous version of .NET, and then forcing VB Migration Partner to use that version.

 

Previous | Index | Next