C#


CSHARP.CLASS.SER.ENON : Nonserializable Field Element (C#)

要旨

A non-transient field of a serializable class might hold a map or collection whose elements might be non-serializable.

Serialization allows one to dump an object into a file and recover (deserialize) it later. For this to work, C# requires the class of the object to implement the System.Runtime.Serialization.ISerializable interface. Moreover, all instance non-transient fields of the class must be serializable themselves. For inner non-static classes, also the outer class must be serializable. In order to distinguish dumps of objects for distinct versions of the same class, it is required that serializable classes define a static field containing the serial version of the class.

プロパティ

クラス名 Nonserializable Field Element (C#)
日本語クラス名 Nonserializable Field Element (C#)
クラス分類 信頼性 (reliability)
ニーモニック CSHARP.CLASS.SER.ENON
カテゴリー
CWE CWE:913 Improper Control of Dynamically-Managed Code Resources
対応言語 C# で利用可能です。
有効/無効設定 このワーニングクラスのチェックはデフォルトで有効になっています。チェックを無効にするにはプロジェクト設定ファイル (configuration file)に以下の WARNING_FILTER ルールを追加してください。
WARNING_FILTER += discard class="Nonserializable Field Element (C#)"

解決法

Guarantee that all instance non-transient fields of a serializable class are themselves serializable. Make inner serializable classes have a serializable outer class, or make them static.

関連のある設定ファイルパラメータ

設定ファイルの以下のパラメータがこのワーニングクラスのチェックに影響します。