BUG: A "The memory could not be 'read'" error or a "Freedom Engine COM Server has encountered a problem" error may occur when you upgrade a Visual Basic 6.0 project to Visual Basic .NET (837226)



The information in this article applies to:

  • Microsoft Visual Basic .NET (2003)
  • Microsoft Visual Basic .NET (2002)

SYMPTOMS

When you use the Microsoft Visual Basic .NET Upgrade Wizard to upgrade a Microsoft Visual Basic 6.0 project that contains conditional compilation directives, you may receive either of the following error messages.

Error Message 1

The instruction at "0x73d71805" referenced memory at "0x00000000". The memory could not be "read".

Click on OK to terminate the program
Click on CANCEL to debug the program
If you click OK, the Visual Basic .NET Upgrade Wizard does not quit.

Error Message 2

Freedom Engine COM Server has encountered a problem and needs to close.

CAUSE

You may notice this problem if your Visual Basic 6.0 code contains several blank lines before the conditional compilation directives. Typically, you may notice this problem if your code contains at least two conditional compilation blocks and at least three blank lines before each conditional compilation directive.

Note You may notice this problem even if your code does not contain any blank lines before the first conditional compilation directive.

WORKAROUND

To work around this problem, remove all blank lines that are present before any conditional compilation directives in your Visual Basic 6.0 code.

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed in the "Applies to" section.

MORE INFORMATION

Steps to reproduce the behavior

  1. To create a Visual Basic 6.0 project that contains conditional compilation directives, follow these steps:
    1. Start Visual Basic 6.0.
    2. On the File menu, click New Project. The New Project dialog box appears.
    3. Click ActiveX DLL, and then click OK. The Project1 - Class1 (Code) window appears.
    4. Add the following code to the Class1 class file:
      #If Flag1 Then
      Public Test1 As Boolean
      
      
      
      #End If
      
      
      
      #If Flag2 Then
      Public Test2 As Boolean
      
      
      
      #End If
    5. On the File menu, click Save Class1. The Save File As dialog box appears.
    6. Click Save.
    7. On the File menu, click Save Project. The Save Project As dialog box appears.
    8. Click Save.
  2. Start Microsoft Visual Studio .NET.
  3. On the File menu, point to Open, and then click Project. The Open Project dialog box appears.
  4. Locate, and then click the Visual Basic 6.0 project that you saved in step 1h, and then click Open. Page 1 of the VisualBasic .NET Upgrade Wizard appears.
  5. Click Next on page 1, click Next on page 2, and then click Next on page 3 of the Visual Basic .NET Upgrade Wizard. Click Yes when you are prompted to create a new folder.
  6. Click Next on page 4 of the Visual Basic. NET Upgrade Wizard to display page 5 of the Visual Basic .NET Upgrade Wizard. The behavior that is mentioned in the "Symptoms" section occurs.

REFERENCES

For more information, visit the following Microsoft Developer Network (MSDN) Web sites:

Preparing Your Visual Basic 6.0 Applications for the Upgrade to Visual Basic .NET
http://msdn.microsoft.com/library/en-us/dnvb600/html/vb6tovbdotnet.asp
#If...Then...#Else Directives
http://msdn.microsoft.com/library/en-us/vblr7/html/vadirIf.asp
Lab 5: Using the Visual Basic Upgrade Wizard
http://msdn.microsoft.com/library/en-us/dv_vstechart/html/vstchexpvsnetlab5.asp


Modification Type:MinorLast Reviewed:2/9/2006
Keywords:kbvs2005swept kbvs2005doesnotapply kbvs2002sp1sweep kbwizard kbUpgrade kbbug KB837226 kbAudDeveloper