简体   繁体   中英

Visual Studio throwing exceptions when using Internet Explorer

Coding ASP.net web app with visual studio, i never had any problem when chrome or firefox is the default explorer. But when it's IE, a new project called Script documents suddently appear in my project explorer and visual studio always shows that exception in the new project for every pages load :

JavaScript execution error: Unable to get the property "tagName" of a null or undefined reference

Which doesn't prevent the web app to work, it's just annoying to have to click on the window in visual studio every time i switch pages while debuging.

The window offers me to Stop, Continue, or Ignore.

Ignore make the window reappear instantly, continue make it disapear for a little while...

Haven't found anything that solve it on google, neither in here.

How can this be solved ? And how is explorer so different ?


Edit :

Taking this as an exemple, i'm pretty sure it SHOULD work :

jQuery is not defined twitter bootstrap

And still, the window always pop-up in my IE 11, saying that it haven't foud the tagName property.

So now my new question is, do i have to specify the tag name of every object because i use boothstrap ? Or is it something else that cause the problem ?


EDIT :

This is the Master Page's codes :

<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Canevas.master.cs" Inherits="MandatMobile.Canevas" %>
<%@ Register Src="~/Controls/Menu.ascx" TagPrefix="ctrl" TagName="Menu" %>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta name="viewport" content="width=device-width, initial-scale=1" />
  <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" />
  <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js">    </script>
  <script type="text/javascript" src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<title></title>
    <asp:ContentPlaceHolder ID="HeadContent" runat="server" >
    </asp:ContentPlaceHolder>
</head>
<body>

    <form runat="server" style="position:absolute; left:10px;">
    <asp:Image runat="server" ImageUrl="~/Img/Fullogo.jpg" ></asp:Image>


    <h2 style="position:absolute; top:-5px; left:120px; width:1200px;" >
    <asp:ContentPlaceHolder ID="title" runat="server" >
    </asp:ContentPlaceHolder>
    </h2> 

   <%if (Convert.ToInt32(Session["Level"]) != 1)
    { %>

    <div style="position:absolute; top:110px; left:0px;">
    <ctrl:Menu ID="Menu1" runat="server" ></ctrl:Menu>
</div>

<% } %>

<br /><br /><br /><br />
    <asp:ContentPlaceHolder ID="BodyContent" runat="server" >
    </asp:ContentPlaceHolder>

  </form>

  </body>
  </html>

SOLVED :


It was ridiculus... there was another menu before i build this one, what i did was put the previous menu in HTML comment and code my new menu on the same page, but the menu in comment was still up and even though it was in comment it was still looking for it's references, just like it WASEN'T in comment... What the... i think that is going to be my new question

Ok A lot of questions lets answer one by one:

"But when it's IE, a new project called Script documents suddently appear in my project explorer ..."

This project as you called, is a mechanism of visual studio that allows the developers debug javascript in the IDE (Visual Studio), but this only work for IE, because, as long as I know, there wasn't no interesting from Microsoft (or the browsers creators) to make it work for other browsers.

If you want to understand better what is it and how to use, enable, disable see this post: Using Visual Studio to Debug JavaScript in IE .

"...and visual studio always shows that exception in the new project for every pages load :"

As @Mithun Pattankar commented in your question, probably this exception occurs in other browsers too, but when you use chrome or firefox, you will get this exception more quietly. To see you have to go to DevTools (F12 in chrome) or some other custom tool, only then will see it.

But because you have the debug javascript in VS enabled, when you used the IE, the exception was thrown in VS instead of the browser.

And still, the window always pop-up in my IE 11, saying that it haven't foud the tagName property.

So now my new question is, do i have to specify the tag name of every object because i use boothstrap ?

Ok some misguidance here. First the problem isn't with the tagName property. Let me explain:

The message error that you got was "Unable to get the property "tagName" of a null or undefined reference" . See the code bellow:

var v1 = { aGenericPropertyName: 10 };

v1.aGenericPropertyName = 20;

var v2 = v1.aGenericPropertyName;

v1 = null;
//or:
v1 = undefined;

var v3 = v1.aGenericPropertyName;

In the last line, depending on the browser, you may get this exception:

"Unable to get the property "aGenericPropertyName" of a null or undefined reference."

Did you get it now? The problem isn't the property, is the object that call the property or more accuracy the absence of an object (null or undefined) in a variable (in my sample code the variable v1).

Or is it something else that cause the problem ?

Well here's the real problem, because this kind of error can occur basically in any part of any javascript code that you added to the page. So it's not possible to solve this only by looking superficially.

I have some suggestions if you want to try. First, make sure you have the correct files of bootstrap.js and jquery.js and they are compatible between itself. Second check if this error is occurring in one of your custom javascript files.

Beyond that we will only be able to help you, if you post the exact line of the exception and how file the error occurs.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM