Skip to content

Commit 9972f17

Browse files
authored
Merge branch 'main' into darc-main-b6753722-f3ed-453f-b86f-4af7542068dc
2 parents c839119 + e849f20 commit 9972f17

File tree

47 files changed

+1643
-815
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1643
-815
lines changed

.github/copilot-instructions.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
* Make only high confidence suggestions when reviewing code changes.
44
* Always use the latest version C#, currently C# 13 features.
55
* Never change global.json unless explicitly asked to.
6+
* Never change package.json or package-lock.json files unless explicitly asked to.
7+
* Never change NuGet.config files unless explicitly asked to.
68

79
## Formatting
810

@@ -12,7 +14,7 @@
1214
* Ensure that the final return statement of a method is on its own line.
1315
* Use pattern matching and switch expressions wherever possible.
1416
* Use `nameof` instead of string literals when referring to member names.
15-
* Ensure that XML doc comments are created for any public APIs. When applicable, include <example> and <code> documentation in the comments.
17+
* Ensure that XML doc comments are created for any public APIs. When applicable, include `<example>` and `<code>` documentation in the comments.
1618

1719
### Nullable Reference Types
1820

docs/DailyBuilds.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Daily builds include the latest source code changes. They are not supported for
44

55
If you want to download the latest daily build and use it in a project, then you need to:
66

