dcarlstedt

Cadet 3rd Class
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2019-03-22
16:43
3438 views
Translating .Net Core Web Applications
I'm having issues getting successful translations to complete without errors for my .net core web applications. The errors that I"m seeing are all related to the translator not being able to translate foreach loops within our code.
Code that will trigger the error
int[] values = new int[] { 1,2,3,4 }; foreach (int v in values) { // code here }
Translation Error
[warning]: Translation errors occurred during execution of .Net translator: Failed to translate method GetHeaderAndBase64Decode at C:\git\WebAPI\Source\Application.WebAPI\Controllers\DiagnosticsController.cs:167:8 SCA.TranslationException: Failed to resolve GetLength method call for array-type expression in foreach loop at C:\git\WebAPI\Source\Application.WebAPI\Controllers\DiagnosticsController.cs:183:34 at SCA.CSharpTranslator.VisitForEachStatement(ForEachStatementSyntax node) in C:\TenaciousD_Comp\sca\src\net\roslyn-translator\translator\src\csharp.cs:line 3438 at SCA.CSharpTranslator.VisitBlock(BlockSyntax node) in C:\TenaciousD_Comp\sca\src\net\roslyn-translator\translator\src\csharp.cs:line 121 at SCA.CSharpTranslator.VisitTryStatement(TryStatementSyntax syntax) in C:\TenaciousD_Comp\sca\src\net\roslyn-translator\translator\src\csharp.cs:line 483 at SCA.CSharpTranslator.VisitBlock(BlockSyntax node) in C:\TenaciousD_Comp\sca\src\net\roslyn-translator\translator\src\csharp.cs:line 121 at SCA.CSharpTranslator.translateMethodBody(CSharpSyntaxNode node, STFunDecl function, IMethodSymbol method, Boolean isStatic, ArrowExpressionClauseSyntax exprBody) in C:\TenaciousD_Comp\sca\src\net\roslyn-translator\translator\src\csharp.cs:line 4457
If I change out the foreach loop into a for loop the translation error is fixed, however that is not ideal.
Here are the parameters I'm sending to sourceanalyzer to perform the translation which happens after I build (DEBUG) and restore packages:
- -dotnet-core-version 2.1
- -aspnetcore
- libdirs **/* **/*
Here is what I've tried to resolve this:
- changing -dotnet-core-version to the runtime version I'm using which is 2.1.8
- changing -dotnet-core-version to the sdk version I'm using which is 2.1.50
The command I'm running
sourceanalyzer.exe -b 123 -verbose -debug -logfile sca_binaries_logfile.txt -aspnetcore -dotnet-core-version 2.1 -libdirs **/* **/*
My questions:
- How can I fix these translation errors?
- Where's the documentation specifying which version numbers are accepted for -dotnet-core-version, -dotnet-standard-version
- Do you see anything wrong with what I'm doing on the command line when calling source analyzer?
0 Replies