BUG: Visual Basic Compiler Pads Embedded Resources to Align on 32-Bit Dword Boundaries

Article translations Article translations
Article ID: 297112 - View products that this article applies to.
This article was previously published under Q297112
This article has been archived. It is offered "as is" and will no longer be updated.
Expand all | Collapse all

On This Page

SYMPTOMS

If you compile XML or XSL resources in your Microsoft Visual Basic project, XML or XSL parsers may not be able to parse the XML or XSL document from the resources embedded in the Visual Basic executable file.

CAUSE

The Visual Basic compiler pads embedded resources to align on 32-bit dword boundaries with "0" (zero) characters. Because 0 is not a valid character in XML or XSL, XML or XSL parsers may consider documents that contain 0s as invalid documents.

RESOLUTION

A supported hotfix is now available from Microsoft, but it is only intended to correct the problem that this article describes. Apply it only to systems that are experiencing this specific problem.

Note You must have a Visual Studio license agreement to obtain this hotfix.

To resolve this problem, contact Microsoft Product Support Services to obtain the hotfix. For a complete list of Microsoft Product Support Services telephone numbers and information about support costs, visit the following Microsoft Web site:
http://support.microsoft.com/contactus/?ws=support
Note In special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve your problem. The usual support costs will apply to additional support questions and issues that do not qualify for the specific update in question. The English version of this fix should have the following file attributes or later:
   Date              Version      Size      File name    
   ----------------------------------------------------
   04/23/2001        6.0.91.15    1.78 MB   VB6.EXE  
   04/23/2001        6.0.0.8965   1.62 MB   VBA6.dll
				

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

MORE INFORMATION

Steps to Reproduce Behavior

  1. Use Microsoft Notepad to create an XML file named Test.xml and copy the following text into the file:
    <XML>
    <Name>Test Name </Name>
    </XML>
    					
  2. Use Notepad to create a new file named Test.rc and copy the following text into the file. Make sure this file is in the same folder as Test.xml.
    TEST.XML          HTML    DISCARDABLE     "TEST.XML"
    					
  3. With the working directory set as the folder where you want to save the Test.rc file, run the following command from a command prompt:
    Rc Test.rc
    A new file named Test.res is generated.
  4. Open Visual Basic 6 and create a new standard EXE project. Use the default name.
  5. From the Project menu, select Add File, and add the Test.res file to the project.
  6. Compile the project to be Project1.exe.
  7. Open Microsoft Internet Explorer and type the following line in the address bar:
    res://<localpath>\project1.exe/test.xml
    where <localpath> is replaced with the real path. For example, C:\test. You should see the following error message:
    The XML page cannot be displayed
    Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.
    --------------------------------------------------------------------------------
    Invalid at the top level of the document. Line 3, Position 7

    </XML>
    If you use the steps provided above but add two spaces to the end of the Test.xml file so that the size of the file becomes 40 bytes, it should work as expected.

Properties

Article ID: 297112 - Last Review: February 27, 2014 - Revision: 1.3
APPLIES TO
  • Microsoft Visual Basic 6.0 Professional Edition
  • Microsoft Visual Basic 6.0 Enterprise Edition
Keywords: 
kbnosurvey kbarchive kbbug kbqfe kbpending kbhotfixserver KB297112

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com