FIX: UAE/GPF Occurs If EXE Uses Variable Length String in Type

Last reviewed: October 30, 1997
Article ID: Q93256
2.00 WINDOWS kbenv kbbuglist

The information in this article applies to:

- Microsoft Visual Basic programming system for Windows, version 2.0

SYMPTOMS

An Unrecoverable Application Error (UAE) or general protection (GP fault can occur in the resulting executable program under the following conditions:

  • Your program assigns text to a variable length string
  • The variable length string is an element of a user defined type
  • You ran the program in the Visual Basic environment immediately before you made the executable version of the program.

The UAE or GP fault occurs when the EXE is run after the VB.EXE environment has been closed. If the project used to generate the EXE is still loaded in the VB.EXE environment, the EXE will run without incident.

WORKAROUND

Load the project and compile it (make the EXE file) without executing the project first. This will create an EXE which will operate without causing the GP fault or UAE.

STATUS

Microsoft has confirmed this to be a bug in Microsoft Visual Basic programming system for Windows, version 2.0. This problem was corrected in Microsoft Visual Basic version 3.0 for Windows.

MORE INFORMATION

Steps to Reproduce Problem

  1. Start VB.EXE.

  2. Add Module1.BAS to the project by selecting New Module... from the File menu.

  3. Add the following code in Module1.BAS:

    Type VBSAMPLE

          X as String
    
    End Type Dim Y as VBSAMPLE

       Sub main ()
          Y.X = "hello"
       End Sub
    
    

  4. From the Options menu, choose Project... Double-click the text 'Form1.' A dropdown box should display the options 'Sub Main' and 'Form1.' Select 'Sub Main.' Then choose the OK button.

  5. Press the F5 key to run the example. Then from the File menu, choose Make EXE... Name the executable T1.EXE.

  6. Close VB.EXE. (You do not need to save the project, unless you want to use it for future purposes.)

  7. From the File Manager, try to run the T1.EXE program. This results in a UAE or GP fault and the loss of the mouse cursor.


Additional reference words: buglist2.00 fixlist3.00 2.00 3.00
KBCategory: kbenv kbbuglist
KBSubcategory: EnvtDes
Solution Type : kbfix


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: October 30, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.