-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove special logic for TypeConverterAttribute (#2659)
- Loading branch information
1 parent
8c0df91
commit b10e1bc
Showing
2 changed files
with
48 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 48 additions & 16 deletions
64
test/Mono.Linker.Tests.Cases/ComponentModel/TypeDescriptionProviderAttributeOnType.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,69 @@ | ||
using System; | ||
using System.ComponentModel; | ||
using System.Diagnostics.CodeAnalysis; | ||
using Mono.Linker.Tests.Cases.Expectations.Assertions; | ||
using Mono.Linker.Tests.Cases.Expectations.Metadata; | ||
|
||
|
||
namespace Mono.Linker.Tests.Cases.ComponentModel | ||
{ | ||
[TypeDescriptionProvider (typeof (CustomTDP))] | ||
|
||
[Kept] | ||
[KeptAttributeAttribute (typeof (TypeDescriptionProviderAttribute))] | ||
class CustomTypeDescriptionProvider_1 | ||
[Reference ("System.dll")] | ||
[ExpectedNoWarnings] | ||
public class TypeDescriptionProviderAttributeOnType | ||
{ | ||
[Kept] | ||
public CustomTypeDescriptionProvider_1 () | ||
public static void Main () | ||
{ | ||
var r1 = new CustomTypeDescriptionProvider_1 (); | ||
IInterface v = InterfaceTypeConverter.CreateVisual (typeof (System.String)); | ||
} | ||
|
||
[TypeDescriptionProvider (typeof (CustomTDP))] | ||
[Kept] | ||
[KeptBaseType (typeof (TypeDescriptionProvider))] | ||
class CustomTDP : TypeDescriptionProvider | ||
[KeptAttributeAttribute (typeof (TypeDescriptionProviderAttribute))] | ||
class CustomTypeDescriptionProvider_1 | ||
{ | ||
[Kept] | ||
public CustomTDP () | ||
public CustomTypeDescriptionProvider_1 () | ||
{ | ||
} | ||
|
||
[Kept] | ||
[KeptBaseType (typeof (TypeDescriptionProvider))] | ||
class CustomTDP : TypeDescriptionProvider | ||
{ | ||
[Kept] | ||
public CustomTDP () | ||
{ | ||
} | ||
} | ||
} | ||
} | ||
|
||
[Reference ("System.dll")] | ||
public class TypeDescriptionProviderAttributeOnType | ||
{ | ||
public static void Main () | ||
[Kept] | ||
[KeptAttributeAttribute (typeof (TypeConverterAttribute))] | ||
[TypeConverter (typeof (InterfaceTypeConverter))] | ||
public interface IInterface | ||
{ } | ||
|
||
[Kept] | ||
[KeptBaseType (typeof (TypeConverter))] | ||
public class InterfaceTypeConverter : TypeConverter | ||
{ | ||
var r1 = new CustomTypeDescriptionProvider_1 (); | ||
[Kept] | ||
public static IInterface CreateVisual ( | ||
[KeptAttributeAttribute (typeof (DynamicallyAccessedMembersAttribute))] | ||
[DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] | ||
Type visualType) | ||
{ | ||
try { | ||
return (IInterface) Activator.CreateInstance (visualType); | ||
} catch { | ||
} | ||
|
||
return null; | ||
} | ||
|
||
[Kept] | ||
public InterfaceTypeConverter () { } | ||
} | ||
} | ||
} |