Exception when decompiling F# to C#/VB

2 posts, 0 answers
  1. Andy
    Andy avatar
    6 posts
    Member since:
    Apr 2011

    Posted 10 Jul 2011 Link to this post

    I've just tried to decompile a simple F# programm:

    let rec fib n =
        match n with
            | 0 -> 0
            | 1 -> 1
            | n -> fib (n - 1) + fib (n - 2)
      
    let result = fib 5
    System.Console.WriteLine result
    System.Console.ReadLine

    When decompiling the fib function the IL code is shown but C#/VB produces an exception:

    Current member / type: System.Int32 Program::fib(System.Int32)
    File path: D:\temp\FSharpTest\FSharpTest\bin\Debug\FSharpTest.exe
    Unable to cast object of type 'Telerik.JustDecompiler.Cil.InstructionBlock' to type 'System.String'.
       at ..GetData[˜](Instruction instruction)
       at Telerik.JustDecompiler.Decompiler.StatementDecompiler.‚(Instruction instruction)
       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.“(Int32 index, BlockStatement block)
       at Telerik.JustDecompiler.Decompiler.StatementDecompiler.˜(Instruction instruction, SwitchStatement switch)
       at Telerik.JustDecompiler.Decompiler.StatementDecompiler.—(Instruction instruction)
       at Telerik.JustDecompiler.Decompiler.StatementDecompiler.OnSwitch(Instruction instruction)
       at ..(Instruction instruction, IInstructionVisitor visitor)
       at Telerik.JustDecompiler.Cil.BaseInstructionVisitor.Visit(Instruction instruction)
       at Telerik.JustDecompiler.Decompiler.StatementDecompiler.„(Instruction instruction)
       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.Run()
       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.Decompiler.Extensions.Decompile(MethodBody body, ILanguage language)
       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 32
       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

    I hope I could help you. Anyway, nice product ...
  2. Nikolay G Rusev
    Admin
    Nikolay G Rusev avatar
    44 posts

    Posted 12 Jul 2011 Link to this post

    Hi Andy,

     Thank you for your feedback.
    The problem is logged and it will be fixed in a future release. Stay tuned!

    Best wishes,
    Nikolay G. Rusev
    the Telerik team

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

  3. DevCraft banner
Back to Top