Skip to content
This repository has been archived by the owner on Mar 2, 2022. It is now read-only.

Commit

Permalink
Use Samsung-provided releases of netcoredbg (dotnet#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
jamsilva authored Oct 31, 2020
1 parent b9a1d00 commit 362600b
Show file tree
Hide file tree
Showing 6 changed files with 134 additions and 13 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ C# extension for vscode-compatible editors.

## Why?
The debugger included in the official C# extension is [proprietary](https://aka.ms/VSCode-DotNet-DbgLicense) and is licensed to only work with Microsoft versions of vscode.
This extension replaces it with a [custom version](https://github.com/jamsilva/netcoredbg) of [Samsung's MIT-licensed alternative](https://github.com/Samsung/netcoredbg/blob/master/LICENSE).
This extension replaces it with [Samsung's MIT-licensed alternative](https://github.com/Samsung/netcoredbg/blob/master/LICENSE).

## Installation:
This extension is published at [open-vsx.org](https://open-vsx.org/extension/muhammad-sammy/csharp).
Expand Down
85 changes: 84 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 8 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
"semver": "5.6.0",
"stream": "0.0.2",
"strip-bom": "3.0.0",
"tar": "6.0.5",
"tmp": "0.0.33",
"vscode-debugprotocol": "1.33.0",
"vscode-extension-telemetry": "0.1.6",
Expand All @@ -111,6 +112,7 @@
"@types/mocha": "5.2.5",
"@types/node": "10.12.24",
"@types/semver": "5.5.0",
"@types/tar": "4.0.3",
"@types/tmp": "0.0.33",
"@types/unzipper": "^0.9.1",
"@types/vscode": "1.33.0",
Expand Down Expand Up @@ -251,7 +253,8 @@
{
"id": "Debugger",
"description": ".NET Core Debugger (Windows / x64)",
"url": "https://github.com/jamsilva/netcoredbg/releases/download/latest/netcoredbg-win64-master.zip",
"url": "https://github.com/Samsung/netcoredbg/releases/latest/download/netcoredbg-win64-master.zip",
"fallbackUrl": "https://web.archive.org/web/20201023212102if_/https://github-production-release-asset-2e65be.s3.amazonaws.com/113926796/d4b97d80-155d-11eb-8d5f-3dd1c01c1a8e?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20201023%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20201023T212101Z&X-Amz-Expires=300&X-Amz-Signature=eee689635c857b27244d450d90d65600f392ed41b7d5a6ce77fa44fe2060f879&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=113926796&response-content-disposition=attachment%3B%20filename%3Dnetcoredbg-win64.zip&response-content-type=application%2Foctet-stream",
"installPath": ".debugger",
"platforms": [
"win32"
Expand All @@ -264,33 +267,29 @@
{
"id": "Debugger",
"description": ".NET Core Debugger (macOS / x64)",
"url": "https://github.com/jamsilva/netcoredbg/releases/download/latest/netcoredbg-osx-master.zip",
"url": "https://github.com/Samsung/netcoredbg/releases/latest/download/netcoredbg-win64-master.zip",
"fallbackUrl": "https://web.archive.org/web/20201023212454if_/https://github-production-release-asset-2e65be.s3.amazonaws.com/113926796/e77a8500-1552-11eb-8b31-fe0e14726f36?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20201023%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20201023T212454Z&X-Amz-Expires=300&X-Amz-Signature=2a34e55e502e63d3e2b470ec64124f2a5ec4e31dfc71b4e4058171a747f940e6&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=113926796&response-content-disposition=attachment%3B%20filename%3Dnetcoredbg-osx.tar.gz&response-content-type=application%2Foctet-stream",
"installPath": ".debugger",
"platforms": [
"darwin"
],
"architectures": [
"x86_64"
],
"binaries": [
"netcoredbg/netcoredbg"
],
"installTestPath": ".debugger/netcoredbg/netcoredbg"
},
{
"id": "Debugger",
"description": ".NET Core Debugger (linux / x64)",
"url": "https://github.com/jamsilva/netcoredbg/releases/download/latest/netcoredbg-linux-master.zip",
"url": "https://github.com/Samsung/netcoredbg/releases/latest/download/netcoredbg-linux-bionic.tar.gz",
"fallbackUrl": "https://web.archive.org/web/20201023212424if_/https://github-production-release-asset-2e65be.s3.amazonaws.com/113926796/cddb3c80-1556-11eb-832f-5361171540d7?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20201023%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20201023T212424Z&X-Amz-Expires=300&X-Amz-Signature=67fb4e138819eaa325ccde7ed6965d9db54fc2296b0a9d2fe4518325d4ab04f2&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=113926796&response-content-disposition=attachment%3B%20filename%3Dnetcoredbg-linux-bionic.tar.gz&response-content-type=application%2Foctet-stream",
"installPath": ".debugger",
"platforms": [
"linux"
],
"architectures": [
"x86_64"
],
"binaries": [
"netcoredbg/netcoredbg"
],
"installTestPath": ".debugger/netcoredbg/netcoredbg"
},
{
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr-debug/activate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ export class DebugAdapterExecutableFactory implements vscode.DebugAdapterDescrip
// use the executable specified in the package.json if it exists or determine it based on some other information (e.g. the session)
if (!executable) {
const command = path.join(common.getExtensionPath(), ".debugger", "netcoredbg", "netcoredbg" + CoreClrDebugUtil.getPlatformExeExtension());
executable = new vscode.DebugAdapterExecutable(command);
executable = new vscode.DebugAdapterExecutable(command, ["--interpreter=vscode"]);
}

// make VS Code launch the DA executable
Expand Down
32 changes: 32 additions & 0 deletions src/packageManager/TarGzInstaller.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*---------------------------------------------------------------------------------------------
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import * as tar from 'tar';
import { Readable } from 'stream';
import { EventStream } from "../EventStream";
import { InstallationStart, ZipError } from "../omnisharp/loggingEvents";
import { NestedError } from '../NestedError';
import { AbsolutePath } from './AbsolutePath';

export async function InstallTarGz(buffer: Buffer, description: string, destinationInstallPath: AbsolutePath, eventStream: EventStream): Promise<void> {
eventStream.post(new InstallationStart(description));

return new Promise<void>((resolve, reject) => {
const reader = new Readable();
reader.push(buffer);
reader.push(null);
reader.pipe(
tar.extract({
cwd: destinationInstallPath.value
})
)
.on('error', err => {
let message = "C# Extension was unable to install its dependencies. Please check your internet connection. If you use a proxy server, please visit https://aka.ms/VsCodeCsharpNetworking";
eventStream.post(new ZipError(message));
return reject(new NestedError(message));
})
.on('end', () => resolve());
});
}

9 changes: 8 additions & 1 deletion src/packageManager/downloadAndInstallPackages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import { PackageError } from './PackageError';
import { NestedError } from "../NestedError";
import { DownloadFile } from './FileDownloader';
import { InstallTarGz } from './TarGzInstaller';
import { InstallZip } from './ZipInstaller';
import { EventStream } from '../EventStream';
import { NetworkSettingsProvider } from "../NetworkSettings";
Expand All @@ -32,7 +33,13 @@ export async function downloadAndInstallPackages(packages: AbsolutePathPackage[]
let buffer = await DownloadFile(pkg.description, eventStream, provider, pkg.url, pkg.fallbackUrl);
if (downloadValidator(buffer, pkg.integrity, eventStream)) {
installationStage = "installPackage";
await InstallZip(buffer, pkg.description, pkg.installPath, pkg.binaries, eventStream);
if (pkg.url.includes(".tar.gz")) {
await InstallTarGz(buffer, pkg.description, pkg.installPath, eventStream);
}
else {
await InstallZip(buffer, pkg.description, pkg.installPath, pkg.binaries, eventStream);
}

installationStage = 'touchLockFile';
await touchInstallFile(pkg.installPath, InstallFileType.Lock);
break;
Expand Down

0 comments on commit 362600b

Please sign in to comment.