diff --git a/package.json b/package.json index d322ed847..6bdaf4232 100644 --- a/package.json +++ b/package.json @@ -739,7 +739,7 @@ ], "default": null, "scope": "machine", - "description": "Specifies the path to a mono installation to use when \"useGlobalMono\" is set to \"always\" or \"auto\", instead of the default system one." + "description": "Specifies the path to a mono installation to use when \"useGlobalMono\" is set to \"always\", instead of the default system one. Example: \"/Library/Frameworks/Mono.framework/Versions/Current\"" }, "omnisharp.waitForDebugger": { "type": "boolean", @@ -3666,4 +3666,4 @@ ] } } -} +} \ No newline at end of file diff --git a/src/omnisharp/OmniSharpMonoResolver.ts b/src/omnisharp/OmniSharpMonoResolver.ts index 655d5a93a..a5ad1468e 100644 --- a/src/omnisharp/OmniSharpMonoResolver.ts +++ b/src/omnisharp/OmniSharpMonoResolver.ts @@ -36,11 +36,19 @@ export class OmniSharpMonoResolver implements IMonoResolver { public async getGlobalMonoInfo(options: Options): Promise { let monoInfo = await this.configureEnvironmentAndGetInfo(options); - let isValid = monoInfo.version && satisfies(monoInfo.version, `>=${this.minimumMonoVersion}`); + let isMissing = monoInfo.version === undefined; + if (isMissing) { + const suggestedAction = options.monoPath + ? "Update the \"omnisharp.monoPath\" setting to point to the folder containing Mono's '/bin' folder." + : "Ensure that Mono's '/bin' folder is added to your environment's PATH variable."; + throw new Error(`Unable to find Mono. ${suggestedAction}`); + } + + let isValid = monoInfo.version && satisfies(monoInfo.version, `>=${this.minimumMonoVersion}`); if (options.useGlobalMono === "always") { if (!isValid) { - throw new Error(`Cannot start OmniSharp because Mono version >=${this.minimumMonoVersion} is required.`); + throw new Error(`Found Mono version ${monoInfo.version}. Cannot start OmniSharp because Mono version >=${this.minimumMonoVersion} is required.`); } return monoInfo;