Skip to main content
All docs
V24.1

DeserializationSettings.InvokeTrusted(Action) Method

Turns off safe deserialization for a certain section of code.

Namespace: DevExpress.Utils

Assembly: DevExpress.Data.v24.1.dll

NuGet Package: DevExpress.Data

Declaration

public static void InvokeTrusted(
    Action trustedAction
)

Parameters

Name Type
trustedAction Action

Remarks

DevExpress UI controls automatically detect potentially dangerous data types, block their deserialization, and throw a security-related exception.

If you trust a data source, call the InvokeTrusted method to turn off safe deserialization for certain sections of code:

DevExpress.Utils.DeserializationSettings.InvokeTrusted(()=>{  
    using(var ms = new MemoryStream()){
        gridView1.SaveLayoutToStream(ms);  
        // Trusted source  
        ms.Position = 0;
        gridView2.RestoreLayoutFromStream(ms);  
    }  
});

Read the following topic for more information: Safe Deserialization.

See Also