CodeConversion v2.0.1 throwing errors when converting from C# to Powershell
chrisdma opened this issue · 1 comments
chrisdma commented
Hello, I am trying to convert a ~100 line C# snippet to Powershell so that I don't have to use Add-Type to call the code however CodeConversion is erroring out. Below is the error I get:
at CodeConverter.PowerShell.PowerShellCodeWriter.VisitObjectCreation(ObjectCreation node) in C:\src\code-conversion\src\PowerShell\PowerShellCodeWriter.cs:line 217
at CodeConverter.Common.ObjectCreation.Accept(NodeVisitor visitor) in C:\src\code-conversion\src\Common\Ast.cs:line 681
at CodeConverter.PowerShell.PowerShellCodeWriter.VisitVariableDeclarator(VariableDeclarator node) in C:\src\code-conversion\src\PowerShell\PowerShellCodeWriter.cs:line 377
at CodeConverter.PowerShell.PowerShellCodeWriter.VisitVariableDeclaration(VariableDeclaration node) in C:\src\code-conversion\src\PowerShell\PowerShellCodeWriter.cs:line 366
at CodeConverter.Common.VariableDeclaration.Accept(NodeVisitor visitor) in C:\src\code-conversion\src\Common\Ast.cs:line 1029
at CodeConverter.Common.CStyleCodeWriter.VisitBlock(Block node) in C:\src\code-conversion\src\Common\CStyleCodeWriter.cs:line 83
at CodeConverter.Common.Block.Accept(NodeVisitor visitor) in C:\src\code-conversion\src\Common\Ast.cs:line 241
at CodeConverter.PowerShell.PowerShellCodeWriter.VisitMethodDeclaration(MethodDeclaration node) in C:\src\code-conversion\src\PowerShell\PowerShellCodeWriter.cs:line 198
at CodeConverter.Common.MethodDeclaration.Accept(NodeVisitor visitor) in C:\src\code-conversion\src\Common\Ast.cs:line 637
at CodeConverter.Common.NodeVisitor.VisitClassDeclaration(ClassDeclaration node) in C:\src\code-conversion\src\Common\NodeVisitor.cs:line 95
at CodeConverter.Common.ClassDeclaration.Accept(NodeVisitor visitor) in C:\src\code-conversion\src\Common\Ast.cs:line 341
at CodeConverter.Common.CStyleCodeWriter.VisitBlock(Block node) in C:\src\code-conversion\src\Common\CStyleCodeWriter.cs:line 83
at CodeConverter.Common.Block.Accept(NodeVisitor visitor) in C:\src\code-conversion\src\Common\Ast.cs:line 241
at CodeConverter.Common.CodeWriter.Write(Node ast) in C:\src\code-conversion\src\Common\CodeWriter.cs:line 33
at CodeConverter.Converter.Convert(String code, Language from, Language to) in C:\src\code-conversion\src\Converter.cs:line 67
at CodeConverter.Converter.Convert(String code, Language to) in C:\src\code-conversion\src\Converter.cs:line 46
at CodeConversion.Program.<>c.<Main>b__0_0(Options o) in C:\src\code-conversion\src\Program.cs:line 52
at CommandLine.ParserResultExtensions.WithParsed[T](ParserResult`1 result, Action`1 action)
at CodeConversion.Program.Main(String[] args) in C:\src\code-conversion\src\Program.cs:line 23
And here is a link to the gist of the C# code so that I don't have a 100 line code block in the issue:
Thanks for any assistance you can provide!
Chris
chrisdma commented
I think this is relative to using System.Management.Automation since that's only available with certain .NET frameworks and when its not you have to manually reference the DLL? Not sure how to apply that here.