This is a migrated thread and some comments may be shown as answers.

Decompile of VB code fails

4 Answers 102 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Chris asked on 21 Jul 2011, 08:42 PM

Hi,

I had some code that I was testing the decompiler with, the code caused the code to fail and I narrowed to down to the following.

JustDecompile Version: 2011.1.719.9

 

Module Module1
  Sub Main()
  End Sub
 
  Public Function Test(value As Object) As String
    Try
      Return value
    Catch ex As Exception
      Throw New InvalidCastException(value)
    End Try
  End Function
End Module

 

When decompiling the Test function the following error is raised

Current member / type: System.String JustDecompileVbException.Module1::Test(System.Object)
File path: D:\Source\NGTests\Framework 4.0\JustDecompileVbException\bin\Debug\JustDecompileVbException.exe
Stack empty.
   at ..()
   at ..(MethodReference method)
   at ..OnCall(Instruction instruction)
   at ..(Instruction instruction, IInstructionVisitor visitor)
   at Telerik.JustDecompiler.Decompiler.StatementDecompiler.(Instruction instruction)
   at Telerik.JustDecompiler.Decompiler.StatementDecompiler.(InstructionBlock block)
   at Telerik.JustDecompiler.Decompiler.StatementDecompiler.€(InstructionBlock block)
   at Telerik.JustDecompiler.Decompiler.StatementDecompiler.()
   at Telerik.JustDecompiler.Decompiler.StatementDecompiler.Process(DecompilationContext context, BlockStatement body)
   at Telerik.JustDecompiler.Decompiler.DecompilationPipeline.Run(MethodBody body, ILanguage language)
   at Telerik.JustDecompiler.Decompiler.Extensions.(DecompilationPipeline pipeline, ILanguage language, MethodBody body)
   at Telerik.JustDecompiler.Languages.BaseImperativeLanguageWriter.Write(MethodDefinition method)
   at Telerik.JustDecompiler.Languages.BaseLanguageWriter.Write(IMemberDefinition member, Boolean showCompilerGeneratedMembers)
   at JustDecompile.CodeViewer.CodeWriter.Write() in c:\B\Behemoth\JustDecompile Production Build\Sources\UI\JustDecompile.CodeViewer\Writers\CodeWriter.cs:line 34
   at JustDecompile.CodeViewer.ViewModels.CodeViewerViewModel.(AssemblyMemberNode member, CancellationToken cancellationToken) in c:\B\Behemoth\JustDecompile Production Build\Sources\UI\JustDecompile.CodeViewer\ViewModels\CodeViewerViewModel.cs:line 116

The problem occurs when decompiling to C# or VB.NET, the IL is fine however, here is the IL

.method public static
    string Test (
        object 'value'
    ) cil managed
{
    .locals init (
        [0] string Test,
        [1] class [mscorlib]System.Exception ex
    )
 
    IL_0000: nop
    IL_0001: nop
    .try
    {
        IL_0002: ldarg.0
        IL_0003: call string [Microsoft.VisualBasic]Microsoft.VisualBasic.CompilerServices.Conversions::ToString(object)
        IL_0008: stloc.0
        IL_0009: leave.s IL_0029
 
        IL_000b: leave.s IL_0028
    }
    catch [mscorlib]System.Exception
    {
        IL_000d: dup
        IL_000e: call void [Microsoft.VisualBasic]Microsoft.VisualBasic.CompilerServices.ProjectData::SetProjectError(class [mscorlib]System.Exception)
        IL_0013: stloc.1
        IL_0014: nop
        IL_0015: ldarg.0
        IL_0016: call string [Microsoft.VisualBasic]Microsoft.VisualBasic.CompilerServices.Conversions::ToString(object)
        IL_001b: newobj instance void [mscorlib]System.InvalidCastException::.ctor(string)
        IL_0020: throw
 
        IL_0021: call void [Microsoft.VisualBasic]Microsoft.VisualBasic.CompilerServices.ProjectData::ClearProjectError()
        IL_0026: leave.s IL_0028
    }
 
    IL_0028: nop
 
    IL_0029: ldloc.0
    IL_002a: ret
}

 

 

 

 

4 Answers, 1 is accepted

Sort by
0
Accepted
Yordan Dikov
Telerik team
answered on 29 Jul 2011, 03:30 PM
Hi Chris,

 Please accept my apologies for the late response. Thank you for reporting this issue to us. We have successfully reproduced it and we'll fix it. Please stay tuned.

Best wishes,
Yordan Dikov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

0
Patrick
Top achievements
Rank 1
answered on 20 Feb 2014, 12:56 PM
Any movement on this issue? I'm experiencing the same problem. See attachments showing VB.Net source and decompiled output. Although I detest VB.Net, I have no choice in this.

Thanks!
0
Vladi
Telerik team
answered on 24 Feb 2014, 02:05 PM
Hello Patrick,

Unfortunately we haven't fixed the issue yet. We have it logged but still haven't worked on it. I'm sorry for our slowness. I'll make sure that we review it and work on it as soon as possible. I'll follow up with you once we have some resolution here.

Kind regards,
Vladi
Telerik
Tell us what you think about JustDecompile. Your opinion matters! You can use our forum, or our JustDecompile UserVoice website for feature requests.
0
Patrick
Top achievements
Rank 1
answered on 27 Feb 2014, 12:40 PM
Unfortuately that doesn't help
Tags
General Discussions
Asked by
Chris
Top achievements
Rank 1
Answers by
Yordan Dikov
Telerik team
Patrick
Top achievements
Rank 1
Vladi
Telerik team
Share this question
or