C# .NET Remoting shows error System.Security.SecurityException. Type System.DelegateSerializationHolder and the types derived from it (such as System.DelegateSerializationHolder) are not permitted to be deserialized at this security level.

When using .NET Remoting you may see the following error:

System.Security.SecurityException.
 Type System.DelegateSerializationHolder and the types derived from it (such
 as System.DelegateSerializationHolder) are not permitted to be deserialized
 at this security level.
 System.Runtime.Serialization.SerializationException


A lot of comments on the Internet point to the following to change your security level.

However if this is the first time that you've seen this error it maybe because you've introduced something inadvertantly that breaches the security requirements of the default low security level and it would be safer to remove that issue instead of reducing your security.

For me I found that we'd implemented the INotifyPropertyChanged interface on a class.

This defines the PropertyChanged event, and this then breaks your security model.

/// <summary>
///
Occurs when the value of a property is changed.
///
</summary>

public event PropertyChangedEventHandler PropertyChanged;


If you don't need this event to be serialized and deserialized then you can mark it as non-serialized.

/// <summary>
///
Occurs when the value of a property is changed.
///
</summary>

[field: NonSerialized]
public
event PropertyChangedEventHandler PropertyChanged;

Comments

Popular posts from this blog

Windows Server 2016, 2019, 2022, Windows 10 and Windows 11: Date and time "Some settings are managed by your organization".

TFTPD32 or TFTPD64 reports Bind error 10013 An attempt was made to access a socket in a way forbidden by its access permissions.

Windows Server 2019 desktop icons such as My Computer, Windows cannot access the specified device, path, or file.