There are certain contracts I know that the static analyzer cannot possibly prove. I can exclude certain kinds of contract violation errors from an entire function, but this is too broad-brushed. I can exclude certain violation errors by using the baseline.xml functionality, though this is essentially impossible to audit or document in a team environment.
In short, is it possible to do something like
Contract.Requires(DoesHalt() == true, ExcludeFromStaticAnalysis=true);
There are also certain contracts made in 3rd parties libraries that appear to be dead ends for the static analyzer. I'd like to disable them for static analysis. One favorite example is a contract built to a .NET graph library. The argument to a depth first search function specifying which vertex in the graph to begin the search with has a Contract.Requires
which demands that vertex be a member of the graph. Sensible contract, maybe even worth executing in a debug build, but a long way from being statically provable. Yet every time I use the depth first search, I have to find a way to ignore the static violation. (It's not solvable with a Contract.Assume
either)
Without the ability to partition provable stuff from unprovable stuff, I'm finding the static analysis to simply be far too noisy, even with a small clean code base.