Bug found when the silverlight app is unloading...
Last post 05-10-2008 8:14 AM by Tecfield. 10 replies.
Sort Posts:
05-04-2008 8:59 PM
Bug found when the silverlight app is unloading...

There is one annoying problem is happening that i' got a project in sl 2.0 and making a call in the aspx file.

When I load this sl project it works however, when i move somewhere else i got this java script error:

"Object doesn't support this property or method'

 

When I stop for debugging it shows following line:

 host.content.OnFullScreenChange = null;

 

file name; ScriptResource.axd


I've marked with bold color that is breaking:

 function Sys$UI$Silverlight$Control$dispose() {
        if (this._loaded) {
            this.pluginDispose();
            this._loaded = false;
        }

        var host = this.get_element();
        if (host) {
            if (this._setOnLoad) {
                host.OnLoad = null;
            }
            if (this._setOnError) {
                host.OnError = null;
            }
            if (this._setOnFullScreenChange) {
                host.content.OnFullScreenChange = null;
            }
            if (this._setOnResize) {
                host.content.OnResize = null;
            }
        }

 

 

"If I've answered your query, please mark "Answered".

codebased

Joined on 03-05-2008
Australia
Posts 78
05-04-2008 9:22 PM
Re: Bug found when the silverlight app is unloading...

I have a few questions.  

Are you using asp:Silverlight control in ASPX page?

Are you getting this error in new project that you didn't make any modification? If not, please try to create new project and let us know whether you got this error or not.  If you are not getting any error in new project,  please show us the code or XAML or etc that you wrote in your project.

 

(If this has answered your question, please click on "Mark as Answer" on this post. Thank you!)

Best Regards,
Michael Sync

Blog : http://michaelsync.net
Feed : http://michaelsync.net/feed

mchlSync

Joined on 09-16-2005
Singapore
Posts 2,021
05-04-2008 9:56 PM
Re: Re: Bug found when the silverlight app is unloading...

Actually we are working on the same project (me & codebased)

The problem is generic and not because of a particular formatting! If you put a silverlight control in an aspx page and this control be within an iFrame or UpdatePanel, when you try to update the area the control will throw this error in IE. The same problem in FireFox.

There is no definition for OnFullScreenChange in our code and we are not using fullscreen mode at all!

The only thing I can think about it is a bug within dynamic javascript code attached to the control at runtime.

 

If it is helpful the javascript path is: ScriptResource.axd

 

function definition:

 

function Sys$UI$Silverlight$Control$dispose()

 {

if (this._loaded)

 {

this.pluginDispose();

this._loaded = false;

}

var host = this.get_element();

if (host)

{

if (this._setOnLoad)

{

host.OnLoad = null;

}

if (this._setOnError)

 {

host.OnError = null;

}

if (this._setOnFullScreenChange)

{

host.content.OnFullScreenChange = null;

}

if (this._setOnResize)

 {

host.content.OnResize = null;

}

}

var boundEvents = this._boundEvents;

if (boundEvents)

{

for (var i = 0, l = boundEvents.length; i < l; i++)

{

var e = boundEventsIdea;

var element = e.element;

var events = e.events;

for (var j = 0, m = events.length; j < m; j++)

 {

var event = events[j];

element.removeEventListener(event.eventName, event.token);

}

}

this._boundEvents = null;

}

Sys.UI.Silverlight.Control.callBaseMethod(this, "dispose");

}

 

As you can see, when control is disposing, the RED line executes and throw the error!

Tecfield

Joined on 01-10-2008
Posts 8
05-05-2008 4:31 AM
Re: Bug found when the silverlight app is unloading...

Hello, I still can't reproduce it. Try to create a new project, wrap the Silverlight plug-in in an UpdatePanel, and do a post back. Will the error occur?

shanaolanxing - Please mark the posts as answers if they help and unmark if they don't.

Yi-Lun Luo - MSFT

Joined on 10-29-2007
Posts 1,084
05-05-2008 7:38 PM
Re: Bug found when the silverlight app is unloading...

I did!

It doesn't matter where and how you update it. Once you want to unload the control and replace it whilst the page is not gonna refresh, you will get this error. To reproduce the error, you need to turn on IE debug or if you are using FireFox you need to install Firebug.

Just try to create a simple project to reproduce error. If you don't have enough time, tell me to do it and send the project to you. Our developing environment is running on Windows Server 2003 R2.

Tecfield

Joined on 01-10-2008
Posts 8
05-05-2008 11:08 PM
Re: Re: Bug found when the silverlight app is unloading...

Hi, I tried that on a Windows Server 2003 R2 machine, but it still works fine. I just created an empty Silverlight application, and modify the hosting aspx page to something like this:

 <asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Button ID="Button1" runat="server" Text="Button" />
<div style="height: 100%;">
<asp:Silverlight ID="Xaml1" runat="server" Source="~/ClientBin/SilverlightApplication1.xap"
Version="2.0" Width="100%" Height="100%" />
</div>
</ContentTemplate>
</asp:UpdatePanel>

When clicking the Button to refresh the UpdatePanel, I didn't notice any script errors. I've turned on IE's script debugging.

Can you send me a repro application to v-ylluo at microsoft dot com?

shanaolanxing - Please mark the posts as answers if they help and unmark if they don't.

Yi-Lun Luo - MSFT

Joined on 10-29-2007
Posts 1,084
05-06-2008 1:06 AM
Re: Bug found when the silverlight app is unloading...

Yep; you right. With updatepanel it is ok. But iFrame is not!

Try this one:

iFrameTest.aspx file:

<>

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="iFrameTest.aspx.cs" Inherits="TestWebApplication.iFrameTest" %>

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

     <title>Untitled Page</title>

</head>

<body>

     <form id="form1" runat="server">

     <div>

          <asp:ScriptManager ID="testScriptManager" runat="server" />

          <asp:UpdatePanel ID="testUpdatePanel" runat="server" UpdateMode="Conditional">

              <ContentTemplate>

                   <iframe width="800px" height="400px" id="testiFrame" runat="server" frameborder="0" />

              </ContentTemplate>

          </asp:UpdatePanel>

          <asp:UpdatePanel ID="testButtonUpdatePanel" runat="server" UpdateMode="Conditional">

              <ContentTemplate>

                   <asp:Button ID="testUpdateButton" runat="server" OnClick="testUpdateButtonClicked"

                        Text="Update iFrame" UseSubmitBehavior="false" />

              </ContentTemplate>

          </asp:UpdatePanel>

     </div>

     </form>

</body>

</html>

 

 

iFrame.aspx.cs File:

 

using System;

 

namespace TestWebApplication

{

     public partial class iFrameTest : System.Web.UI.Page

     {

          protected void testUpdateButtonClicked(object sender, EventArgs e)

          {

              this.testiFrame.Attributes["src"] = "/Test.aspx";

              this.testUpdatePanel.Update();

          }

     }

}

 

 

 

 

Now create an aspx file, call it Test.aspx and put an empty silverlight control in it. Run application to reproduce error.
once control loaded into the browser and try to unload it and replace it by another one, error throws...
I hope this can help you.
 
With our website architecture, we need to use iFrames. 
 
Thanks.
Tecfield

Joined on 01-10-2008
Posts 8
05-06-2008 2:20 AM
Re: Re: Bug found when the silverlight app is unloading...

OK. Finally I've managed to reproduce it. Thanks for reporting it. I'll bring this to our product team.

shanaolanxing - Please mark the posts as answers if they help and unmark if they don't.

Yi-Lun Luo - MSFT

Joined on 10-29-2007
Posts 1,084
05-08-2008 9:44 PM
Re: Re: Bug found when the silverlight app is unloading...

Do you have any temporary option available so that I may represent our work to the management? At present it is annoying...!!

When are we going to get Go-Live version , we need it badly now... ?

Let me know if you need one more mind to work for SL team that may push development fast :-)

 

BTW SL team must give a t-shirt to the person who report bug in SL  Embarrassed

kidding.;-/

 

 

"If I've answered your query, please mark "Answered".

codebased

Joined on 03-05-2008
Australia
Posts 78
05-09-2008 12:03 AM
Re: Re: Re: Bug found when the silverlight app is unloading...

I think you can take the iframe out of the UpdatePanel. Then you won't get any errors. With some CSS layout tricks, you'll be able to position the iframe on its original point.

shanaolanxing - Please mark the posts as answers if they help and unmark if they don't.

Yi-Lun Luo - MSFT

Joined on 10-29-2007
Posts 1,084
05-10-2008 8:14 AM
Re: Bug found when the silverlight app is unloading...

maybe it's working that way! but if we take the update panel out of frame, the new problem is the back button on browser which will get active. currently we have no history management! and as you know history management in silverlight apps is horrible. we may need to turn off our browser's debugging option for a while till new version fixes this bug.

Tecfield

Joined on 01-10-2008
Posts 8