Custom highlight policy.

Good day to all.

I'm sorry, if this question was asked before. It means, that I simply could not
find an answer. In this case It would be enought to get the link =)

I am trying to find out, how to add custom policy to code inspection. Valid example:

Possible null exception highlight is disabled if there is System.Debug.Assert, that ensures, that object is not null.
Or it offers to add assertion automatically. I do not have possibility to use default assertions, as it is now allowed
in this framework(mono in context of Unity3d), so I use some custom equivalent. So, I want to add custom policy,
that would grant the same behaviour as with described above, but using my custom assertion instead of default.

Thanks at least for reading =)
As I'd said before, I would be glad even to get link to the answer if it is already exist.

P.S. I'd already checked official documents here
but doesn't understand, how to realise what I want =\ Maybe I just need an example...

1 comment
Comment actions Permalink

Try decorating your custom assertion method with the ContractAnnotationAttribute:

[ContractAnnotation("halt <= condition: false")]
public void Assert(bool condition, string text)


Please sign in to leave a comment.