Skip to content

Latest commit

 

History

History
50 lines (36 loc) · 1.23 KB

GU0051.md

File metadata and controls

50 lines (36 loc) · 1.23 KB

GU0051

Cache the XmlSerializer

Topic Value
Id GU0051
Severity Warning
Enabled True
Category Gu.Analyzers.Correctness
Code GU0051XmlSerializerNotCached

Description

This constructor loads assemblies in non-GC memory, which may cause memory leaks.

Motivation

ADD MOTIVATION HERE

How to fix violations

ADD HOW TO FIX VIOLATIONS HERE

Configure severity

Via ruleset file.

Configure the severity per project, for more info see MSDN.

Via #pragma directive.

#pragma warning disable GU0051 // Cache the XmlSerializer
Code violating the rule here
#pragma warning restore GU0051 // Cache the XmlSerializer

Or put this at the top of the file to disable all instances.

#pragma warning disable GU0051 // Cache the XmlSerializer

Via attribute [SuppressMessage].

[System.Diagnostics.CodeAnalysis.SuppressMessage("Gu.Analyzers.Correctness", 
    "GU0051:Cache the XmlSerializer", 
    Justification = "Reason...")]