Skip to main content
All docs
V24.1

DeserializationSettings.InvokeWithBinaryFormatterDenied(Action) Method

This member is for advanced configuration. It supports the internal infrastructure, and is not intended to be used directly from your code.

Namespace: DevExpress.Utils

Assembly: DevExpress.Data.v24.1.dll

NuGet Package: DevExpress.Data

Declaration

public static void InvokeWithBinaryFormatterDenied(
    Action restrictedAction
)

Parameters

Name Type
restrictedAction Action

Remarks

Use the InvokeWithBinaryFormatterDenied method to disable BinaryFormatter deserialization for a certain part of your code:

DevExpress.Utils.DeserializationSettings.InvokeWithBinaryFormatterDenyed(()=>{  
    // BinaryFormatter is disabled.
});

Call the DenyBinaryFormatter() method at application startup to disable BinaryFormatter deserialization in your application:

static void Main() {
    DevExpress.Utils.DeserializationSettings.DenyBinaryFormatter();
    Application.Run(new Form1());  
}

Read the following topic for more information: Safe Deserialization.

See Also