ReSharper 2026.1 Help

コードインスペクション:marshal-by-reference クラスのキャプチャされたフィールド参照により実行時例外が発生する可能性があります。

MarshalByRefObject から派生した型のフィールドは、参照渡しすると安全ではありません。 コード自体は正しく見えても、実行時にエラーが発生する可能性があります。 このインスペクションは、参照渡しクラスのフィールドを参照する refoutin 引数を報告します。

サンプル

using System; class DataHolder : MarshalByRefObject { public int Value; } class Example { void Update(ref int x) { } void Test(DataHolder holder) { Update(ref holder.Value); } }
using System; class DataHolder : MarshalByRefObject { public int Value; } class Example { void Update(ref int x) { } void Test(DataHolder holder) { var value = holder.Value; Update(ref value); } }
2026 年 6 月 12 日