Chrome mvc issue

Jul 15, 2010 at 3:07 AM

I have been debugging this for a while... But this is what I have figured out...

I have an mvc application and I am trying to include the slide.show into a partial view on the index page. It is embedded in the initial page that loads.

This is the way it is set up so I can catch any errors in the partial view.

<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
<div class="container_20">
    <script type="text/javascript">
        function onSilverlightError(sender, args) {
            var appSource = "";
            if (sender != null && sender != 0) {
                appSource = sender.getHost().Source;
            }

            var errorType = args.ErrorType;
            var iErrorCode = args.ErrorCode;

            if (errorType == "ImageError" || errorType == "MediaError") {
                return;
            }

            var errMsg = "Unhandled Error in Silverlight Application " + appSource + "\n";

            errMsg += "Code: " + iErrorCode + "    \n";
            errMsg += "Category: " + errorType + "       \n";
            errMsg += "Message: " + args.ErrorMessage + "     \n";

            if (errorType == "ParserError") {
                errMsg += "File: " + args.xamlFile + "     \n";
                errMsg += "Line: " + args.lineNumber + "     \n";
                errMsg += "Position: " + args.charPosition + "     \n";
            }
            else if (errorType == "RuntimeError") {
                if (args.lineNumber != 0) {
                    errMsg += "Line: " + args.lineNumber + "     \n";
                    errMsg += "Position: " + args.charPosition + "     \n";
                }
                errMsg += "MethodName: " + args.methodName + "     \n";
            }

            throw new Error(errMsg);
        }
    </script>
    <div class="grid_20">
        <div id="silverlightControlHost">
            <object data="data:application/x-silverlight-2," type="application/x-silverlight-2"
                width="810px" height="380px">
                <param name="source" value="/ClientBin/Vertigo.SlideShow.xap" />
                <param name="onError" value="onSilverlightError" />
                <param name="background" value="#000" />
                <param name="initParams" value="ConfigurationProvider=DarkTheme,DataProvider=XmlDataProvider;Path=/Slideshow/Data.xml" />
                <param name="minRuntimeVersion" value="3.0.40818.0" />
                <param name="autoUpgrade" value="true" />
                <a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=3.0.40818.0" style="text-decoration: none">
                    <img src="http://go.microsoft.com/fwlink/?LinkId=161376" alt="Get Microsoft Silverlight"
                        style="border-style: none" />
                </a>
            </object>
        </div>
    </div>
</div>

It works perfectly in IE 8, IE 7, IE 6, and the most recent version of Firefox. It does not work in Chrome....

This is the error I get...

uncaught Error: Unhandled Error in Silverlight Application 
Code: 4004    
Category: ManagedRuntimeError       
Message: System.NullReferenceException: Object reference not set to an instance of an object.

   at Vertigo.SlideShow.Page.WireEventHandlers()

   at Vertigo.SlideShow.Page.ApplyConfiguration()

   at Vertigo.SlideShow.App.DataProvider_DataFinishedLoading(Object sender, EventArgs e)

   at Vertigo.SlideShow.XmlDataProvider.client_DownloadStringCompleted(Object sender, DownloadStringCompletedEventArgs e)

   at System.Net.WebClient.OnDownloadStringCompleted(DownloadStringCompletedEventArgs e)

   at System.Net.WebClient.DownloadStringOperationCompleted(Object arg)     
Here is the great part. If I use the test .html or .aspx sheet that vs 2010 gives me when I add a silverlight control to a web project, it works in chrome. This however takes it out of the mvc structure.
It is just loading the file from disk at this point. I cannot figure out why this is specifically not working in chrome but it works in every other browser.  Also I am using silverlight 3.0 for the platform.
I am using the vs 2010 developer server although I tried it on IIS7 with the same error although I haven't tested it as extensively on IIS7.
Jul 15, 2010 at 3:51 AM

So after further debugging this appears to be a problem with visibility settings...

I have a custom tab that is just made up of divs and a header and using jquery it makes the tab containers visible and invisible.

The partial view for the slide.show component is in the 3rd tab which is not visible when the page loads. I moved the control to the first tab which is visible when the page loads and it worked. Also after further

debugging it is evident that at least IE 8 (vs 2010 will not attach to chrome) and I assume the rest of them that this works in do not load the slide.show silverlight component until the tab becomes visible.

