3

I am working on a project using MVC and dropdown lists. When the dropdown list changes, I have some javascript code that needs to execute. I started having trouble debugging it (system locked up everytime) so I created a stripped down, simple example to see where the problem is (sample is below).

When I run this code through IE 11, it works just fine. However, when I run this using the IE 11 developer tools (javascript debugger) and place a breakpoint within my select list change function, the debugger and IE hang. Worse, I cannot close them as my system essentially hangs. The only way out is to log off or shutdown the machine manually. Has anyone run into this issue before? I have had 2 developers where I work try this and it breaks for them as well.

Interestingly, this can be debugged just fine in Google Chrome and Firefox.

<script src="~/Scripts/jquery-2.1.0.js"></script>

<script type="text/javascript">
    $(document).ready(function () {
        $("#mySelect")
            .change(function () {
               var x = $(this).val(); // Breakpoint here
                $("#myTextbox").val(x);
            });

        $("#myTextbox")
            .change(function () {
                var x = $("#myTextbox").val();
                alert(x);
            });
    });
</script>

<select id="mySelect">
    <option value="hello">Hello</option>
    <option value="world">World</option>
</select>

<input type="text" id="myTextbox" />
tereško
  • 58,060
  • 25
  • 98
  • 150
Jonathan Nixon
  • 4,940
  • 5
  • 39
  • 53
  • 2
    it might be IE ?!?? usually its allways is :) why don't you go for chrome or ff ? – Dwza Feb 06 '14 at 15:31
  • You should just report it to IE dev-team. Their debugging tools are horrible. – Timmetje Feb 06 '14 at 15:32
  • are there more than 2 options in the example you're using? or is that it – Kevin B Feb 06 '14 at 15:32
  • This sounds like an IE bug. I'm not sure what else there is to say. I also don't think this is a programming question. – Liam Feb 06 '14 at 15:32
  • why make life hard for yourself. Use the other debugger tools instead – Huangism Feb 06 '14 at 15:32
  • 2
    This question appears to be off-topic because it is about a bug in the IE dev tools – Liam Feb 06 '14 at 15:33
  • never use IE ) Chrome is just fine for debugging purposes – Prosto Trader Feb 06 '14 at 15:34
  • You can also use Visual studio for debugging: http://msdn.microsoft.com/en-us/library/z959x58c.aspx. IF i NEED to debug in IE only use `alert` to debug. console and breakpoints suck in IE and at least alerts act like a breakpoint. It halts your js.. – Timmetje Feb 06 '14 at 15:34
  • @Tim - The javascript in my actual page is part of a Razor page. From what I can tell, you cannot debug javascript on a Razor page through VS 2013. Unless you know of a work around for that? The only one I have seen is to pull the javascript out of the page and place it in it's own file. – Jonathan Nixon Feb 06 '14 at 15:35
  • @KevinB - In this stripped down example, there are only 2 options. In my actual code there are several options. – Jonathan Nixon Feb 06 '14 at 15:39
  • 1
    @Guthwulf Ah too bad, they are still working on that http://connect.microsoft.com/VisualStudio/feedback/details/807088/unable-to-debug-javascript-from-the-vs-2013-ide-unable-to-set-breakpoint Have you tried enabling ASP.NET in debugging options? Or the temporary solution? does it help? Otherwise, there is no answer except a bug-report and using good debugger :) – Timmetje Feb 06 '14 at 15:40
  • 1
    @Tim - ASP.NET debugging was already enabled in both. I'll file a bug report and use Chrome for this. Unfortunately, our client uses IE only. – Jonathan Nixon Feb 06 '14 at 15:46
  • 1
    @Guthwulf Good luck, and if I would get a dollar for everytime I heard: "Unfortunately, our client uses IE only." ...I could've stopped working! – Timmetje Feb 06 '14 at 15:47

1 Answers1

1

Update: This issue since been resolved by Microsoft.

https://connect.microsoft.com/IE/feedback/details/812266/whole-of-windows-ui-hangs-when-hitting-a-breakpoint-within-select-onchange-event

It has been resolved by KB2929437 (http://support.microsoft.com/kb/2929437)


This appears to be a known issue according to Microsoft and there are currently no workarounds.

http://connect.microsoft.com/IE/feedback/details/811122/ie-11-dev-tools-bug-related-to-onchange-event-of-select-element

Jonathan Nixon
  • 4,940
  • 5
  • 39
  • 53