c # – How to get the class attributes of another AppDomain?

.Net Framework 4.8

I can not get the custom attributes of the class loaded in the separate application.

I have defined the custom attribute:

[Serializable]
[AttributeUsage(AttributeTargets.Class)]



public sealed class CommandAttribute: Attribute
{
// ...
}

and the custom class:

[Serializable]
[Command("{382F5A14-9A96-4A05-80B3-10FE170B59DE}")]



public sealed class HelloWorld: MarshalByRefObject, ICommand
{
// ...
}

I create an instance of my class in another application and try to get my proxy custom attribute:

var domain = AppDomain.CreateDomain ("AD # 2", null, null);
var command = (ICommand) domain.CreateInstanceAndUnwrap (
"AntPluginExample1, version = 1.0.0, culture = neutral, PublickKeyTocken = null",
"AntPluginExample1.HelloWorld");
var t = command.GetType ();
WriteLine ($ "command type: {t}");
WriteLine ("Attributes:");
foreach (var att in t.CustomAttributes)
{
WriteLine ($ " t {att.AttributeType.Name}");
}

but I see in the console output t.CustomAttributes contains the SerializableAttribute assign only … But I was waiting to find my CommandAttribute to assign too.

How can I solve this problem?