New source level debugging crashes VS

Topics: General
Nov 16, 2012 at 1:43 PM

Hello,

To enable the new source level debugging support in VS I've added --sourcemap and changed to the Debug configuration. But now VS crashes every time on "start debugging".

---bjorn

Coordinator
Nov 16, 2012 at 7:49 PM

Bjorn, 

There's a forum post explaining how to switch projects over to when upgrading here: http://typescript.codeplex.com/discussions/403394

As for the crashing, what version of Windows and VS are you using? 

Nov 16, 2012 at 8:16 PM
Jon,
I’m using Windows 7 Ultimate SP1 and Visual Studio 2012 Ultimate :
Microsoft Visual Studio Ultimate 2012
Version 11.0.50727.1 RTMREL
Microsoft .NET Framework
Version 4.5.50709
---bjorn
From: [email removed]
Sent: Friday, November 16, 2012 12:49 PM
To: [email removed]
Subject: Re: New source level debugging crashes VS [typescript:403492]

From: jonturner

Bjorn,

There's a forum post explaining how to switch projects over to when upgrading here: http://typescript.codeplex.com/discussions/403394

As for the crashing, what version of Windows and VS are you using?

Coordinator
Nov 20, 2012 at 3:35 PM

We've been looking into the crashing issues a couple people have had with the 0.8.1 release (and hope to release something soon to fix the issues we've resolved).

One of the issues seems to be trying to debug files that are not part of your project.  Can you confirm that the files referenced in the .map file created by the compiler are referenced in your project?  This won't be a requirement going forward.  It's just one of the shortcomings of the current release.

If you have an example that does crash even if all the files mentioned in the .map file are in the project, we can take a look and try to work out what's going on.

Nov 26, 2012 at 9:17 AM
Edited Nov 26, 2012 at 9:41 AM

I have a main.ts file whose generated js configures require.js and then creates and runs a bootstrapper object from a bootstrapper.ts file, which then imports the other modules of my application, all of which are included in my project.  

/// <reference path="..\lib\jquery.d.ts"/>
/// <reference path="..\lib\SP.d.ts"/>
/// <reference path="..\lib\require.d.ts" />
/// <reference path="Bootstrapper.ts" />

declare var opportunityManagementVersion: string;

require.config({
    urlArgs: "version=" + opportunityManagementVersion
});

require(["Bootstrapper"], (App) => {
    $(() => {
        ExecuteOrDelayUntilScriptLoaded(() => {
            var bootstrapper = new App.Bootstrapper();
            bootstrapper.Run();
        }, "SP.js");
    });
});

The require.js config specifies that a querystring is added to the urls in order to bust the browser cache. The version is generated on the server as follows:

            this.Page.ClientScript.RegisterClientScriptBlock(
                this.GetType(),
                "version",
                string.Format(CultureInfo.InvariantCulture, "var opportunityManagementVersion = \"{0}\";", GetVersion()),
                true);
            this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "require", "<script src=\"js/lib/require.js\" type=\"text/javascript\" data-main=\"js/app/Main\"></script>", false);

If a javascript error occurs in this main ts file, which does not have this cache busting querystring added to itself, then the VS debugger nicely breaks into the main.ts source file, but if a javascript error occurs in any of the javascript files with the cache busting querystring added then VS crashes. When I revert from 0.8.1 to 0.8.0 then the VS debugger breaks into the js file without crashing. I'm looking forward to a fix to allow the VS debugger to break into the source ts files without crashing when the js urls have this cache busting querystring added.

Dec 6, 2012 at 7:56 PM

0.8.1.1 no longer crashes Visual Studio when the debugger tries to break on an error. However, because my js files have the cache-busting version added to the url querystring, it won't break into the ts file. But it will break into the js file. When I remove

require.config({
    urlArgs: "version=" + opportunityManagementVersion
});

from my main.ts file, then it will break into the ts source files. But ... as soon as I make changes to my ts files, the browser continues to use the old cached version of the js file. I need to empty the browser cache before the browser, or more specifically require.js, will load the latest version of the js file. CTRL+F5 in IE does not work. Perhaps for debugging I would remove the cache busting version from the url querystring for the VS debugger to break into the ts source files, if only there was an automatic way of making sure the browser / require.js loads the latest version of my js files. Note that I will want to add this cache-busting version in the production release of my app, to make sure users always use the latest version of the js files after an upgrade of my app. I made sure my cache busting version is not some client-side generated timestamp, but is the last modified time of the app assembly on the server.

Coordinator
Dec 6, 2012 at 9:21 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.