dotnet / format

Home for the dotnet-format command
MIT License
1.92k stars 174 forks source link

Namespace of generated code not detected #1965

Open garcipat opened 11 months ago

garcipat commented 11 months ago

Issue

We have a source code generator generating code in a defined namespace

namespace Path.To.My.Generated.Code;

public static class MyGeneratedClass
{
..
}

and we are consumig that generator in a different assembly

using Path.To.My.Generated.Code;

var field = MyGeneratedClass.Field;

when I now run dotnet format, the using Path.To.My.Generated.Code gets removed becasue our style removes unused using. Therefore code doesnt compile anymore becasue the using is then missig.

System information:

Are analyzers not run? Or do I have to register my analyzer in an additional place?

If any other infos are required tell me.