dotnet / dotnet/format

Namespace of generated code not detected

Open
#1,965 0 comments 3 reactions 0 assignees View on GitHub
Bug Help Wanted
Dominant language
No language data
Stars
1.9k
Forks
173
Avg merge
10d 13h
Merged PRs (30d)
1

Description

# Issue

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

```csharp
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:
- Our Code generator uses the [CSharp 4.6 package](https://www.nuget.org/packages/Microsoft.CodeAnalysis.CSharp/4.6.0)
- And we have dotnet SDK 7.0.401 installed in our client

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

If any other infos are required tell me.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.