7-
* Obtain the latest [build of the .NET Core SDK](https://github.com/dotnet/sdk/blob/main/documentation/package-table.md).
7+
* Obtain the latest [build of the .NET Core SDK](https://github.com/dotnet/dotnet/blob/main/docs/builds-table.md).
88
* Add a NuGet.Config to your project directory with the following content:
99

1010
## .NET 8

eng/Publishing.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
Encoding="ASCII" />
6363

6464
<ItemGroup>
65-
<Artifact Include="@(ProductVersionFile)" Kind="Blob" UploadPathSegment="Runtime" />
65+
<Artifact Include="@(ProductVersionFile)" Kind="Blob" UploadPathSegment="Runtime/" />
6666
</ItemGroup>
6767
</Target>
6868

eng/Version.Details.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -404,13 +404,13 @@
404404
<Uri>https://github.com/dotnet/dotnet</Uri>
405405
<Sha>445fb3a55b402cbe3a43576105e6fdc6686c8e4c</Sha>
406406
</Dependency>
407-
<Dependency Name="Microsoft.Extensions.Diagnostics.Testing" Version="9.6.0-preview.1.25260.2">
407+
<Dependency Name="Microsoft.Extensions.Diagnostics.Testing" Version="9.6.0-preview.1.25271.2">
408408
<Uri>https://github.com/dotnet/extensions</Uri>
409-
<Sha>90dd3fdbb6056d8ae177ab102b779e3922a88981</Sha>
409+
<Sha>6f29ab505709370fc9b72bf4bb7e004a7662f69f</Sha>
410410
</Dependency>
411-
<Dependency Name="Microsoft.Extensions.TimeProvider.Testing" Version="9.6.0-preview.1.25260.2">
411+
<Dependency Name="Microsoft.Extensions.TimeProvider.Testing" Version="9.6.0-preview.1.25271.2">
412412
<Uri>https://github.com/dotnet/extensions</Uri>
413-
<Sha>90dd3fdbb6056d8ae177ab102b779e3922a88981</Sha>
413+
<Sha>6f29ab505709370fc9b72bf4bb7e004a7662f69f</Sha>
414414
</Dependency>
415415
<Dependency Name="NuGet.Frameworks" Version="6.2.4">
416416
<Uri>https://github.com/nuget/nuget.client</Uri>

eng/Versions.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,8 @@
144144
<SystemNumericsTensorsVersion>10.0.0-preview.6.25272.109</SystemNumericsTensorsVersion>
145145
<SystemRuntimeCachingVersion>10.0.0-preview.6.25272.109</SystemRuntimeCachingVersion>
146146
<!-- Packages from dotnet/extensions -->
147-
<MicrosoftExtensionsDiagnosticsTestingVersion>9.6.0-preview.1.25260.2</MicrosoftExtensionsDiagnosticsTestingVersion>
148-
<MicrosoftExtensionsTimeProviderTestingVersion>9.6.0-preview.1.25260.2</MicrosoftExtensionsTimeProviderTestingVersion>
147+
<MicrosoftExtensionsDiagnosticsTestingVersion>9.6.0-preview.1.25271.2</MicrosoftExtensionsDiagnosticsTestingVersion>
148+
<MicrosoftExtensionsTimeProviderTestingVersion>9.6.0-preview.1.25271.2</MicrosoftExtensionsTimeProviderTestingVersion>
149149
<!-- Packages from dotnet/efcore -->
150150
<dotnetefVersion>10.0.0-preview.6.25272.109</dotnetefVersion>
151151
<MicrosoftEntityFrameworkCoreInMemoryVersion>10.0.0-preview.6.25272.109</MicrosoftEntityFrameworkCoreInMemoryVersion>

eng/build.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ runtime_source_feed_key=''
3838
source_build=''
3939
product_build=''
4040
from_vmr=''
41+
warn_as_error=true
4142

4243
if [ "$(uname)" = "Darwin" ]; then
4344
target_os_name='osx'
@@ -87,6 +88,7 @@ Options:
8788
--binarylog|-bl Use a binary logger
8889
--excludeCIBinarylog Don't output binary log by default in CI builds (short: -nobl).
8990
--verbosity|-v MSBuild verbosity: q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic]
91+
--warnAsError Sets warnaserror msbuild parameter: 'true' or 'false'
9092
9193
--runtime-source-feed Additional feed that can be used when downloading .NET runtimes and SDKs
9294
--runtime-source-feed-key Key for feed that can be used when downloading .NET runtimes and SDKs
@@ -263,6 +265,10 @@ while [[ $# -gt 0 ]]; do
263265
;;
264266
-fromvmr|-from-vmr)
265267
from_vmr=true
268+
-warnaserror)
269+
shift
270+
[ -z "${1:-}" ] && __error "Missing value for parameter --warnaserror" && __usage
271+
warn_as_error="${1:-}"
266272
;;
267273
*)
268274
msbuild_args[${#msbuild_args[*]}]="$1"

src/Components/Endpoints/src/Rendering/EndpointHtmlRenderer.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,8 @@ protected override void AddPendingTask(ComponentState? componentState, Task task
183183
base.AddPendingTask(componentState, task);
184184
}
185185

186-
private void SignalRendererToFinishRendering()
186+
// For testing purposes only
187+
internal void SignalRendererToFinishRendering()
187188
{
188189
// sets a deferred stop on the renderer, which will have an effect after the current batch is completed
189190
_rendererIsStopped = true;

src/Components/Endpoints/test/EndpointHtmlRendererTest.cs

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
using Microsoft.AspNetCore.Components.Infrastructure;
1212
using Microsoft.AspNetCore.Components.Reflection;
1313
using Microsoft.AspNetCore.Components.Rendering;
14+
using Microsoft.AspNetCore.Components.RenderTree;
1415
using Microsoft.AspNetCore.Components.Test.Helpers;
1516
using Microsoft.AspNetCore.Components.Web;
1617
using Microsoft.AspNetCore.DataProtection;
@@ -47,18 +48,23 @@ public EndpointHtmlRendererTest()
4748
}
4849

4950
[Fact]
50-
public async Task DoesNotRenderChildAfterRendererStopped()
51+
public async Task DoesNotRenderAfterRendererStopped()
5152
{
52-
renderer.SignalRendererToFinishRendering();
53-
5453
var httpContext = GetHttpContext();
5554
var writer = new StringWriter();
5655

57-
var result = await renderer.PrerenderComponentAsync(httpContext, typeof(SimpleComponent), null, ParameterView.Empty);
58-
await renderer.Dispatcher.InvokeAsync(() => result.WriteTo(writer, HtmlEncoder.Default));
59-
var content = writer.ToString();
56+
var component = new StoppingRendererComponent();
57+
var id = renderer.AssignRootComponentId(component);
58+
var initialRenderOperation = renderer.Dispatcher.InvokeAsync(
59+
() => renderer.RenderRootComponentAsync(id, ParameterView.Empty));
6060

61-
Assert.DoesNotContain("Hello from SimpleComponent", content);
61+
renderer.SignalRendererToFinishRendering();
62+
component.TaskCompletionSource.SetResult(false);
63+
await initialRenderOperation;
64+
int initialRenderCount = renderer.RenderCount;
65+
66+
await renderer.Dispatcher.InvokeAsync(() => renderer.RenderRootComponentAsync(id, ParameterView.Empty));
67+
Assert.Equal(initialRenderCount, renderer.RenderCount);
6268
}
6369

6470
[Fact]
@@ -1772,18 +1778,10 @@ private TestEndpointHtmlRenderer GetEndpointHtmlRenderer(IServiceProvider servic
17721778
private class TestEndpointHtmlRenderer : EndpointHtmlRenderer
17731779
{
17741780
private bool _rendererIsStopped = false;
1775-
public TestEndpointHtmlRenderer(IServiceProvider serviceProvider, ILoggerFactory loggerFactory) : base(serviceProvider, loggerFactory)
1776-
{
1777-
}
1781+
private int _renderCount;
17781782

1779-
internal int TestAssignRootComponentId(IComponent component)
1783+
public TestEndpointHtmlRenderer(IServiceProvider serviceProvider, ILoggerFactory loggerFactory) : base(serviceProvider, loggerFactory)
17801784
{
1781-
return base.AssignRootComponentId(component);
1782-
}
1783-
public void SignalRendererToFinishRendering()
1784-
{
1785-
// sets a deferred stop on the renderer, which will have an effect after the current batch is completed
1786-
_rendererIsStopped = true;
17871785
}
17881786

17891787
protected override void ProcessPendingRender()
@@ -1793,6 +1791,16 @@ protected override void ProcessPendingRender()
17931791
return;
17941792
}
17951793
base.ProcessPendingRender();
1794+
1795+
_renderCount++;
1796+
}
1797+
1798+
public int RenderCount => _renderCount;
1799+
1800+
public new void SignalRendererToFinishRendering()
1801+
{
1802+
_rendererIsStopped = true;
1803+
base.SignalRendererToFinishRendering();
17961804
}
17971805
}
17981806

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<h1>Hello from StoppingRendererComponent</h1>
2+
<p>State is @_state</p>
3+
4+
@code {
5+
private bool _state = true;
6+
7+
// expose a TCS so the test can control when OnInitializedAsync completes
8+
public TaskCompletionSource<bool> TaskCompletionSource = new TaskCompletionSource<bool>();
9+
10+
protected override async Task OnInitializedAsync()
11+
{
12+
// wait until the test signals
13+
var result = await TaskCompletionSource.Task;
14+
_state = result;
15+
StateHasChanged();
16+
}
17+
}

src/Components/Server/src/Circuits/RemoteNavigationManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ internal sealed partial class RemoteNavigationManager : NavigationManager, IHost
1919
private bool? _navigationLockStateBeforeJsRuntimeAttached;
2020
private const string _enableThrowNavigationException = "Microsoft.AspNetCore.Components.Endpoints.NavigationManager.EnableThrowNavigationException";
2121

22-
[FeatureSwitchDefinition("Microsoft.AspNetCore.Components.Endpoints.NavigationManager.EnableThrowNavigationException")]
22+
[FeatureSwitchDefinition(_enableThrowNavigationException)]
2323
private static bool _throwNavigationException =>
2424
AppContext.TryGetSwitch(_enableThrowNavigationException, out var switchValue) && switchValue;
2525
private Func<string, Task>? _onNavigateTo;

0 commit comments

Comments
 (0)