Silverlight Error Code 4001 AG_E_NETWORK_ERROR

I encountered this error today, working on a custom Silverlight application.  According to Silverlight.Net this is not a bug.  However, I think it is an issue with Silverlight 2.0 RTW release.  Based on other posts the following situation causes this issue.  You have two images one next to another in your XAML that have the same image file name as source.  Image is actually displayed properly even with the error.  This is exactly what I have in my page.  Here is a workaround that I found.  I had to add the following code to the ASPX page that hosts Silverlight control.

<script type="text/javascript">
    function tellerror(msg, url, linenumber) {
        if (msg.toString().indexOf("Image") >= 0 && msg.toString().indexOf("4001") >= 0) {
            return true;
        }
        else {
            alert('Error message= ' + msg + 'nURL= ' + url + 'nLine Number= ' + linenumber)
            return true;
        }
    }

    window.onerror = tellerror;
</script>

Leave a Reply

Your email address will not be published. Required fields are marked *