Decompile of VB code fails

5 posts, 1 answers
  1. Chris
    Chris avatar
    12 posts
    Member since:
    May 2011

    Posted 21 Jul 2011 Link to this post


    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
          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
            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





  2. Answer
    Yordan Dikov
    Yordan Dikov avatar
    69 posts

    Posted 29 Jul 2011 Link to this post

    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 >>

  3. Patrick
    Patrick avatar
    52 posts
    Member since:
    Jun 2010

    Posted 20 Feb 2014 in reply to Yordan Dikov Link to this post

    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.

  4. Vladi
    Vladi avatar
    167 posts

    Posted 24 Feb 2014 Link to this post

    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,
    Tell us what you think about JustDecompile. Your opinion matters! You can use our forum, or our JustDecompile UserVoice website for feature requests.
  5. Patrick
    Patrick avatar
    52 posts
    Member since:
    Jun 2010

    Posted 27 Feb 2014 in reply to Vladi Link to this post

    Unfortuately that doesn't help
Back to Top