Mamy umożliwiają serializacji klasy, który zawiera dane ze schowka do transmisji z kontroli systemu Windows w element zarządzania WPF. To zadziałało w framework 4.8 po konwersji do .Net 5 teraz dostajemy błąd: Wpisz "System.RuntimeType" w złożeniu "System".Prywatne.CoreLib, Wersja=5.0.0.0, Kultura=neutralna, PublicKeyToken=7cec85d7bea7798e' nie jest oznaczony jako umożliwiają serializacji.
To się dzieje w module obsługi zdarzenia Drop w WPF w wierszu:
var tClip = e.Data.GetDataPresent(typeof(ClipboardDescriptor));
Gdzie "e" - jest to System.Windows.ДрагЕвентАрги.
using System;
using System.Windows.Forms;
namespace Support.Classes
{
/// <summary>
/// Summary description for ClipboardDescriptor.
/// </summary>
[Serializable]
public class ClipboardDescriptor
{
private Guid id;
private Guid parentDocumentID;
private System.Type objtype;
private TreeNode baseTreeNode;
private string objname;
public ClipboardDescriptor()
{
baseTreeNode = null;
}
public Guid ParentDocumentID
{
get { return(parentDocumentID); }
set { parentDocumentID = value; }
}
public Guid ID
{
get { return(id); }
set { id = value; }
}
public System.Type ObjType
{
get { return(objtype); }
set { objtype = value; }
}
public string ObjName
{
get { return(objname); }
set { objname = value; }
}
/// <summary>
/// Get the treenode that this object is associated with
/// </summary>
public TreeNode BaseTreeNode
{
get { return(baseTreeNode); }
set { baseTreeNode = value; }
}
}
}