Skip to content

Commit

Permalink
Merge pull request #4492 from OmniSharp/bugfix/mono
Browse files Browse the repository at this point in the history
move the global Mono check to the correct place
  • Loading branch information
JoeRobich authored Apr 9, 2021
2 parents 7c85228 + 78167cd commit 84669d1
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/omnisharp/OmniSharpMonoResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,16 @@ export class OmniSharpMonoResolver implements IMonoResolver {

public async getGlobalMonoInfo(options: Options): Promise<MonoInformation> {
let monoInfo = await this.configureEnvironmentAndGetInfo(options);

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") {
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}`);
}

if (!isValid) {
throw new Error(`Found Mono version ${monoInfo.version}. Cannot start OmniSharp because Mono version >=${this.minimumMonoVersion} is required.`);
}
Expand Down

0 comments on commit 84669d1

Please sign in to comment.