Skip to content

Commit 1b27c99

Browse files
authored
Update dependencies and react to changes (#7844)
* Add workaround for dotnet/sdk#2976 * Add new restore sources * Update BAR manifest to point to https://dotnetfeed.blob.core.windows.net/aspnet-aspnetcore/index.json * Obsolete WithCulture * Add retries to dockerbuild.sh * Ensure each test run gets a unique in-memory database
1 parent e650049 commit 1b27c99

16 files changed

+335
-289
lines changed

.azure/pipelines/ci.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ trigger:
99
include:
1010
- master
1111
- release/*
12-
- internal/release/*
13-
- ci/*
1412

1513
# Run PR validation on all branches
1614
pr:

build/Maestro/Maestro.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
Artifacts="@(PackageToPublish)"
3030
OutputPath="$(ManifestsPath)aspnetcore-$(TargetRuntimeIdentifier)-$(PackageVersion).xml"
3131
BuildId="$(PackageVersion)"
32-
BuildData="Location=https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json"
32+
BuildData="Location=https://dotnetfeed.blob.core.windows.net/aspnet-aspnetcore/index.json"
3333
RepoUri="$(RepositoryUrl)"
3434
RepoBranch="$(BUILD_SOURCEBRANCH)"
3535
RepoCommit="$(BUILD_SOURCEVERSION)" />

build/sources.props

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010

1111
<RestoreSources Condition=" '$(DotNetBuildOffline)' != 'true' ">
1212
$(RestoreSources);
13+
https://dotnetfeed.blob.core.windows.net/aspnet-extensions/index.json;
14+
https://dotnetfeed.blob.core.windows.net/aspnet-entityframeworkcore/index.json;
15+
https://dotnetfeed.blob.core.windows.net/aspnet-aspnetcore-tooling/index.json;
1316
https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json;
1417
https://api.nuget.org/v3/index.json;
1518
https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json;

dockerbuild.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,22 @@ fi
104104
dockerfile="$DIR/build/docker/$image.Dockerfile"
105105
tagname="aspnetcore-build-$image"
106106

107+
# Use docker pull with retries to pre-pull the image need by the dockerfile
108+
# docker build regularly fails with TLS handshake issues for unclear reasons.
109+
base_imagename="$(grep -E -o 'FROM (.*)' $dockerfile | cut -c 6-)"
110+
pull_retries=3
111+
while [ $pull_retries -gt 0 ]; do
112+
failed=false
113+
docker pull $base_imagename || failed=true
114+
if [ "$failed" = true ]; then
115+
let pull_retries=pull_retries-1
116+
echo -e "${YELLOW}Failed to pull $base_imagename Retries left: $pull_retries.${RESET}"
117+
sleep 1
118+
else
119+
pull_retries=0
120+
fi
121+
done
122+
107123
docker build "$(dirname "$dockerfile")" \
108124
--build-arg "USER=$(whoami)" \
109125
--build-arg "USER_ID=$(id -u)" \

eng/Version.Details.xml

Lines changed: 187 additions & 187 deletions
Large diffs are not rendered by default.

eng/Versions.props

Lines changed: 94 additions & 94 deletions
Large diffs are not rendered by default.

eng/Workarounds.targets

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@
1515
<BundledNETCorePlatformsPackageVersion>$(MicrosoftNETCorePlatformsPackageVersion)</BundledNETCorePlatformsPackageVersion>
1616
</PropertyGroup>
1717

18+
<!-- Workaround https://github.com/dotnet/sdk/issues/2976 -->
19+
<ItemGroup>
20+
<PackageReference Update="Microsoft.NETCore.Platforms" PrivateAssets="All" />
21+
</ItemGroup>
22+
1823
<!-- Workaround https://github.com/aspnet/AspNetCore/issues/7503. This chains GenerateSourceLinkFile before razor component targets run. -->
1924
<Target Name="_EnsureSourceLinkHappensBeforeRazorComponentGeneration"
2025
BeforeTargets="PrepareForRazorComponentGenerate"

src/Middleware/HealthChecks.EntityFrameworkCore/test/DbContextHealthCheckTest.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,15 @@ public async Task CheckAsync_CustomTest_Unhealthy()
104104
}
105105
}
106106

107+
// used to ensure each test uses a unique in-memory database
108+
private static int _testDbCounter;
109+
107110
private static IServiceProvider CreateServices(
108111
Func<TestDbContext, CancellationToken, Task<bool>> testQuery = null,
109112
HealthStatus failureStatus = HealthStatus.Unhealthy)
110113
{
111114
var serviceCollection = new ServiceCollection();
112-
serviceCollection.AddDbContext<TestDbContext>(o => o.UseInMemoryDatabase("Test"));
115+
serviceCollection.AddDbContext<TestDbContext>(o => o.UseInMemoryDatabase("Test" + Interlocked.Increment(ref _testDbCounter)));
113116

114117
var builder = serviceCollection.AddHealthChecks();
115118
builder.AddDbContextCheck<TestDbContext>("test", failureStatus, new[] { "tag1", "tag2", }, testQuery);

src/Mvc/Mvc.Localization/src/HtmlLocalizer.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,17 @@ public virtual IEnumerable<LocalizedString> GetAllStrings(bool includeParentCult
8585
_localizer.GetAllStrings(includeParentCultures);
8686

8787
/// <inheritdoc />
88+
[Obsolete("This method is obsolete. Use `CurrentCulture` and `CurrentUICulture` instead.")]
8889
public virtual IHtmlLocalizer WithCulture(CultureInfo culture)
8990
{
9091
if (culture == null)
9192
{
9293
throw new ArgumentNullException(nameof(culture));
9394
}
9495

96+
#pragma warning disable CS0618 // Type or member is obsolete
9597
return new HtmlLocalizer(_localizer.WithCulture(culture));
98+
#pragma warning restore CS0618 // Type or member is obsolete
9699
}
97100

98101
/// <summary>
@@ -105,4 +108,4 @@ protected virtual LocalizedHtmlString ToHtmlString(LocalizedString result) =>
105108
protected virtual LocalizedHtmlString ToHtmlString(LocalizedString result, object[] arguments) =>
106109
new LocalizedHtmlString(result.Name, result.Value, result.ResourceNotFound, arguments);
107110
}
108-
}
111+
}

src/Mvc/Mvc.Localization/src/HtmlLocalizerOfT.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,17 @@ public virtual IEnumerable<LocalizedString> GetAllStrings(bool includeParentCult
8181
_localizer.GetAllStrings(includeParentCultures);
8282

8383
/// <inheritdoc />
84+
[Obsolete("This method is obsolete. Use `CurrentCulture` and `CurrentUICulture` instead.")]
8485
public virtual IHtmlLocalizer WithCulture(CultureInfo culture)
8586
{
8687
if (culture == null)
8788
{
8889
throw new ArgumentNullException(nameof(culture));
8990
}
9091

92+
#pragma warning disable CS0618 // Type or member is obsolete
9193
return _localizer.WithCulture(culture);
94+
#pragma warning restore CS0618 // Type or member is obsolete
9295
}
9396
}
94-
}
97+
}

src/Mvc/Mvc.Localization/src/IHtmlLocalizer.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright (c) .NET Foundation. All rights reserved.
22
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
33

4+
using System;
45
using System.Collections.Generic;
56
using System.Globalization;
67
using Microsoft.Extensions.Localization;
@@ -58,6 +59,7 @@ public interface IHtmlLocalizer
5859
/// </summary>
5960
/// <param name="culture">The <see cref="CultureInfo"/> to use.</param>
6061
/// <returns>A culture-specific <see cref="IHtmlLocalizer"/>.</returns>
62+
[Obsolete("This method is obsolete. Use `CurrentCulture` and `CurrentUICulture` instead.")]
6163
IHtmlLocalizer WithCulture(CultureInfo culture);
6264
}
63-
}
65+
}

src/Mvc/Mvc.Localization/src/ViewLocalizer.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,11 @@ public virtual LocalizedHtmlString this[string key]
8080
public LocalizedString GetString(string name, params object[] values) => _localizer.GetString(name, values);
8181

8282
/// <inheritdoc />
83+
[Obsolete("This method is obsolete. Use `CurrentCulture` and `CurrentUICulture` instead.")]
84+
85+
#pragma warning disable CS0618 // Type or member is obsolete
8386
public IHtmlLocalizer WithCulture(CultureInfo culture) => _localizer.WithCulture(culture);
87+
#pragma warning restore CS0618 // Type or member is obsolete
8488

8589
/// <inheritdoc />
8690
public IEnumerable<LocalizedString> GetAllStrings(bool includeParentCultures) =>
@@ -127,4 +131,4 @@ private string BuildBaseName(string path)
127131
return builder.ToString();
128132
}
129133
}
130-
}
134+
}

src/Mvc/Mvc.Localization/test/HtmlLocalizerTest.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,9 @@ public void HtmlLocalizer_WithCulture_ReturnsLocalizedHtmlString()
212212
var htmlLocalizer = new HtmlLocalizer(stringLocalizer);
213213

214214
// Act
215+
#pragma warning disable CS0618 // Type or member is obsolete
215216
var actualLocalizedHtmlString = htmlLocalizer.WithCulture(new CultureInfo("fr"))["John"];
217+
#pragma warning restore CS0618 // Type or member is obsolete
216218

217219
// Assert
218220
Assert.Equal("Bonjour John", actualLocalizedHtmlString.Value);

src/Mvc/Mvc.Localization/test/MvcLocalizationServiceCollectionExtensionsTest.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ public IEnumerable<LocalizedString> GetAllStrings(bool includeParentCultures)
9999
throw new NotImplementedException();
100100
}
101101

102+
[Obsolete("This method is obsolete. Use `CurrentCulture` and `CurrentUICulture` instead.")]
102103
public IHtmlLocalizer WithCulture(CultureInfo culture)
103104
{
104105
throw new NotImplementedException();
@@ -127,6 +128,7 @@ public IEnumerable<LocalizedString> GetAllStrings(bool includeParentCultures)
127128
throw new NotImplementedException();
128129
}
129130

131+
[Obsolete("This method is obsolete. Use `CurrentCulture` and `CurrentUICulture` instead.")]
130132
public IHtmlLocalizer WithCulture(CultureInfo culture)
131133
{
132134
throw new NotImplementedException();

src/Mvc/Mvc.Localization/test/TestStringLocalizer.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright (c) .NET Foundation. All rights reserved.
22
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
33

4+
using System;
45
using System.Collections.Generic;
56
using System.Globalization;
67
using Microsoft.Extensions.Localization;
@@ -67,6 +68,7 @@ public IEnumerable<LocalizedString> GetAllStrings(bool includeParentCultures)
6768
return allStrings;
6869
}
6970

71+
[Obsolete("This method is obsolete. Use `CurrentCulture` and `CurrentUICulture` instead.")]
7072
public IStringLocalizer WithCulture(CultureInfo culture)
7173
{
7274
return new TestStringLocalizer(culture);

src/Mvc/Mvc.Localization/test/ViewLocalizerTest.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,9 @@ public void ViewLocalizer_WithCulture_ReturnsLocalizedHtmlString()
280280
viewLocalizer.Contextualize(viewContext);
281281

282282
// Act
283+
#pragma warning disable CS0618 // Type or member is obsolete
283284
var actualLocalizedString = viewLocalizer.WithCulture(new CultureInfo("fr"))["John"];
285+
#pragma warning restore CS0618 // Type or member is obsolete
284286

285287
// Assert
286288
Assert.Equal("Bonjour John", actualLocalizedString.Value);
@@ -325,6 +327,7 @@ public IEnumerable<LocalizedString> GetAllStrings(bool includeParentCultures)
325327
return _stringLocalizer.GetAllStrings(includeParentCultures);
326328
}
327329

330+
[Obsolete("This method is obsolete. Use `CurrentCulture` and `CurrentUICulture` instead.")]
328331
public IHtmlLocalizer WithCulture(CultureInfo culture)
329332
{
330333
return new TestHtmlLocalizer(new TestStringLocalizer(culture));

0 commit comments

Comments
 (0)