Skip to content

Commit 362600b

Browse files
authored
Use Samsung-provided releases of netcoredbg (#5)
1 parent b9a1d00 commit 362600b

File tree

6 files changed

+134
-13
lines changed

6 files changed

+134
-13
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ C# extension for vscode-compatible editors.
44

55
## Why?
66
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.
7-
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).
7+
This extension replaces it with [Samsung's MIT-licensed alternative](https://github.com/Samsung/netcoredbg/blob/master/LICENSE).
88

99
## Installation:
1010
This extension is published at [open-vsx.org](https://open-vsx.org/extension/muhammad-sammy/csharp).

package-lock.json

Lines changed: 84 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@
8989
"semver": "5.6.0",
9090
"stream": "0.0.2",
9191
"strip-bom": "3.0.0",
92+
"tar": "6.0.5",
9293
"tmp": "0.0.33",
9394
"vscode-debugprotocol": "1.33.0",
9495
"vscode-extension-telemetry": "0.1.6",
@@ -111,6 +112,7 @@
111112
"@types/mocha": "5.2.5",
112113
"@types/node": "10.12.24",
113114
"@types/semver": "5.5.0",
115+
"@types/tar": "4.0.3",
114116
"@types/tmp": "0.0.33",
115117
"@types/unzipper": "^0.9.1",
116118
"@types/vscode": "1.33.0",
@@ -251,7 +253,8 @@
251253
{
252254
"id": "Debugger",
253255
"description": ".NET Core Debugger (Windows / x64)",
254-
"url": "https://github.com/jamsilva/netcoredbg/releases/download/latest/netcoredbg-win64-master.zip",
256+
"url": "https://github.com/Samsung/netcoredbg/releases/latest/download/netcoredbg-win64-master.zip",
257+
"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",
255258
"installPath": ".debugger",
256259
"platforms": [
257260
"win32"
@@ -264,33 +267,29 @@
264267
{
265268
"id": "Debugger",
266269
"description": ".NET Core Debugger (macOS / x64)",
267-
"url": "https://github.com/jamsilva/netcoredbg/releases/download/latest/netcoredbg-osx-master.zip",
270+
"url": "https://github.com/Samsung/netcoredbg/releases/latest/download/netcoredbg-win64-master.zip",
271+
"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",
268272
"installPath": ".debugger",
269273
"platforms": [
270274
"darwin"
271275
],
272276
"architectures": [
273277
"x86_64"
274278
],
275-
"binaries": [
276-
"netcoredbg/netcoredbg"
277-
],
278279
"installTestPath": ".debugger/netcoredbg/netcoredbg"
279280
},
280281
{
281282
"id": "Debugger",
282283
"description": ".NET Core Debugger (linux / x64)",
283-
"url": "https://github.com/jamsilva/netcoredbg/releases/download/latest/netcoredbg-linux-master.zip",
284+
"url": "https://github.com/Samsung/netcoredbg/releases/latest/download/netcoredbg-linux-bionic.tar.gz",
285+
"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",
284286
"installPath": ".debugger",
285287
"platforms": [
286288
"linux"
287289
],
288290
"architectures": [
289291
"x86_64"
290292
],
291-
"binaries": [
292-
"netcoredbg/netcoredbg"
293-
],
294293
"installTestPath": ".debugger/netcoredbg/netcoredbg"
295294
},
296295
{

src/coreclr-debug/activate.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ export class DebugAdapterExecutableFactory implements vscode.DebugAdapterDescrip
155155
// use the executable specified in the package.json if it exists or determine it based on some other information (e.g. the session)
156156
if (!executable) {
157157
const command = path.join(common.getExtensionPath(), ".debugger", "netcoredbg", "netcoredbg" + CoreClrDebugUtil.getPlatformExeExtension());
158-
executable = new vscode.DebugAdapterExecutable(command);
158+
executable = new vscode.DebugAdapterExecutable(command, ["--interpreter=vscode"]);
159159
}
160160

161161
// make VS Code launch the DA executable
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*---------------------------------------------------------------------------------------------
2+
* Licensed under the MIT License. See License.txt in the project root for license information.
3+
*--------------------------------------------------------------------------------------------*/
4+
5+
import * as tar from 'tar';
6+
import { Readable } from 'stream';
7+
import { EventStream } from "../EventStream";
8+
import { InstallationStart, ZipError } from "../omnisharp/loggingEvents";
9+
import { NestedError } from '../NestedError';
10+
import { AbsolutePath } from './AbsolutePath';
11+
12+
export async function InstallTarGz(buffer: Buffer, description: string, destinationInstallPath: AbsolutePath, eventStream: EventStream): Promise<void> {
13+
eventStream.post(new InstallationStart(description));
14+
15+
return new Promise<void>((resolve, reject) => {
16+
const reader = new Readable();
17+
reader.push(buffer);
18+
reader.push(null);
19+
reader.pipe(
20+
tar.extract({
21+
cwd: destinationInstallPath.value
22+
})
23+
)
24+
.on('error', err => {
25+
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";
26+
eventStream.post(new ZipError(message));
27+
return reject(new NestedError(message));
28+
})
29+
.on('end', () => resolve());
30+
});
31+
}
32+

src/packageManager/downloadAndInstallPackages.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import { PackageError } from './PackageError';
77
import { NestedError } from "../NestedError";
88
import { DownloadFile } from './FileDownloader';
9+
import { InstallTarGz } from './TarGzInstaller';
910
import { InstallZip } from './ZipInstaller';
1011
import { EventStream } from '../EventStream';
1112
import { NetworkSettingsProvider } from "../NetworkSettings";
@@ -32,7 +33,13 @@ export async function downloadAndInstallPackages(packages: AbsolutePathPackage[]
3233
let buffer = await DownloadFile(pkg.description, eventStream, provider, pkg.url, pkg.fallbackUrl);
3334
if (downloadValidator(buffer, pkg.integrity, eventStream)) {
3435
installationStage = "installPackage";
35-
await InstallZip(buffer, pkg.description, pkg.installPath, pkg.binaries, eventStream);
36+
if (pkg.url.includes(".tar.gz")) {
37+
await InstallTarGz(buffer, pkg.description, pkg.installPath, eventStream);
38+
}
39+
else {
40+
await InstallZip(buffer, pkg.description, pkg.installPath, pkg.binaries, eventStream);
41+
}
42+
3643
installationStage = 'touchLockFile';
3744
await touchInstallFile(pkg.installPath, InstallFileType.Lock);
3845
break;

0 commit comments

Comments
 (0)