C# compiler - getting verbose output or diagnostic info

198 Views Asked by At

Is there an option to the C# compiler CSC.exe which generates more verbose output, specifically details on its parsing logic?

I've got a C# source file in a project which essentially contains this:

namespace lib.data.files
{
  public class group
  {
    public file[] file;
  }
  public class file
  {
  }
}

And a compile error of

files.cs(5,15): error CS1031: Type expected [lib.data.csproj::TargetFramework=netstandard2.0]

The problem can be fixed by changing line 5 to

public lib.data.files.file[] file;

But I'm curious to find out what the CSC compiler thinks file[] represents (if it isn't picking up the class referrence in the same namespace).

(p.s. adding <ErrorLog>compiler-diagnostics.sarif</ErrorLog> to the project file only gives the same level of detail.)

(p.p.s. this compile error only showed up after upgrading from .NET 6.0 to .NET 7.0)

0

There are 0 best solutions below