# EWIs

## Working with EWIs

The number of [EWIs](/vbuc/generated-code.md#ewis) in your code depends entirely on your programming style and the size, type and complexity of files that you want to upgrade. As a general rule, forms usually have more issues than classes and modules, because forms have a richer object model and significant transformations must be applied when upgrading to Windows Forms.

### Steps to fix a migration issue

This section shows the recommended steps to fix an error related to EWIs. The steps are:

1. [Locate the source of the problem](/vbuc/ewis.md#locate-the-source-of-the-problem)
2. [Understand the code purpose in the original VB6 application](/vbuc/ewis.md#understand-the-code-purpose-in-the-original-vb6-application)
3. [Identify a solution in .NET](#identify-a-solution-in-.net)
4. [Implement the solution](/vbuc/ewis.md#implement-the-solution)
5. [GAPVelocity AI Customization](#mobilize.net-customization-optional)
6. [Document the solution](/vbuc/ewis.md#document-the-solution)

#### Locate the source of the problem

To find the source of the problem, you can add some breakpoints a few lines before the code where the exception or the different behavior manifests itself. You need to do this in both the original VB6 code and the upgraded code so that you can compare to find out what is causing the problem or why the problem is occurring.

#### Understand the code purpose in the original VB6 application

The next step is to understand, in the original VB6 application, the functionality of the section of the code causing the problem. You can perform the following activities to understand the original behavior:

1. Create small examples of code that use the same features.
2. Execute step by step (debug mode), as many times as you need, the section of code causing the problem.

#### Identify a solution in .NET

Once the functionality of the original VB6 application is understood, the next step is to replicate the same functionality in the upgraded .NET application. Some recommendations for this are:

1. Create small examples in .NET to replicate the VB6 functionality.
2. Review the related .NET documentation on the web to determine how to achieve the same functionality in .NET.
3. Ask your peers or a [GAPVelocity AI migration expert](https://www.gapvelocity.ai/resources/support/).

#### Implement the solution

If you already have a solution, you can implement it. Once you have modified the upgraded code and the found solution was implemented, you need to test your code to confirm that the behavior is the same as the original VB6 application. You can, also, review the rest of the upgraded code to determine if the same problem is present in other areas.

#### GAPVelocity AI Customization (optional)

In some cases, you can consider GAPVelocity AI Customization. Several factors must be taken into account at this point:

1. Timing
   * Will the current timeframe of the project allows the GAPVelocity AI Team to implement the required customization? Is the impact of the error large enough to justify it to be reported in order to be included in future releases used in future projects?
2. Complexity
   * Is there an opportunity to make the replacement in several places using another automated solution such as Regular Expressions?
3. Rework required
   * Are the manual changes performed at this point in the project so many that executing a code merge will imply too much additional work?

#### Document the solution

Once the solution is implemented and the problem is resolved, it is important that the solution is properly documented and stored in a shared knowledge base. This helps in cases where other developers run into the same issue and are able to access information on how to solve it.

### EWIs Lists

{% hint style="info" %}
In the following lists, you can see the most common EWIs. It is important to know that there are many other EWIs not described in those lists.
{% endhint %}

#### Warnings

Below are a few of the most common warnings generated by the VB6 AI Migrator.

| Code number | Description                                                                                                                                                                                                                 |
| ----------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 206         | [Untranslated statement in %1. Please check source code](/vbuc/ewis/warnings.md#id-206)                                                                                                                                     |
| 1003        | [ParamArray %1 was changed from ByRef to ByVal](/vbuc/ewis/warnings.md#id-1003)                                                                                                                                             |
| 1044        | [Sub Main in a DLL won't get called](/vbuc/ewis/warnings.md#id-1044)                                                                                                                                                        |
| 1047        | [Application will terminate when Sub Main() finishes](/vbuc/ewis/warnings.md#id-1047)                                                                                                                                       |
| 1049        | [Use of Null/IsNull() detected](/vbuc/ewis/warnings.md#id-1049)                                                                                                                                                             |
| 1063        | [Arrays in structure %1 may need to be initialized before they can be used](/vbuc/ewis/warnings.md#id-1063)                                                                                                                 |
| 1068        | [%1 of type %2 is being forced to %3](/vbuc/ewis/warnings.md#id-1068)                                                                                                                                                       |
| 2050        | [%1 Event %2.%3 was not upgraded](/vbuc/ewis/warnings.md#id-2050)                                                                                                                                                           |
| 2065        | [%1 %2 %3.%4 has a new behavior](/vbuc/ewis/warnings.md#id-2065)                                                                                                                                                            |
| 2074        | [%1 %2 %3.%4 was upgraded to %5.%6 which has a new behavior](/vbuc/ewis/warnings.md#id-2074)                                                                                                                                |
| 2077        | [Change the default 0 index in the Rows property with the correct one](/vbuc/ewis/warnings.md#id-2077)                                                                                                                      |
| 2080        | [%1 was upgraded to %2 and has a new behavior](/vbuc/ewis/warnings.md#id-2080)                                                                                                                                              |
| 2081        | [%1 has a new behavior](/vbuc/ewis/warnings.md#id-2081)                                                                                                                                                                     |
| 2099        | [Return value for Dir has a new behavior](/vbuc/ewis/warnings.md#id-2099)                                                                                                                                                   |
| 6002        | [UserControl Event %1 is not supported](/vbuc/ewis/warnings.md#id-6002)                                                                                                                                                     |
| 6021        | [Casting 'int' to Enum may cause different behavior](/vbuc/ewis/warnings.md#id-6021)                                                                                                                                        |
| 6022        | [The CommonDialog CancelError property is not supported in .NET](/vbuc/ewis/warnings.md#id-6022)                                                                                                                            |
| 7005        | [Parameters (if any) must be set using the Arguments property of ProcessStartInfo](/vbuc/ewis/warnings.md#id-7005)                                                                                                          |
| 7006        | [The named argument %1 was not resolved and corresponds to the following expression %2](/vbuc/ewis/warnings.md#id-7006)                                                                                                     |
| 7008        | [The ProgId could not be found on computer where this application was migrated](/vbuc/ewis/warnings.md#id-7008)                                                                                                             |
| 7009        | [Multiples invocations to ShowDialog in Forms with ActiveX Controls might throw runtime exceptions](/vbuc/ewis/warnings.md#id-7009)                                                                                         |
| 8007        | [Trying to marshal a non Blittable Type (%1). A special conversion might be required at this point. Moreover use 'External Marshalling attributes for Structs' feature enabled if required](/vbuc/ewis/warnings.md#id-8007) |

#### Issues

Below are a few of the most common issues generated by the VB6 AI Migrator.

| Code number | Description                                                                           |
| ----------- | ------------------------------------------------------------------------------------- |
| 1002        | [Lset cannot assign one type to another](/vbuc/ewis/issues.md#id-1002)                |
| 1010        | [The preceding line couldn't be parsed](/vbuc/ewis/issues.md#id-1010)                 |
| 1014        | [%1 statement is not supported](/vbuc/ewis/issues.md#id-1014)                         |
| 1043        | [Class instancing was changed to public](/vbuc/ewis/issues.md#id-1043)                |
| 1046        | [%1 Parameter '%2' is not supported and was removed](/vbuc/ewis/issues.md#id-1046)    |
| 2038        | [Form property %1.ScaleMode is not supported](/vbuc/ewis/issues.md#id-2038)           |
| 2064        | [%1 %2 %3 %4 was not upgraded](/vbuc/ewis/issues.md#id-2064)                          |
| 2068        | [%1 %2 was not upgraded](/vbuc/ewis/issues.md#id-2068)                                |
| 2070        | [Constant %1 was not upgraded](/vbuc/ewis/issues.md#id-2070)                          |
| 7003        | [The Hdc should be released once it is used for safety](/vbuc/ewis/issues.md#id-7003) |

#### ToDos

Below are a few of the most common ToDos generated by the VB6 AI Migrator.

| Code number | Description                                                                                                                                                          |
| ----------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 1035        | [#If #EndIf block was not upgraded because the expression %1 did not evaluate to True or was not evaluated](/vbuc/ewis/todos.md#id-1035)                             |
| 1050        | [Structure %1 may require marshalling attributes to be passed as an argument in this Declare statement](/vbuc/ewis/todos.md#id-1050)                                 |
| 1059        | [Code was upgraded to use %1 which may not have the same behavior](/vbuc/ewis/todos.md#id-1059)                                                                      |
| 1065        | [Error handling statement (%1) could not be converted](/vbuc/ewis/todos.md#id-1065)                                                                                  |
| 1067        | [Member %2 is not defined in type %3](/vbuc/ewis/todos.md#id-1067)                                                                                                   |
| 1069        | [Error handling statement (%1) was converted to a pattern that might have a different behavior](/vbuc/ewis/todos.md#id-1069)                                         |
| 2018        | [Remove the next line of code to stop form from automatically showing](/vbuc/ewis/todos.md#id-2018)                                                                  |
| 2045        | [Only TrueType and OpenType fonts are supported in Windows Forms](/vbuc/ewis/todos.md#id-2045)                                                                       |
| 7010        | [The connection string must be verified to fullfill the .NET data provider connection string requirements](/vbuc/ewis/todos.md#id-7010)                              |
| 7016        | [This property was auto-generated because it is used in WriteProperties but does not exist.](/vbuc/ewis/todos.md#id-7016)                                            |
|             | [How to prevent the application from exiting immediately after starting](/vbuc/ewis/todos.md#how-to-prevent-the-application-from-exiting-immediately-after-starting) |

#### Notes

Below are a few of the most common Notes generated by the VB6 AI Migrator.

| Code number | Description                                                                                                                                                                                                                       |
| ----------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 2041        | [The following line was commented](/vbuc/ewis/notes.md#id-2041)                                                                                                                                                                   |
| 6016        | [Structure %1 should be within the shared file due to its use in Declare statement for a Windows API](/vbuc/ewis/notes.md#id-6016-structure-1-should-be-within-the-shared-file-due-to-its-use-in-declare-statement-for-a-windows) |
| 6017        | [Inaccessible enum value %1 was changed to its numerical value %2](/vbuc/ewis/notes.md#id-6017-inaccessible-enum-value-1-was-changed-to-its-numerical-value-2)                                                                    |
| 7001        | [The following %1 (%2) seems to be dead code](/vbuc/ewis/notes.md#id-7001)                                                                                                                                                        |
| 8001        | [Element %1 was removed](/vbuc/ewis/notes.md#id-8001)                                                                                                                                                                             |
| 8008        | [Element %1 is obsolete and should be removed](/vbuc/ewis/notes.md#id-8008)                                                                                                                                                       |

### &#x20;<a href="#id-2041" id="id-2041"></a>

### &#x20;<a href="#id-7001" id="id-7001"></a>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.gapvelocity.ai/vbuc/ewis.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
