Request: autofix for variable used as a method


(Theo) #1

When I am importing C# code with the oxidizer, the error " a variable but is used as a method" occurs a lot, causing me to replace all those ( and ) with [ and ].
As you can detect this error, can you also fix it automatically?

An example after oxidizer import followed by build:


(marc hoffman) #2

hmm what was the original c# for these?


(Theo) #3

ogcsharp.txt (19.9 KB)

This code is the result of Vb -> c# by Telerik


(marc hoffman) #4

it looks like the C# is already wrong:

    if (!string.IsNullOrWhiteSpace(OrderLines(0).MagazijnCode))

this should be OrderLines[0] of course. So Oxidixer handled this part “ok”. I’m not sure if a n auto-fix for this would be entirely safe or a good idea — especially since this is a corner case caused by bad input…


(Theo) #5

Maybe a manual fix, on the error, when you open it, the option to fix it, with the option to fix all?


(Carlo Kok) #6

Hrmm something to think about. As a temporary thing, in VS you can do replace with regex

from: Orderlines\((.*?)\)
to: Orderlines[$1]

(Theo) #7

I already thought that, that’s why I asked for the quick fix instead of posting an oxidizer error :smile: