Skip to content

CodeConversion v2.0.1 throwing errors when converting from C# to Powershell #5

@chris6611

Description

@chris6611

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:

https://gist.githubusercontent.com/chrisdma/2ab5e03edc8b1f656922e7c2e5753808/raw/b9c9fd09f824736354df426d4660bdbca7b1c7c9/GetCredential.cs

Thanks for any assistance you can provide!

Chris

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions