October 26, 2012

WPF style resources bug causes stack overflow in .NET 3.5

Filed under: Development — Tags: , , — Arne Joris @ 8:12 am

XAML logo We recently re-wrote an AutoCAD 2010 application to be entirely based on .NET.  Our application was using Windows Presentation Foundation for the presentation layer, which lets you nicely separate presentation from business logic using the MVVM pattern.  Since this application also had to run in AutoCAD 2009, it had to use the .NET 3.5 version.

It turns out there is a bug in .NET 3.5 (fixed in 4.0) that causes a stack overflow exception when you define two or more default style resources for the same type at the same level.  If you use global resource files and window-specific default styles, you may run into this and its not at all obvious what the problem (or the solution) is.

(more…)

Powered by WordPress

Switch to our mobile site