Is there a global limit to the number of DependencyProperties (or actually Attached Properties) in the WPF (4.0) framework? We seem to have run into it.
We have built a sophisticated application framework on top of WPF. In this framework, a lot of DependencyProperties gets created dynamically. In extreme cases, we are talking about thousands of DependencyProperties.
Today, we ran into the wall. Suddenly, we start getting IndexOutOfRangeExceptions inside DependencyObject.SetValueCommon (full stacktrace below). Interestingly enough, this seems to coincide with the DependencyProperty in question having its GlobalIndex reaching 32768. Since this is one number higher than the max value of a signed 16-bit value, I strongly suspect this is a fixed limit in the WPF framework?
If so, it would be nice if the framework would detect this and throw a better (more clear) exception. Ideally, of course, it would be nice to be able to support a higher number of DPs but at the very least, the framework should detect and not just bail out.
See the attached file for a working example of how to reproduce the problem.
Please redirect this to someone in the WPF (Windows Presentation Foundation) team. Many thanks in advance.