There are a number of bugs in Silverlight and/or in the web browsers which Silverlight is designed to run in that might trip you up. Below is a rough list of many of these bugs along with workarounds (when available).
Note: I list the bug status to give folks an idea of whether these issues are truly bugs that the product teams are tracking (and are likely going to fix) versus issues that are not likely to get fixed (issue is "By Design" or "Won't Fix"). It is important to note that there is no garantee that any bug listed here will ever get fixed and therefore I can't give an estimate as to when such a fix might occur. Such questions are outside of the scope of this page.
MultiScaleImage.AspectRatio is incorrect when using a custom MultiScaleTileSource
Multiple Bit Rate Video Freezes when covered in Safari 3 or FireFox 3 on Mac
Memory Leak when you Dynamically add and remove Images
StackOverflowException when animating many controls at the same time
Seeking (fast forwarding and rewinding) in progressive download is broken in low bandwidth configurations.
ImageSource and ImageBrush events can cause a memory leak
public partial class Page : UserControl { public Page() { InitializeComponent(); new ImageControl();
} }
... where the user control is defined as:
public partial class ImageControl : UserControl { public ImageControl() { InitializeComponent();
var imageSource = new BitmapImage(new Uri("http://contoso.com/")); imageSource.DownloadProgress += imageSource_DownloadProgress;
var imageBrush = new ImageBrush(); imageBrush.ImageFailed += imageBrush_ImageFailed; } }
As written above, the BitmapImage and ImageBrush leak. The event listeners cause the whole ImageControl to leak.
These are "soft leaks", because they do go away when you reset the core (navigate or refresh in the browser).
Workaround: The workaround is to remove the event listeners, at which point the ImageControl can be collected, though not the ImageSource and ImageBrush.
If the above Page is created in Xaml, then removing the event listeners also makes the ImageSource and ImageBrush collectable. An example of the above page in Xaml: <UserControl x:Class="ImageSourceEvent.ImageControl" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Width="400" Height="300"> <Grid x:Name="LayoutRoot" Background="White"> <StackPanel> <Image Name="_image"> <Image.Source> <BitmapImage x:Name="_bitmapImage2" UriSource="http://foo.com/"
DownloadProgress="imageSource_DownloadProgress" /> </Image.Source> </Image> <Rectangle Name="_rectangle"> <Rectangle.Fill> <ImageBrush x:Name="_imageBrush2" ImageSource="http://contoso.com/" /> </Rectangle.Fill> </Rectangle> </StackPanel>
</Grid>
Seeking forward for large files (3GB) does not work on FireFox
Large files of 3.5GB Fails to play on MAC (FireFox or Safari)
MediaElement does not play a stream returned by the BrowserHttpWebRequest if AllowReadStreamBuffering is set to false
Using percentages to specify width and height can cause issues on FireFox
In managed code you can derive from Brush but it always fails.
* The bug status is only an educated guess. There is no garantee that the bug will be fixed or not fixed.