diff options
Diffstat (limited to 'test/Mono.Linker.Tests.Cases/Extensibility/Dependencies/CustomWarning.cs')
-rw-r--r-- | test/Mono.Linker.Tests.Cases/Extensibility/Dependencies/CustomWarning.cs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/Mono.Linker.Tests.Cases/Extensibility/Dependencies/CustomWarning.cs b/test/Mono.Linker.Tests.Cases/Extensibility/Dependencies/CustomWarning.cs new file mode 100644 index 000000000..9b35ce0d4 --- /dev/null +++ b/test/Mono.Linker.Tests.Cases/Extensibility/Dependencies/CustomWarning.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using Mono.Cecil; +using Mono.Linker; +using Mono.Linker.Steps; + +public class CustomWarning : IMarkHandler +{ + LinkContext _context; + + public void Initialize (LinkContext context, MarkContext markContext) + { + _context = context; + markContext.RegisterMarkTypeAction (type => WarnOnKnownType (type)); + } + + void WarnOnKnownType (TypeDefinition type ) + { + if (type.Name == "KnownTypeThatShouldWarn") + _context.LogMessage (MessageContainer.CreateCustomWarningMessage (_context, "custom warning on type", 6200, new MessageOrigin (type), WarnVersion.ILLink5)); + } +}
\ No newline at end of file |