Fix  V B . N e t  decompile  e r r o r s


This page gives you simple tips to solve decompilation errors after using programs like Reflector and JustDecompile.




bullet   No accessible 'Main' method with an appropriate signature was found in 'program'
SOLUTION: Search for 'Sub Main' in the solution. You will find something similar like 'Private Shared Sub Main()'
Replace  'Private'  with  'Public'
bullet   Project-level conditional compilation constant 'VBC_VER = ... DEBUG; ^^ ^^ TRACE' is not valid: Character is not valid.
SOLUTION: Quit Visual Studio. Open the VBPROJ file and search for 'DEBUG;TRACE' in the line starting with 'DefineConstants'
Delete  ';TRACE'
bullet   Local variable 'variable' cannot be referred to before it is declared.
SOLUTION: If 'variable' is the name of a class, place the namespace name before the 'variable'
Example: Me.levelSets = LevelSet.GetAllLevelSetInfos   ===>>>   Me.levelSets = SokobanPro.LevelSet.GetAllLevelSetInfos
bullet   Property 'propertyname' is 'ReadOnly'.
SOLUTION: Property 'propertyname' has the same name as variable 'Me.variablename'. Rename variable 'Me.variablename'
bullet   'variablename' is already declared as 'Property "propertyname" As Type' in this class.
SOLUTION: Property 'propertyname' has the same name as variable 'variablename'. Rename variable 'variablename'
bullet   Array bounds cannot appear in type specifiers.
SOLUTION: Dim Level As ItemType(0 To .,0 To .)   ===>>>   Dim Level As ItemType(,)
bullet   Syntax error.
SOLUTION: Place 'Dim temp As ' in front of the line
Example: New Font("Tahoma", 10!, FontStyle.Bold)   ===>>>   Dim temp As New Font("Tahoma", 10!, FontStyle.Bold)
bullet   Local variable 'variablename' is already declared in the current block.
SOLUTION: Remark the line if it is a declaration.
bullet   'Continue' is not declared. It may be inaccessible due to its protection level.
SOLUTION: Remove the brackets.
Example: [Continue]   ===>>>   Continue
bullet   'Continue' must be followed by 'Do', 'For' or 'While'.
SOLUTION: Remove the brackets and place the appropriate keyword after 'Continue'.
Example: Continue()   ===>>>   Continue Do, Continue For, Continue While
bullet   Value of type 'typename' cannot be converted to 'typename'.
SOLUTION: Replace 'DirectCast' with 'CType'.
Example: Me.hWnd = DirectCast(-1, IntPtr)   ===>>>   Me.hWnd = CType(-1, IntPtr)