Silverlight Bugs and Workarounds

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

The AspectRatio property of MultiScaleImage does not report the correct value (continues to report its previous value) after you assign a custom implementation of MultiScaleTileSource to the Source property and wait for the ImageOpenSucceeded event.  It looks like only DeepZoomImageTileSource causes the AspectRatio to update correctly.
Workaround: Once aware of this issue, developers using custom tile sources can compute the correct aspect ratio from the width and height that the custom tile source must pass to the constructor of MultiScaleTileSource rather than relying on the MultiScaleImage.AspectRatio property.  It's annoying, but not the end of the world.
Bug Status: This will probably not get fixed any time soon.


Multiple Bit Rate Video Freezes when covered in Safari 3 or FireFox 3 on Mac

If you cover up a MBR Video that is playing (e.g. by viewing another tab in the browser or covering the video rendering surface with another window), the video will eventually stop playing. When you go back to the tab, or otherwise uncover the video, the video will either take 10-20 seconds to restart playing, or it will not restart at all (depending on how long it had been covered). This only effects applications running on Safari 3 or FireFox 3 on Mac.
Workaround: There is no workaround at this time.
Bug Status: Active bug. *


Cannot set ScrollViewer.VerticalScrollBarVisibility/HorizontalScrollBarVisibility attached properties on a custom Control or Panel from Xaml.
Workaround: There is no workaround at this time.
Bug Status: Active bug. *


Memory Leak when you Dynamically add and remove Images

Workaround: When dynamically adding or removing BitmapImages from an application (a.k.a. adding/removing from the tree), you should set Image.Source = null before removing the Image element from the tree. This will make the BitmapImage eligible for garbage collection.
Bug Status: Active bug. *


StackOverflowException when animating many controls at the same time

This is caused by a deep stack of methods calling one after the other.
Workaround: Instead of calling the VisualStateManager.GotoState method in the property change notification, queue the call with Dispatcher.BeginInvoke.
Bug Status: Active bug. *


Seeking (fast forwarding and rewinding) in progressive download is broken in low bandwidth configurations.

If your customers have a slow connection and they try to seek forward or backward on a progressive download, the progress bar *might* disappear and an error is thrown.
Workaround: Respond to the MediaFailed event and reset MediaElement.Source and set the position according to the current seek slider position.
Bug Status: Active bug. *


ImageSource and ImageBrush events can cause a memory leak

For example, the code below creates and discards a user control name "ImageControl":

    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("https://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="https://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="https://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="https://foo.com/"

DownloadProgress="imageSource_DownloadProgress" />
                    </Image.Source>
                </Image>
               
                <Rectangle Name="_rectangle">
                    <Rectangle.Fill>
                        <ImageBrush x:Name="_imageBrush2" ImageSource="https://contoso.com/" />
                    </Rectangle.Fill>
                </Rectangle>
               
            </StackPanel>

        </Grid>


Seeking forward for large files (3GB) does not work on FireFox

Seeking forward does not actualy play media for Large files (3GB) on FireFox. This works fine for Internet Explorer.
Workaround: There is currently no workaround for this.
Bug Status: Active bug. *


Large files of 3.5GB Fails to play on MAC (FireFox or Safari)

This is an issue on FireFox or Safari on Mac. It is working fine on Windows.
Workaround: There is currently no workaround for this. Note that the hard limit for file size in the future will be 4GB because that is what the browser supports.
Bug Status: Active bug. *


MediaElement does not play a stream returned by the BrowserHttpWebRequest if AllowReadStreamBuffering is set to false

Workaround: If the AllowReadStreamBuffering is set to true (default), the media clip plays.
Bug Status: Active bug. *


Using percentages to specify width and height can cause issues on FireFox

Sometimes when percentages are used to specify the width and height of a Silverlight object you create, the object will not render. This issue only effects Firefox (Windows and Mac).
Workaround: Remove this line from the file to get % heights to work in FF.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Bug Status: Browser difference and is not necessarily going to get fixed. *


In managed code you can derive from Brush but it always fails.

When this bug gets fixed you will either not be allowed to derive from brush or you can and it will succeed.
Workaround: Don't derive from Brush.
Bug Status: Active Bug. *

 

* The bug status is only an educated guess. There is no garantee that the bug will be fixed or not fixed.