Good practices for using the transformation and visualization features for Microsoft Visual Basic

Review this list of good practices and limitations for using the transformation and visualization features in Rational® modeling products that integrate with Microsoft Visual Basic®.

Integration with Microsoft Visual Studio

  • Verify that the correct operating system, service packs, and Microsoft Visual Studio 2005, 2008, or 2010 Standard or Professional Edition, are installed on the computer before you install or run any of the Rational features for transforming or visualizing Visual Basic code.
  • The Rational modeling products only recognize and communicate with the first instance of Microsoft Visual Studio 2005 or 2008 that is opened. Run only one instance of Visual Studio on the computer where you use Rational modeling products.
  • In Microsoft Visual Studio, always enable the option to automatically load external changes. You can set this option on the Documents page by clicking Tools > Options > Environment > Documents. Ensure that both Detect when file is changed outside the environment and Auto-load changes, if saved are selected.
  • The Rational modeling products use a COM mechanism to synchronize with Microsoft Visual Studio. The COM calls may fail or be rejected when Visual Studio is busy. Do not work in Microsoft Visual Studio when you perform the following operations in the Rational modeling products:
    • Import .NET solutions
    • Refresh a project
    • Expand imported projects or files in the Project Explorer view (for example, expanding the tree view)
    • Start Rational modeling products in a workspace where a Visual Studio solution was previously imported
    • Compose a .NET visualization diagram
    • Run a UML-to-Visual-Basic or Visual-Basic-to-UML transformation

Solution import and project management

  • When you import a Microsoft Visual Studio solution, Eclipse projects are created in the Eclipse workspace for every corresponding Visual Basic project present in the solution. The project that is created in Eclipse has the same name as the Visual Basic project in the Microsoft Visual Studio solution. The following points are important to note about the projects:
    • The created projects in Eclipse have links to the Visual Basic files and .NET Assemblies that the corresponding Visual Basic projects use in the Visual Studio solution. These links are the only way for the Rational modeling products to retrieve, update and show information about the Visual Studio projects and their contents in Eclipse. In effect, the links act as a view for the Visual Basic projects in Eclipse.
    • With the exception of using the UML-to-Visual Basic transformations, avoid using Eclipse mechanisms to modify the imported projects. Using Eclipse mechanisms to rename these projects or to modify their contents can lead to unpredictable results. In particular, avoid creating or adding UML models (.emx files) or diagrams (.dnx files) in the projects. Instead, create separate projects (such as UML Project) in Eclipse for these purposes. Some care is required to avoid creating diagrams (.dnx files) in the imported projects because, when new diagrams are created, the visualization framework makes their default locations the projects in which the visualized elements reside. .
    • You can safely close and re-open the imported projects. You can also safely delete imported projects. If you must delete a Visual Studio project and all its contents, perform this action in Microsoft Visual Studio.
  • If you are not planning to explore the contents of types defined in the .NET framework assemblies (for example, to find what operations or fields are contained in the type), then select the check box While parsing .NET assemblies get only types when you import the Visual Studio solution to the Eclipse workspace. This option is available on the first page of the .NET Solution Import wizard. This option speeds up the import of the solution and also speeds up the visualization of Visual Basic and .NET types.
  • Once a Visual Studio solution is imported into your Eclipse workspace, avoid renaming the Visual Basic projects in Microsoft Visual Studio. If you must rename a project, then follow the procedure in the online help. For details, see the topic "Renaming Visual Basic projects in Visual Studio".
  • Never close or open a different solution (other than the one you imported to the Eclipse workspace) within Microsoft Visual Studio when the Rational modeling products is running.
  • If you use an encoding format for the Microsoft Visual Studio solution that is different from the default Eclipse encoding, you must change the encoding preference to the appropriate format so that the transformation captures the text correctly from the source file: Click Window > Preferences > General > Workspaces > Text file encoding.

Visual Basic transformation and visualization

  • Before you perform actions in the Rational modeling products, ensure that the Visual Basic projects do not contain syntax errors and that they compile successfully in Microsoft Visual Studio. Rational modeling products use Visual Studio Code Model APIs to parse the Visual Basic files. These APIs return incorrect results and NULL values if there are errors in the Visual Basic files. For example, if you change a Visual Basic file in Microsoft Visual Studio, and then refresh its project in Eclipse and you see that the file cannot be expanded in the Project Explorer view, it might be because Visual Basic syntax errors were introduced by the change.

    To avoid this issue, switch to Microsoft Visual Studio, fix all the syntax errors, rebuild the solution and refresh the imported project in Eclipse to receive the changes. It is particularly important that Visual Studio solutions be in a clean, built state when applying transformations.

  • You can change the encoding of Visual Basic projects through Eclipse by using the Properties command on the pop-up menu of the imported projects. This encoding will take more time than normal because Visual Studio projects are typically large.
  • If you use the Visual Basic-to-UML transformation to generate a UML model from an existing Visual Basic project in Microsoft Visual Studio, and then you want to regenerate all new code from the model, make sure that you create a new empty project in Visual Studio as the transformation target or choose a project that does not already have a main() method. Applications containing two main() methods will generate Visual Studio compile errors.

Feedback