IntelliTect / IntelliTect/CodingGuidelines
Where to include message for #pragma disable?
- Lingua principale
- C#
- Stelle
- 12
- Fork
- 16
- Merge medio
- 2m
- PR unite (30g)
- 7
Descrizione
If I am disabling a warning, what is the format of the justification message.
Here's an idea/approach but it is still ugly, better suggestions welcome:
```
// Justifiction: Properties initialized by Entity Framework.
#nullable disable // CS8618: Non-nullable field is uninitialized. Consider declaring as nullable.
public ApplicationDbContext(
#nullable enable
DbContextOptions? options) : base(options) { }
// Justifiction: Properties initialized by Entity Framework.
#nullable disable // CS8618: Non-nullable field is uninitialized. Consider declaring as nullable.
public ApplicationDbContext(
#nullable enable
```
or, with pragma:
```
// Justification: Uninitialized properties set by Entity Framework.
#pragma warning disable CS8618 // Non-nullable field is uninitialized. Consider declaring as nullable.
public ApplicationDbContext(DbContextOptions options) : base(options) { }
#pragma warning restore CS8618 // Non-nullable field is uninitialized. Consider declaring as nullable.
```
Guida per i contributori
Apri la guida per i contributori
Valutazione
Questa issue non è ancora stata valutata.