From 5622af26d39fa44bf70fa39c13a202b566c0be8b Mon Sep 17 00:00:00 2001 From: Gregg Miskelly Date: Tue, 1 Mar 2016 13:41:27 -0800 Subject: [PATCH] Add error detection for when content files don't get copied. Older versions of .NET CLI didn't correctly copy content files. This adds error detection for when this happens. --- src/coreclr-debug.ts | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/coreclr-debug.ts b/src/coreclr-debug.ts index afa8e2a56..c8804f4f8 100644 --- a/src/coreclr-debug.ts +++ b/src/coreclr-debug.ts @@ -42,6 +42,8 @@ export function installCoreClrDebug(context: vscode.ExtensionContext) { spawnChildProcess('dotnet', ['--verbose', 'restore'], _channel, _coreClrDebugDir) .then(function() { return spawnChildProcess('dotnet', ['--verbose', 'publish', '-o', _debugAdapterDir], _channel, _coreClrDebugDir); + }).then(function() { + return ensureAd7EngineExists(_channel, _debugAdapterDir); }).then(function() { var promises: Promise[] = []; @@ -147,6 +149,28 @@ function getPlatformLibExtension() : string { } } +function ensureAd7EngineExists(channel: vscode.OutputChannel, outputDirectory: string) : Promise { + let filePath = path.join(outputDirectory, "coreclr.ad7Engine.json"); + return new Promise((resolve, reject) => { + fs.exists(filePath, (exists) => { + if (exists) { + return resolve(); + } else { + channel.appendLine(`${filePath} does not exist.`); + channel.appendLine(''); + // NOTE: The minimum build number is actually less than 1584, but this is the minimum + // build that I have tested. + channel.appendLine("Error: The .NET CLI did not correctly restore debugger files. Ensure that you have .NET CLI version 1.0.0 build #001584 or newer. You can check your .NET CLI version using 'dotnet --version'."); + // TODO: remove the Linux-specific instructions once http://dotnet.github.io/getting-started/ is pointing at a newer build. + if (process.platform === "linux") { + channel.appendLine("To update your build of the .NET Tools, run: sudo apt-get install dotnet=1.0.0.001584-1"); + } + return reject("The .NET CLI did not correctly restore debugger files."); + } + }); + }); +} + function spawnChildProcess(process: string, args: string[], channel: vscode.OutputChannel, workingDirectory: string) : Promise { var promise = new Promise( function (resolve, reject) { const child = child_process.spawn(process, args, {cwd: workingDirectory});