Show obsolete / obsolete classes in XAML

Context

We had a rather large memory leak in the developed WPF application, which was caused by the use of DropShadowBitmapEffect in the resource library.

The drop shadow was used by some UserControl and all of our menus to cast a shadow on the actual contents of the window, as such:

 <DropShadowBitmapEffect x:Key="PopupDropShadow" ShadowDepth="1.5" Softness="0.15" /> ... <Rectangle BitmapEffect="{StaticResource PopupDropShadow}" ... /> 

I had to profile the application for many hours before I really found the cause of the problem. The DropShadowBitmapEffect class DropShadowBitmapEffect unmanageable and does not allow objects to be GC'd. In addition, you will notice that the DropShadowBitmapEffect class DropShadowBitmapEffect marked as "Deprecated" and that there is an updated class called DropShadowEffect that fixes a memory leak (and also hardware accelerates , thus improving rendering performance). Here is the actual fix:

 <DropShadowEffect x:Key="PopupDropShadow" ShadowDepth="1.5" /> ... <Rectangle Effect="{StaticResource PopupDropShadow}" ... /> 

Question

Is it possible for obsolete / obsolete classes to use compilation errors when used in XAML in Visual Studio 2010?

+4
source share
1 answer

I have not tested it for XAML, but Gendarme has a rule that checks for the use of legacy code .

+1
source

All Articles