Thank you for the feature request!
Add support for ConditionalAttribute
A .NET feature that is useful is the
Applying ConditionalAttribute to a method indicates to compilers that a call to the method should not be compiled into Microsoft intermediate language (MSIL) unless the conditional compilation symbol that is associated with ConditionalAttribute is defined. You will get a compilation error in Visual Studio if you apply this attribute to a method that does not return void. Applying ConditionalAttribute to an attribute indicates that the attribute should not be emitted to metadata unless the conditional compilation symbol is defined. Any arguments passed to the method or attribute are still type-checked by the compiler.
- 点赞 评论 复制链接分享
Hi, I'd like to share some details regarding this issue. At first sight it looks pretty simple - what we need is just
ConditionalAttributeapplicable to methods and classes (Attribute inheritors only), then the corresponding checks should be implemented in
However, there is another thing which should be addressed. MSDN says that there are 3 ways to define conditional symbols: 1. Use compiler command-line options; for example,
/define:DEBUG2. Use environment variables in the operating system shell; for example,
set DEBUG=13. Use pragmas in the source code, e.g.
The things can become more complicated if undefine pragma should be supported as well, e.g.
I'm going to dive deeper and investigate whether all these techniques can be supported. Hope I'll be able to suggest some solution soon.点赞 评论 复制链接分享
Hi, please note that pragmas are already supported by Bridge点赞 评论 复制链接分享
There was an individual issue for
System.Diagnostics.Debug- #718. Just for references.点赞 评论 复制链接分享