Chrome however attempts to load the silverlight control on page load which is evidently causing issues with it not being visible... That's by best synopsis.

I guess this is more of a Chrome issue and how it implements hidden silverlight controls. I need to implement something now that stops the control from implementing until it is visible..

Jul 15, 2010 at 4:43 AM

Lesson of the day..

Don't use visibility with silverlight apps

use display:none and display:block...

If only all browsers behaved the same, debugging would be soo much easier, well you would find the bugs faster anyway...

Sep 2, 2010 at 1:17 PM

Hi kcnz :-)

I have the same Error Message at Vertigo Slideshow ..:-(

But i cant get this "error" away..Can you help me ?

Fehler: Unhandled Error in Silverlight Application
Code: 4004   
Category: ManagedRuntimeError      
Message: System.NullReferenceException: [Arg_NullReferenceException]
Argumente:
Debuggingressourcen-Zeichenfolgen sind nicht verfügbar. Oft enthalten der Schlüssel und die Argumente genügend Informationen zur Diagnose des Problems. Weitere Informationen erhalten Sie unter http://go.microsoft.com/fwlink/?linkid=106663&Version=4.0.50826.0&File=mscorlib.dll&Key=Arg_NullReferenceException
   bei Vertigo.SlideShow.Page.WireEventHandlers()
   bei Vertigo.SlideShow.Page.ApplyConfiguration()
   bei Vertigo.SlideShow.App.DataProvider_DataFinishedLoading(Object sender, EventArgs e)
   bei Vertigo.SlideShow.XmlDataProvider.client_DownloadStringCompleted(Object sender, DownloadStringCompletedEventArgs e)
   bei System.Net.WebClient.OnDownloadStringCompleted(DownloadStringCompletedEventArgs e)
   bei System.Net.WebClient.DownloadStringOperationCompleted(Object arg)    

Quelldatei: http://develop.nordsee-urlaub.de/Home.aspx
Zeile: 1422

 

 

 

-------------------------------------

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="View.ascx.cs" Inherits="News.View" %>


    <link type="text/css" rel="stylesheet" href="/DesktopModules/Aktuelles/Default.css" />
 

   
  <script type="text/javascript">
      function onSilverlightError(sender, args) {
          var appSource = "";
          if (sender != null && sender != 0) {
              appSource = sender.getHost().Source;
          }

          var errorType = args.ErrorType;
          var iErrorCode = args.ErrorCode;

          if (errorType == "ImageError" || errorType == "MediaError") {
              return;
          }

          var errMsg = "Unhandled Error in Silverlight Application " + appSource + "\n";

          errMsg += "Code: " + iErrorCode + "    \n";
          errMsg += "Category: " + errorType + "       \n";
          errMsg += "Message: " + args.ErrorMessage + "     \n";

          if (errorType == "ParserError") {
              errMsg += "File: " + args.xamlFile + "     \n";
              errMsg += "Line: " + args.lineNumber + "     \n";
              errMsg += "Position: " + args.charPosition + "     \n";
          }
          else if (errorType == "RuntimeError") {
              if (args.lineNumber != 0) {
                  errMsg += "Line: " + args.lineNumber + "     \n";
                  errMsg += "Position: " + args.charPosition + "     \n";
              }
              errMsg += "MethodName: " + args.methodName + "     \n";
          }

          throw new Error(errMsg);
      }
    </script>

 <div class="rahmen">
    <asp:Panel ID="silverlightControlHost" runat="server">
        <object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="640" height="480">
         <param name="source" value="<%=SilverlightApplication %>" />
        <param name="onError" value="onSilverlightError" />
        <param name="background" value="Transparent" />
         <param name="windowless" value="true" />
         <param name="minRuntimeVersion" value="4.0.50826.0" />
         <param name="autoUpgrade" value="true" />
        <param name="InitParams" value="<%=SilverlightInitParams %>" />
    
     <a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=4.0.50826.0" style="text-decoration: none">
                    <img src="http://go.microsoft.com/fwlink/?LinkId=161376" alt="Get Microsoft Silverlight"
                        style="border-style: none" />
                </a>
            </object>

            <iframe id="Iframe1" style="visibility: hidden; height: 0px; width: 0px; border: 0px">
            </iframe> 
       </asp:Panel>
   </div>