Request: autofix for variable used as a method

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:

hmm what was the original c# for these?

ogcsharp.txt (19.9 KB)

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

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…

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

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

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

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

1 Like