New attribute suggestion for .Net Framework
I have entered a suggestion on the MSDN Product Feedback Center (a service I had previously talked about). You can search for the suggestion using the phrase “Attribute to provide Compiler Warning/Error other than Obsolete”.
The suggestion is based on the following scenario: During development you may have multiple developers working on several assemblies in parallel. Some developers may be creating APIs to use by other developers but their tasks are such that they need to stub the implementation until they get around to finishing everything. Think of the UI developer who needs to make calls into the business layer to retrieve some data. If the mid-tier developer providing that call doesn’t have time to complete the method they could stub it and just return a mocked up DataSet until it is complete. That way the UI developer can code against the API and keep working. It would be nice if the mid-tier developer could pop a compiler warning or message that stated that the method was currently stubbed (much like the System.ObsoleteAttribute can do). This would alert the UI developer that the code is returning something but that the final implementation is not complete. They would then be able to make a note to monitor for when this warning disappears or when they get notified that the implementation is complete so they can go back and retest their usage (aka, they are getting back what they expect). The key is that they are not stopped from using the API and continuing with their own tasks.
Of course, there may be other usages of this type of attribute, but the above is why I started thinking about it. Some people use the Task List tokens to do this, but that would require that the consumer is seeing the code (such as when everything is in one solution), but doesn’t handle the situation when the called code is just referenced in. Another workaround would be to use the obsolete attribute, but then you give the false context that the method will be going away rather than just wanting to provide a warning about it.
I’d like to see this as an attribute provided by the framework (rather than some mechanism to do it with custom attributes) because I don’t want to have to reference in a custom attribute library in all the code for development purposes only.
If you like, or dislike the idea, please head over to the feedback center and provide your comments on the matter.