How to debug javascript in cshtml
<p>I have a .cshtml file of the following format (apologies if my JavaScript terminology is a bit loose)</p>

<pre><code>@model SomeViewModel
@{ Response.ContentType = "application/x-javascript"; }

$(function() {
         // Javascript event handler code here
    }
});

$(function ($) {
        // Javascript JQuery.DatePicker extensions here
    }
});
</code></pre>

<p>I am fairly sure that there is a bug that needs fixing in the second JS block, but I am struggling to debug it.  I am using Chrome.</p>

<p>The picture is somewhat complicated by the fact that there exists a <code>MyDatepicker.js</code> file elsewhere in the solution with the exact same javascript, and a <code>MyDatepicker.min.js</code> which appears at runtime and can be debugged (just about).</p>

<p>So</p>

<ul>
<li>what is happening to the js code in the cshtml - may i ignore it?</li>
<li>how do I ensure a non-minified version of the javascript gets loaded </li>
<li>how do I establish where the minified version of the
script comes from?</li>
</ul>

<hr>

<p>following the advice given below, I find the following class.</p>

<pre><code>public class MyDatePickerController : Controller
{
    // GET: /jquery.mydatepicker.js
    [Minify]
    [HttpGet]
    public ActionResult Index()
    {
        MyDatePickerViewModel model = new MyDatePickerViewModel(); 

        return View(model);
    }
}
</code></pre>

<p>which appears to explain how the javascript gets minified.</p>

<p>Given that there is a MyDatePicker.js file <strong>as well as</strong> the code in the .cshtml file, I am still unsure which copy of the javascript gets loaded.  I will edit one of them, take out the <code>minify</code> and see which gets loaded.</p>

<hr>

<p>Now that I have located the reason the script was being minified I have been able to establish for certain that the javascript being executed was that from the razor file (<code>.cshtml</code>)</p>