Skip to content

Commit 85a2a4f

Browse files
authored
Merge branch 'release/10.0.2xx' into merge/release/10.0.1xx-to-release/10.0.2xx
2 parents 9957a23 + 97e64dc commit 85a2a4f

File tree

14 files changed

+61
-40
lines changed

14 files changed

+61
-40
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,3 +258,4 @@ Microsoft.TemplateEngine.VC.db
258258

259259
#Rider
260260
.idea/
261+
.nuget/

eng/Versions.props

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
<Project>
22
<Import Project="Version.Details.props" Condition="Exists('Version.Details.props')" />
33
<PropertyGroup>
4-
<VersionPrefix>10.0.101</VersionPrefix>
4+
<VersionPrefix>10.0.200</VersionPrefix>
55
<!-- When StabilizePackageVersion is set to 'true', this branch will produce stable outputs for 'Shipping' packages -->
66
<StabilizePackageVersion Condition="'$(StabilizePackageVersion)' == ''">false</StabilizePackageVersion>
77
<DotNetFinalVersionKind Condition="'$(StabilizePackageVersion)' == 'true'">release</DotNetFinalVersionKind>
88
<!-- Calculate prerelease label -->
9-
<PreReleaseVersionLabel>servicing</PreReleaseVersionLabel>
10-
<PreReleaseVersionIteration></PreReleaseVersionIteration>
9+
<PreReleaseVersionLabel Condition="'$(StabilizePackageVersion)' != 'true'">preview</PreReleaseVersionLabel>
10+
<PreReleaseVersionLabel Condition="'$(StabilizePackageVersion)' == 'true' and $(VersionPrefix.EndsWith('00'))">rtm</PreReleaseVersionLabel>
11+
<PreReleaseVersionLabel Condition="'$(StabilizePackageVersion)' == 'true' and !$(VersionPrefix.EndsWith('00'))">servicing</PreReleaseVersionLabel>
12+
<PreReleaseVersionIteration Condition="'$(StabilizePackageVersion)' != 'true'"></PreReleaseVersionIteration>
1113
<UsingToolXliff>true</UsingToolXliff>
1214
<FlagNetStandard1XDependencies>true</FlagNetStandard1XDependencies>
1315
</PropertyGroup>

