* Bump mono to include fix for #47064: [linker] Fix marking types inside custom attributes. * Add unit tests for bug #47064
This commit is contained in:
Родитель
335465d910
Коммит
1d9356bf94
|
@ -1 +1 @@
|
|||
Subproject commit 2eda626316fd8f70cd98947af2f89b7ca9b0ebe5
|
||||
Subproject commit df81fe40c5f3324d2aad9caccf85a04142aa9cc3
|
|
@ -26,7 +26,12 @@ using NUnit.Framework;
|
|||
[assembly: Debuggable (DebuggableAttribute.DebuggingModes.Default)]
|
||||
|
||||
[assembly: LinkAll.Attributes.CustomAttributeArray (typeof (LinkAll.Attributes.CustomTypeA))]
|
||||
[assembly: LinkAll.Attributes.CustomAttributeArray (typeof (LinkAll.Attributes.CustomTypeAA[][]))]
|
||||
[assembly: LinkAll.Attributes.CustomAttributeArray (typeof (LinkAll.Attributes.CustomTypeAAA[,]))]
|
||||
//[assembly: LinkAll.Attributes.CustomAttributeArray (new object [] { typeof (LinkAll.Attributes.CustomTypeAAAA) })]
|
||||
[assembly: LinkAll.Attributes.CustomAttribute (typeof (LinkAll.Attributes.CustomType))]
|
||||
[assembly: LinkAll.Attributes.CustomAttribute (typeof (List<LinkAll.Attributes.CustomTypeG>))]
|
||||
//[assembly: LinkAll.Attributes.CustomAttributeObject (typeof (LinkAll.Attributes.CustomTypeO))]
|
||||
|
||||
namespace LinkAll.Attributes {
|
||||
|
||||
|
@ -48,6 +53,7 @@ namespace LinkAll.Attributes {
|
|||
public int Property { get; set; }
|
||||
}
|
||||
|
||||
[AttributeUsage (AttributeTargets.All, AllowMultiple = true)]
|
||||
public class CustomAttributeArray : Attribute {
|
||||
readonly Type[] _types;
|
||||
|
||||
|
@ -55,11 +61,26 @@ namespace LinkAll.Attributes {
|
|||
{
|
||||
_types = types;
|
||||
}
|
||||
|
||||
public CustomAttributeArray (params object [] types)
|
||||
{
|
||||
_types = (Type[]) types;
|
||||
}
|
||||
}
|
||||
|
||||
public class CustomTypeA {
|
||||
}
|
||||
|
||||
public class CustomTypeAA {
|
||||
}
|
||||
|
||||
public class CustomTypeAAA {
|
||||
}
|
||||
|
||||
public class CustomTypeAAAA {
|
||||
}
|
||||
|
||||
[AttributeUsage (AttributeTargets.All, AllowMultiple = true)]
|
||||
public class CustomAttribute : Attribute {
|
||||
readonly Type _type;
|
||||
|
||||
|
@ -72,6 +93,23 @@ namespace LinkAll.Attributes {
|
|||
public class CustomType {
|
||||
}
|
||||
|
||||
public class CustomTypeG {
|
||||
}
|
||||
|
||||
[AttributeUsage (AttributeTargets.All, AllowMultiple = true)]
|
||||
public class CustomAttributeObject : Attribute
|
||||
{
|
||||
readonly Type _type;
|
||||
|
||||
public CustomAttributeObject (object type)
|
||||
{
|
||||
_type = (Type)type;
|
||||
}
|
||||
}
|
||||
|
||||
public class CustomTypeO {
|
||||
}
|
||||
|
||||
[FileIOPermission (SecurityAction.LinkDemand, AllLocalFiles = FileIOPermissionAccess.AllAccess)]
|
||||
public class SecurityDeclarationDecoratedUserCode {
|
||||
|
||||
|
@ -165,12 +203,20 @@ namespace LinkAll.Attributes {
|
|||
{
|
||||
var assembly = GetType ().Assembly;
|
||||
var ta = assembly.GetCustomAttributes<CustomAttributeArray> ();
|
||||
Assert.That (ta.Count (), Is.EqualTo (1), "Type[]");
|
||||
Assert.That (ta.Count (), Is.EqualTo (3), "Type[]");
|
||||
Assert.NotNull (Type.GetType ("LinkAll.Attributes.CustomTypeA"), "CustomTypeA");
|
||||
Assert.NotNull (Type.GetType ("LinkAll.Attributes.CustomTypeAA"), "CustomTypeAA");
|
||||
Assert.NotNull (Type.GetType ("LinkAll.Attributes.CustomTypeAAA"), "CustomTypeAAA");
|
||||
//Assert.NotNull (Type.GetType ("LinkAll.Attributes.CustomTypeAAAA"), "CustomTypeAAAA");
|
||||
|
||||
var t = assembly.GetCustomAttributes<CustomAttribute>();
|
||||
Assert.That (t.Count (), Is.EqualTo (1), "Type");
|
||||
Assert.That (t.Count (), Is.EqualTo (2), "Type");
|
||||
Assert.NotNull (Type.GetType ("LinkAll.Attributes.CustomType"), "CustomType");
|
||||
Assert.NotNull (Type.GetType ("LinkAll.Attributes.CustomTypeG"), "CustomTypeG");
|
||||
|
||||
//var to = assembly.GetCustomAttributes<CustomAttributeObject> ();
|
||||
//Assert.That (to.Count (), Is.EqualTo (1), "Object");
|
||||
//Assert.NotNull (Type.GetType ("LinkAll.Attributes.CustomTypeO"), "CustomTypeO");
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
Загрузка…
Ссылка в новой задаче