Skip to content

Commit 50fbecb

Browse files
Fix handling of unknown Linux distributions (#912)
This checkin fixes the behavior of the C# extension if we are on a Linux distribution that we don't understand or support. Before we would attempt to download every different x64 package, and then show a very generic error message.
1 parent d96fb0c commit 50fbecb

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

src/coreclr-debug/activate.ts

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import TelemetryReporter from 'vscode-extension-telemetry';
99
import { CoreClrDebugUtil, DotnetInfo, } from './util';
1010
import * as debugInstall from './install';
1111
import { Logger } from './../logger';
12+
import { PlatformInformation } from './../platform';
1213

1314
let _debugUtil: CoreClrDebugUtil = null;
1415
let _reporter: TelemetryReporter = null;
@@ -20,9 +21,22 @@ export function activate(context: vscode.ExtensionContext, reporter: TelemetryRe
2021
_logger = logger;
2122

2223
if (!CoreClrDebugUtil.existsSync(_debugUtil.debugAdapterDir())) {
23-
// We have been activated but it looks like our package was not installed. This is bad.
24-
logger.appendLine("[ERROR]: C# Extension failed to install the debugger package");
25-
showInstallErrorMessage();
24+
PlatformInformation.GetCurrent().then((info) => {
25+
if (info.runtimeId) {
26+
logger.appendLine("[ERROR]: C# Extension failed to install the debugger package");
27+
showInstallErrorMessage();
28+
} else {
29+
if (info.isLinux) {
30+
logger.appendLine(`[WARNING]: The current Linux distribution '${info.distribution.name}' version '${info.distribution.version}' is not currently supported by the .NET Core debugger. Debugging will not be available.`);
31+
} else {
32+
logger.appendLine(`[WARNING]: The current operating system is not currently supported by the .NET Core debugger. Debugging will not be available.`);
33+
}
34+
}
35+
}, (err) => {
36+
// Somehow we couldn't figure out the platform we are on
37+
logger.appendLine("[ERROR]: C# Extension failed to install the debugger package");
38+
showInstallErrorMessage();
39+
});
2640
} else if (!CoreClrDebugUtil.existsSync(_debugUtil.installCompleteFilePath())) {
2741
_debugUtil.checkDotNetCli()
2842
.then((dotnetInfo: DotnetInfo) => {

src/packages.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,10 @@ export class PackageManager {
9292
return this.GetAllPackages()
9393
.then(list => {
9494
return list.filter(pkg => {
95-
if (pkg.runtimeIds && this.platformInfo.runtimeId && pkg.runtimeIds.indexOf(this.platformInfo.runtimeId) === -1) {
96-
return false;
95+
if (pkg.runtimeIds) {
96+
if (!this.platformInfo.runtimeId || pkg.runtimeIds.indexOf(this.platformInfo.runtimeId) === -1) {
97+
return false;
98+
}
9799
}
98100

99101
if (pkg.architectures && pkg.architectures.indexOf(this.platformInfo.architecture) === -1) {

0 commit comments

Comments
 (0)