diff --git a/vscode-dotnet-runtime-library/src/Acquisition/VersionResolver.ts b/vscode-dotnet-runtime-library/src/Acquisition/VersionResolver.ts index 24020f8ba5..0fc8a7c33d 100644 --- a/vscode-dotnet-runtime-library/src/Acquisition/VersionResolver.ts +++ b/vscode-dotnet-runtime-library/src/Acquisition/VersionResolver.ts @@ -255,7 +255,7 @@ export class VersionResolver implements IVersionResolver { */ private getPatchVersionString(fullySpecifiedVersion : string) : string { - const patch : string | undefined = fullySpecifiedVersion.split('.')?.at(2)?.substring(1); + const patch : string | undefined = fullySpecifiedVersion.split('.')?.at(2)?.substring(1)?.split('-')?.at(0); if(patch === undefined || !this.isNumber(patch)) { const event = new DotnetFeatureBandDoesNotExistError(new EventCancellationError('DotnetFeatureBandDoesNotExistError', diff --git a/vscode-dotnet-runtime-library/src/test/unit/VersionResolver.test.ts b/vscode-dotnet-runtime-library/src/test/unit/VersionResolver.test.ts index 45134e5cc6..4f9723058d 100644 --- a/vscode-dotnet-runtime-library/src/test/unit/VersionResolver.test.ts +++ b/vscode-dotnet-runtime-library/src/test/unit/VersionResolver.test.ts @@ -85,6 +85,10 @@ suite('VersionResolver Unit Tests', () => { assert.equal(resolver.getFeatureBandPatchVersion(twoDigitPatchVersion), '21'); }); + test('Get Patch from SDK Preview Version', async () => { + assert.equal(resolver.getFeatureBandPatchVersion('8.0.400-preview.0.24324.5'), '0'); + }); + test('Detects Unspecified Patch Version', async () => { assert.equal(resolver.isNonSpecificFeatureBandedVersion(fullySpecifiedVersion), false, 'It detects versions with patches'); assert.equal(resolver.isNonSpecificFeatureBandedVersion(featureBandVersion), true, 'It detects versions with xx');