0

I am dealing with an existing C# codebase of a dotnet application running under Windows. One task is to make it running under different OSs (e.g. Linux). To get a first running version, I had to make changes to the code, for example in some cases there were paths calculated without using System.IO Calls but directly embedding path separators, that failed when running on Linux.

Are there tools or code analysers that can automatically parse a C# codebase and find out potential cross-platform issue?

If not, does anyone know a way to find out such potential issues with full coverage, without reading the code line by line?

Franco Tiveron
  • 2,364
  • 18
  • 34
  • There are different tools attacking different sets of portability issues, but I don't believe any tool can be that automatic and discover all issues. – Lex Li Aug 30 '21 at 04:08
  • @LexLi Would you please indicate those tools? – Franco Tiveron Aug 30 '21 at 04:11
  • Microsoft has [API Portability analyzers](https://learn.microsoft.com/en-us/dotnet/standard/analyzers/portability-analyzer) and third party tools like NDepend allow you to query your code base on usage of Windows only APIs. There might be other tools you can find from Google, but line by line analysis is still necessary if you want nothing to break. – Lex Li Aug 30 '21 at 04:16
  • 2
    Tool recommendation requests are a better fit on [softwarerecs.se]. – dbc Aug 30 '21 at 04:38
  • Does this answer your question? [Cross-platform file name handling in .NET Core](https://stackoverflow.com/questions/38168391/cross-platform-file-name-handling-in-net-core) and [Using Path.Combine() to form a Linux path on a Windows system](https://stackoverflow.com/questions/26067224/using-path-combine-to-form-a-linux-path-on-a-windows-system) and [Using / or \\ for folder paths in C#](https://stackoverflow.com/questions/1987950/using-or-for-folder-paths-in-c-sharp) and [C# char “//” path separator](https://stackoverflow.com/questions/4597572/c-sharp-char-path-separator) –  Aug 30 '21 at 08:17
  • @OlivierRogier No it doesn't. I already know how to do it, what I am looking for is a tool that parses a large codebase and tells me automatically where Path.Combine() needs replace current code. – Franco Tiveron Aug 30 '21 at 08:21

0 Answers0