IntelliTect / IntelliTect/CodingGuidelines

Where to include message for #pragma disable?

Offen
#82 4 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
documentation
Vorherrschende Sprache
C#
Sterne
12
Forks
16
Ø Merge
2 Min.
Gemergte PRs (30 T.)
7

Beschreibung

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.
```

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.