src/Microsoft.TemplateEngine.Abstractions/Installer/InstallRequest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public InstallRequest(string identifier, string? version = null, string? install
2424
/// <summary>
2525
/// Name to be used when display the request.
2626
/// </summary>
27-
public string DisplayName => string.IsNullOrWhiteSpace(Version) ? PackageIdentifier : $"{PackageIdentifier}::{Version}";
27+
public string DisplayName => string.IsNullOrWhiteSpace(Version) ? PackageIdentifier : $"{PackageIdentifier}@{Version}";
2828

2929
/// <summary>
3030
/// Installer to be used to install the request.

src/Microsoft.TemplateEngine.Edge/Installers/NuGet/Exceptions/DownloadException.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,21 @@ namespace Microsoft.TemplateEngine.Edge.Installers.NuGet
55
{
66
internal class DownloadException : Exception
77
{
8-
public DownloadException(string packageIdentifier, string packageVersion, string filePath) : base($"Failed to download {packageIdentifier}::{packageVersion} from {filePath}")
8+
public DownloadException(string packageIdentifier, string packageVersion, string filePath) : base($"Failed to download {packageIdentifier}@{packageVersion} from {filePath}")
99
{
1010
PackageIdentifier = packageIdentifier;
1111
PackageVersion = packageVersion;
1212
PackageLocation = filePath;
1313
}
1414

15-
public DownloadException(string packageIdentifier, string packageVersion, IEnumerable<string> attemptedSources) : base($"Failed to download {packageIdentifier}::{packageVersion} from NuGet feeds {string.Join(";", attemptedSources)}")
15+
public DownloadException(string packageIdentifier, string packageVersion, IEnumerable<string> attemptedSources) : base($"Failed to download {packageIdentifier}@{packageVersion} from NuGet feeds {string.Join(";", attemptedSources)}")
1616
{
1717
PackageIdentifier = packageIdentifier;
1818
PackageVersion = packageVersion;
1919
SourcesList = attemptedSources;
2020
}
2121

22-
public DownloadException(string packageIdentifier, string packageVersion, IEnumerable<string> attemptedSources, Exception inner) : base($"Failed to download {packageIdentifier}::{packageVersion} from NuGet feeds {string.Join(";", attemptedSources)}", inner)
22+
public DownloadException(string packageIdentifier, string packageVersion, IEnumerable<string> attemptedSources, Exception inner) : base($"Failed to download {packageIdentifier}@{packageVersion} from NuGet feeds {string.Join(";", attemptedSources)}", inner)
2323
{
2424
PackageIdentifier = packageIdentifier;
2525
PackageVersion = packageVersion;

src/Microsoft.TemplateEngine.Edge/Installers/NuGet/Exceptions/PackageNotFoundException.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ internal class PackageNotFoundException : Exception
1313
SourcesList = attemptedSources;
1414
}
1515

16-
public PackageNotFoundException(string packageIdentifier, NuGetVersion packageVersion, IEnumerable<string> attemptedSources) : base($"{packageIdentifier}::{packageVersion} was not found in NuGet feeds {string.Join(";", attemptedSources)}")
16+
public PackageNotFoundException(string packageIdentifier, NuGetVersion packageVersion, IEnumerable<string> attemptedSources) : base($"{packageIdentifier}@{packageVersion} was not found in NuGet feeds {string.Join(";", attemptedSources)}")
1717
{
1818
PackageIdentifier = packageIdentifier;
1919
PackageVersion = packageVersion;

src/Microsoft.TemplateEngine.Edge/Installers/NuGet/NuGetManagedTemplatePackage.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ private NuGetManagedTemplatePackage(
8686

8787
public IManagedTemplatePackageProvider ManagedProvider { get; }
8888

89-
public string DisplayName => string.IsNullOrWhiteSpace(Version) ? Identifier : $"{Identifier}::{Version}";
89+
public string DisplayName => string.IsNullOrWhiteSpace(Version) ? Identifier : $"{Identifier}@{Version}";
9090

9191
public string Identifier => Details[PackageIdKey];
9292

src/Microsoft.TemplateEngine.Edge/Installers/NuGet/NugetApiPackageManager.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ await GetLatestVersionInternalAsync(
137137
_nugetLogger.LogWarning(
138138
string.Format(
139139
LocalizableStrings.NuGetApiPackageManager_Warning_FailedToDownload,
140-
$"{packageMetadata.Identity.Id}::{packageMetadata.Identity.Version}",
140+
$"{packageMetadata.Identity.Id}@{packageMetadata.Identity.Version}",
141141
source.Source));
142142
try
143143
{
@@ -159,7 +159,7 @@ await GetLatestVersionInternalAsync(
159159
_nugetLogger.LogWarning(
160160
string.Format(
161161
LocalizableStrings.NuGetApiPackageManager_Warning_FailedToDownload,
162-
$"{packageMetadata.Identity.Id}::{packageMetadata.Identity.Version}",
162+
$"{packageMetadata.Identity.Id}@{packageMetadata.Identity.Version}",
163163
source.Source));
164164
_nugetLogger.LogDebug($"Details: {e}.");
165165
try
@@ -335,13 +335,13 @@ await Task.WhenAll(
335335
NugetPackageMetadata? matchedVersion = foundPackages.FirstOrDefault(package => package.Identity.Version == packageVersion);
336336
if (matchedVersion != null)
337337
{
338-
_nugetLogger.LogDebug($"{packageIdentifier}::{packageVersion} was found in {foundSource.Source}.");
338+
_nugetLogger.LogDebug($"{packageIdentifier}@{packageVersion} was found in {foundSource.Source}.");
339339
linkedCts.Cancel();
340340
return (foundSource, matchedVersion);
341341
}
342342
else
343343
{
344-
_nugetLogger.LogDebug($"{packageIdentifier}::{packageVersion} is not found in NuGet feed {foundSource.Source}.");
344+
_nugetLogger.LogDebug($"{packageIdentifier}@{packageVersion} is not found in NuGet feed {foundSource.Source}.");
345345
}
346346
}
347347
if (!atLeastOneSourceValid)
@@ -351,7 +351,7 @@ await Task.WhenAll(
351351
_nugetLogger.LogWarning(
352352
string.Format(
353353
LocalizableStrings.NuGetApiPackageManager_Warning_PackageNotFound,
354-
$"{packageIdentifier}::{packageVersion}",
354+
$"{packageIdentifier}@{packageVersion}",
355355
string.Join(", ", sources.Select(source => source.Source))));
356356
throw new PackageNotFoundException(packageIdentifier, packageVersion, sources.Select(source => source.Source));
357357
}

src/Microsoft.TemplateEngine.Orchestrator.RunnableProjects/LocalizationModelDeserializer.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,12 @@ private static IReadOnlyDictionary<string, PostActionLocalizationModel> LoadPost
131131

132132
foreach (var postActionParts in strings.GroupBy(p => p.NameParts.FirstOrDefault()))
133133
{
134+
if (string.IsNullOrEmpty(postActionParts.Key))
135+
{
136+
// Post action with no ID. Ignore.
137+
continue;
138+
}
139+
134140
string postActionId = postActionParts.Key;
135141
string? description = postActionParts.SingleOrDefault(p => p.NameParts.Skip(1).FirstOrDefault() == "description").LocalizedString;
136142
var instructions = LoadManualInstructionModels(postActionParts
@@ -162,6 +168,12 @@ private static IReadOnlyDictionary<string, string> LoadManualInstructionModels(I
162168

163169
foreach (var instructionParts in strings.GroupBy(p => p.NameParts.FirstOrDefault()))
164170
{
171+
if (string.IsNullOrEmpty(instructionParts.Key))
172+
{
173+
// Instruction with no ID. Ignore.
174+
continue;
175+
}
176+
165177
string id = instructionParts.Key;
166178
string? text = instructionParts.SingleOrDefault(p => p.NameParts.Skip(1).FirstOrDefault() == "text").LocalizedString;
167179
results[id] = text;

test/Microsoft.TemplateEngine.Edge.UnitTests/NuGetInstallerTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ public async Task Install_LocalPackage()
156156
source.Owners.Should().BeNull();
157157
source.Reserved.Should().Be("False");
158158
source.Version.Should().NotBeNullOrEmpty();
159-
source.DisplayName.Should().StartWith("Microsoft.TemplateEngine.TestTemplates::");
159+
source.DisplayName.Should().StartWith("Microsoft.TemplateEngine.TestTemplates@");
160160
source.Identifier.Should().Be("Microsoft.TemplateEngine.TestTemplates");
161161
source.Installer.Should().Be(installer);
162162
source.IsLocalPackage.Should().Be(true);
@@ -239,7 +239,7 @@ public async Task Install_RemotePackage()
239239
source.Owners.Should().Be("Microsoft");
240240
source.Reserved.Should().Be("True");
241241
source.Version.Should().Be("1.0.0");
242-
source.DisplayName.Should().Be("Microsoft.TemplateEngine.TestTemplates::1.0.0");
242+
source.DisplayName.Should().Be("Microsoft.TemplateEngine.TestTemplates@1.0.0");
243243
source.Identifier.Should().Be("Microsoft.TemplateEngine.TestTemplates");
244244
source.Installer.Should().Be(installer);
245245
source.IsLocalPackage.Should().Be(false);
@@ -447,7 +447,7 @@ public async Task Update_RemotePackage()
447447
updatedSource!.MountPointUri.Should().ContainAll(new[] { installPath, "Microsoft.TemplateEngine.TestTemplates" });
448448
updatedSource.Author.Should().Be("Microsoft");
449449
updatedSource.Version.Should().Be("1.0.1");
450-
updatedSource.DisplayName.Should().Be("Microsoft.TemplateEngine.TestTemplates::1.0.1");
450+
updatedSource.DisplayName.Should().Be("Microsoft.TemplateEngine.TestTemplates@1.0.1");
451451
updatedSource.Identifier.Should().Be("Microsoft.TemplateEngine.TestTemplates");
452452
updatedSource.Installer.Should().Be(installer);
453453
updatedSource.IsLocalPackage.Should().Be(false);
@@ -514,7 +514,7 @@ public void Deserialize(
514514
source.Reserved.Should().Be(reserved);
515515
source.Owners.Should().Be(owners);
516516
source.Version.Should().Be(version);
517-
source.DisplayName.Should().Be($"{identifier}::{version}");
517+
source.DisplayName.Should().Be($"{identifier}@{version}");
518518
source.Identifier.Should().Be(identifier);
519519
source.Installer.Should().Be(installer);
520520
source.IsLocalPackage.Should().Be(local);

test/Microsoft.TemplateEngine.Orchestrator.RunnableProjects.UnitTests/TemplateConfigTests/LocalizationTests.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ public void CanReadDescription(string fileContent, bool errorExpected, string? e
109109
[InlineData(/*lang=json,strict*/ """{ "symbols/someSymbol/displayName": "localizedSymbol" }""", false, "someSymbol", "localizedSymbol", "(null)")]
110110
[InlineData(/*lang=json,strict*/ """{ "symbols/someSymbol/description": "localizedSymbolDescription" }""", false, "someSymbol", "(null)", "localizedSymbolDescription")]
111111
[InlineData(/*lang=json*/ """{ description: ""}""", false, null, null, null)]
112+
// Test case for NullReferenceException fix: malformed symbol key with only "symbols/" prefix
113+
[InlineData(/*lang=json,strict*/ """{ "symbols/": "test" }""", false, null, null, null)]
112114
public void CanReadNonChoiceSymbol(
113115
string fileContent,
114116
bool errorExpected,
@@ -244,6 +246,10 @@ public void CanReadChoiceSymbol(
244246
[InlineData(/*lang=json*/ """{ description: ""}""", false, null, null, null)]
245247
[InlineData(/*lang=json,strict*/ """{ "postActions/pa0/description": "localizedDescription" }""", false, "pa0", "localizedDescription", "(null)")]
246248
[InlineData(/*lang=json,strict*/ """{ "postActions/pa0/manualInstructions/first/text": "localizedDescription" }""", false, "pa0", "(null)", "first*localizedDescription")]
249+
// Test case for NullReferenceException fix: malformed postAction key with only "postActions/" prefix
250+
[InlineData(/*lang=json,strict*/ """{ "postActions/": "test" }""", false, null, null, null)]
251+
// Test case for NullReferenceException fix: malformed manualInstruction key with missing instruction id
252+
[InlineData(/*lang=json,strict*/ """{ "postActions/pa0/manualInstructions//text": "test" }""", false, "pa0", "(null)", "(null)")]
247253
public void CanReadPostAction(
248254
string fileContent,
249255
bool errorExpected,

0 commit comments

Comments
 (0)