Skip to content

[pull] main from dotnet:main #1106

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3,232 commits into
base: main
Choose a base branch
from
Open

[pull] main from dotnet:main #1106

wants to merge 3,232 commits into from

Conversation

pull[bot]
Copy link

@pull pull bot commented Jul 7, 2023

See Commits and Changes for more details.


Created by pull[bot]

Can you help keep this open source service alive? 💖 Please sponsor : )

@pull pull bot added the ⤵️ pull label Jul 7, 2023
captainsafia and others added 29 commits March 13, 2025 18:01
* Add onboarding doc for new OSes

* Update docs/OnboardingNewOS.md

Co-authored-by: Rich Lander <[email protected]>

---------

Co-authored-by: Rich Lander <[email protected]>
* Added correct version numbers to ANCM pure forwarders (#60764)
* Revised component/file relationship (#60764)
…state (#60634)

# Adds a declarative model for persistent component and services state

This PR augments the persistent component state feature with a declarative model that allows the developer to place an attribute on components and services properties to indicate that they should be persisted during prerendering so that it is accessible when the application becomes interactive.

## Scenarios

### Serializing state for a component

```razor
@page "/counter"

<h1>Counter</h1>

<p>Current count: @CurrentCount</p>

<button class="btn btn-primary" @OnClick="IncrementCount">Click me</button>

@code {
    [SupplyParameterFromPersistentComponentState]
    private int CurrentCount { get; set; }

    private void IncrementCount()
    {
        CurrentCount++;
    }
}
```
* Properties annotated with `[SupplyParameterFromPersistentComponentState]` will be serialized and deserialized during prerendering.

### Serializing state for multiple components of the same type

**ParentComponent.razor**
```razor
@page "/parent"

@foreach (var element in elements)
{
    <ChildComponent @key="element.Name" />
}
```

**ChildComponent.razor**
```razor
<div>
    <p>Current count: @Element.CurrentCount</p>
    <button class="btn btn-primary" @OnClick="IncrementCount">Click me</button>
</div>

@code {
    [SupplyParameterFromPersistentComponentState]
    public State Element { get; set; }

    private void IncrementCount()
    {
        Element.CurrentCount++;
    }

    protected override void OnInitialized()
    {
        Element ??= new State();
    }

    private class State
    {
        public int CurrentCount { get; set; }
    }
}
```
* Properties annotated with `[SupplyParameterFromPersistentComponentState]` will be serialized and deserialized during prerendering.
* The `@key` directive is used to ensure that the state is correctly associated with the component instance.
* The `Element` property is initialized in the `OnInitialized` method to avoid null reference exceptions similarly to how we do it for
  query parameters and form data.

### Serializing state for a service

**CounterService.cs**
```csharp
public class CounterService
{
    [SupplyParameterFromPersistentComponentState]
    public int CurrentCount { get; set; }

    public void IncrementCount()
    {
        CurrentCount++;
    }
}
```

**Program.cs**
```
builder.Services.AddRazorComponents().RegisterPersistentService<CounterService>(RenderMode.InteractiveAuto);
```
* Properties annotated with `[SupplyParameterFromPersistentComponentState]` will be serialized during prerendering and deserialized when the application becomes interactive.
* The `AddPersistentService` method is used to register the service for persistence.
* The render mode is required as can't be inferred from the service type.
  * `RenderMode.Server` - The service will be available for interactive server mode.
  * `RenderMode.Webassembly` - The service will be available for interactive webassembly mode.
  * `RenderMode.InteractiveAuto` - The service will be available for both interactive server and webassembly modes if a component renders in any of those modes.
* The service will be resolved during interactive mode initialization and the properties annotated with `[SupplyParameterFromPersistentComponentState]` will be deserialized.

## Implementation details

### Key Computation

#### For components
We need to generate a unique key for each property that needs to be persisted. For components, this key is computed based on:

- The parent component type
- The component type
- The property name
- The `@key` directive if present and serializable (e.g., `Guid`, `DateOnly`, `TimeOnly`, and primitive types)

The key computation ensures that even if multiple instances of the same component are present on the page (for example, in a loop),
each instance's state can be uniquely identified and persisted.

The key computation algorithm only takes into account a small subset of a component hierarchy for performance reasons.
This limits the ability to persist state on recursive component hierarchies.
Our recommendation for those scenarios is to persist the state at the top level of the hierarchy.

#### For services
Only persisting scoped services is supported. We need to generate a unique key for each property that needs to be persisted.
The key for services is derived from:
- The type used to register the persistent service
  - Assembly
  - Full type name
  - Property name

Properties to be serialized are identified from the actual service instance.
- This approach allows marking an abstraction as a persistent service.
- Enables actual implementations to be internal or different types.
- Supports shared code in different assemblies.
- Each instance must expose the same properties.

### Serialization and Deserialization

By default properties are serialized using the System.Text.Json serializer with default settings.
Note that this method is not trimmer safe and requires the user to ensure that the types used are preserved through some other means. 
This is consistent with our usage of System.Text.Json across other areas of the product, like root component parameters or JSInterop.
…: Build ID 2662572 (#60872)

* Localized file check-in by OneLocBuild Task: Build definition ID 1159: Build ID 2660536

* Localized file check-in by OneLocBuild Task: Build definition ID 1159: Build ID 2662572
Bumps [src/submodules/googletest](https://github.com/google/googletest) from `7218908` to `4902ea2`.
- [Release notes](https://github.com/google/googletest/releases)
- [Commits](google/googletest@7218908...4902ea2)

---
updated-dependencies:
- dependency-name: src/submodules/googletest
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…0313.6 (#60924)

Microsoft.Bcl.AsyncInterfaces , Microsoft.Bcl.TimeProvider , Microsoft.Extensions.Caching.Abstractions , Microsoft.Extensions.Caching.Memory , Microsoft.Extensions.Configuration , Microsoft.Extensions.Configuration.Abstractions , Microsoft.Extensions.Configuration.Binder , Microsoft.Extensions.Configuration.CommandLine , Microsoft.Extensions.Configuration.EnvironmentVariables , Microsoft.Extensions.Configuration.FileExtensions , Microsoft.Extensions.Configuration.Ini , Microsoft.Extensions.Configuration.Json , Microsoft.Extensions.Configuration.UserSecrets , Microsoft.Extensions.Configuration.Xml , Microsoft.Extensions.DependencyInjection , Microsoft.Extensions.DependencyInjection.Abstractions , Microsoft.Extensions.DependencyModel , Microsoft.Extensions.Diagnostics , Microsoft.Extensions.Diagnostics.Abstractions , Microsoft.Extensions.FileProviders.Abstractions , Microsoft.Extensions.FileProviders.Composite , Microsoft.Extensions.FileProviders.Physical , Microsoft.Extensions.FileSystemGlobbing , Microsoft.Extensions.HostFactoryResolver.Sources , Microsoft.Extensions.Hosting , Microsoft.Extensions.Hosting.Abstractions , Microsoft.Extensions.Http , Microsoft.Extensions.Logging , Microsoft.Extensions.Logging.Abstractions , Microsoft.Extensions.Logging.Configuration , Microsoft.Extensions.Logging.Console , Microsoft.Extensions.Logging.Debug , Microsoft.Extensions.Logging.EventLog , Microsoft.Extensions.Logging.EventSource , Microsoft.Extensions.Logging.TraceSource , Microsoft.Extensions.Options , Microsoft.Extensions.Options.ConfigurationExtensions , Microsoft.Extensions.Options.DataAnnotations , Microsoft.Extensions.Primitives , Microsoft.Internal.Runtime.AspNetCore.Transport , Microsoft.NET.Runtime.MonoAOTCompiler.Task , Microsoft.NET.Runtime.WebAssembly.Sdk , Microsoft.NETCore.App.Ref , Microsoft.NETCore.App.Runtime.AOT.win-x64.Cross.browser-wasm , Microsoft.NETCore.App.Runtime.win-x64 , Microsoft.NETCore.BrowserDebugHost.Transport , Microsoft.NETCore.Platforms , System.Collections.Immutable , System.Composition , System.Configuration.ConfigurationManager , System.Diagnostics.DiagnosticSource , System.Diagnostics.EventLog , System.Diagnostics.PerformanceCounter , System.DirectoryServices.Protocols , System.Formats.Asn1 , System.IO.Hashing , System.IO.Pipelines , System.Net.Http.Json , System.Net.Http.WinHttpHandler , System.Net.ServerSentEvents , System.Reflection.Metadata , System.Resources.Extensions , System.Runtime.Caching , System.Security.Cryptography.Pkcs , System.Security.Cryptography.Xml , System.Security.Permissions , System.ServiceProcess.ServiceController , System.Text.Encodings.Web , System.Text.Json , System.Threading.AccessControl , System.Threading.Channels , System.Threading.RateLimiting , Microsoft.SourceBuild.Intermediate.runtime.linux-x64
 From Version 10.0.0-preview.3.25162.19 -> To Version 10.0.0-preview.3.25163.6

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
…0250314.5 (#60963)

[main] Update dependencies from dotnet/extensions
* Remove quarantine and make the assert wait a bit.
Update .NET SDK to version 10.0.100-preview.3.25167.4.

---
updated-dependencies:
- dependency-name: Microsoft.NET.Sdk
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
…ence-packages build 20250313.4 (#60925)

Microsoft.SourceBuild.Intermediate.source-build-reference-packages
 From Version 10.0.616001 -> To Version 10.0.616304

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
…nals build 20250310.1 (#60962)

[main] Update dependencies from dotnet/source-build-externals
[main] Update dependencies from dotnet/runtime
* Update area-owners.md

* Adding owners

* Add GitHub links for Doc Owners in area-owners.md

* Fix broken links in area-owners.md
…revent a breaking change (#60937)

* Add default implementation to Description to prevent a breaking change when consumers cast this type and get exceptions about description being null

* Apply suggestions from code review

Co-authored-by: Safia Abdalla <[email protected]>

* Set default implementation on Description in IApiResponseMetadataProvider to prevent casting errors

---------

Co-authored-by: Safia Abdalla <[email protected]>
* Only run issue-locker action on weekdays

* Update cron schedule for locking stale issues

* Update cron schedule for locker workflow
…0317.9 (#60982)

[main] Update dependencies from dotnet/runtime
…314.6 (#60961)

[main] Update dependencies from dotnet/arcade
…ic rendering (#60752)

* Interactive NotFound event + SSR status code.

* Remove circular DI, pass renderer on initialization instead.

* Interactive NotFound tests.

* Server test.

* @javiercn's fixes

* Fix failing test that was missing initialization.
…ng.props (#60967)

* Use Kind Artifact metadata and minor improvements to Signing/Publishing.props

* PR feedback
am11 and others added 30 commits May 9, 2025 13:56
* Enable PublishReadyToRun on LA64 and RV64

* .

* Update src/Framework/App.Runtime/src/Microsoft.AspNetCore.App.Runtime.Composite.sfxproj

---------

Co-authored-by: Alexander Köplinger <[email protected]>
…CoreAppPackageVersion (#61860)

* Use Microsoft.NETCore.App.Ref version in place of legacy MicrosoftNETCoreAppPackageVersion

https://github.com/dotnet/dotnet/blob/main/repo-projects/Directory.Build.props#L247-L251

The reason for this block is that repos tend to use arch specific version properties as proxy version numbers. So aspnetcore will set the runtime pack version based on the MicrosoftNETCoreAppVersion, which it typically sets based on the x64 runtime pack version. But since that's not produced in an x86 build, we jump some through VMR hoops to get this right.
The stabilized build exposes a few of these cases where we incorrectly use a few properties, which is quite fixable, but overall this block caught my attention and I think we should remove it.
aspnetcore seems to be the biggest user of MicrosoftNETCoreAppVersion, set to the x64 runtime pack version. I was thinking to just changing all the uses to the ref pack version, since the runtime pack and ref pack versions are always aligned. We can then get rid of this block altogether, which would be great

* Remove unneeded content property
Bumps [dotnet/arcade](https://github.com/dotnet/arcade) from 43abe63bfc701d34e6599490a557a74710693410 to d7540e540636883d3d080d087223d28b6b7395ae.
- [Commits](dotnet/arcade@43abe63...d7540e5)

---
updated-dependencies:
- dependency-name: dotnet/arcade
  dependency-version: d7540e540636883d3d080d087223d28b6b7395ae
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Block test failing after switching to latest-chrome version.
* [VMR] Codeflow 754e56e-754e56e

[[ commit created by automation ]]

* Update dependencies from https://github.com/dotnet/dotnet build 267468

* [VMR] Codeflow 1a7ca4a-1a7ca4a

[[ commit created by automation ]]

* Update dependencies from https://github.com/dotnet/dotnet build 267725

* Update dependencies from https://github.com/dotnet/dotnet build 267776

---------

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
* Mark validations info related types are experimental

* Remove comment from emitted code
* Fix handling for Name property on DisplayAttribute

* Add test for negative case
…0250510.2 (#61876)

[main] Update dependencies from dotnet/extensions
…covery code (#61926)

# Add empty string check for recovery code

If an empty string gets passed as the recovery code to `UserStoreBase.RedeemCodeAsync(TUser user, string code, CancellationToken ct)`, the method returns `true`, incorrectly indicating a valid recovery code. This PR resolves the issue by validating that the `code` argument is not an empty string.

## Description

The `RedeemCodeAsync()` method already validates that `code` is non-null. This PR:
* Extends the logic in this method to handle the empty string (`""`) case
* Adds tests validating that an exception gets thrown when `code` is `null` or `""`

----
#### AI description  (iteration 1)
#### PR Classification
Bug fix

#### PR Summary
This pull request adds a check for empty strings in recovery codes to prevent null or empty values from being processed.
- `src/Shared/ThrowHelpers/ArgumentNullThrowHelper.cs`: Added `ThrowIfNullOrEmpty` method to validate strings as non-null and non-empty.
- `src/Identity/EntityFrameworkCore/test/EF.Test/UserStoreTest.cs`: Added tests to ensure `RedeemCodeAsync` throws exceptions for null or empty codes.
- `src/Identity/Extensions.Stores/src/UserStoreBase.cs`: Updated `ThrowIfNull` to `ThrowIfNullOrEmpty` for code validation in `RedeemCodeAsync`.
<!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->

----
#### AI description  (iteration 1)
#### PR Classification
Bug fix

#### PR Summary
This pull request adds a check for empty strings in recovery code validation to prevent errors.
- `src/Shared/ThrowHelpers/ArgumentNullThrowHelper.cs`: Added `ThrowIfNullOrEmpty` method to validate non-null and non-empty strings.
- `src/Identity/EntityFrameworkCore/test/EF.Test/UserStoreTest.cs`: Added tests for null and empty recovery code validation.
- `src/Identity/Extensions.Stores/src/UserStoreBase.cs`: Updated recovery code validation to use `ThrowIfNullOrEmpty`.

Co-authored-by: Mackinnon Buck <[email protected]>
* Fix trim annotations on generated validation code

* Update snapshot outputs

---------

Co-authored-by: Sven Boemer <[email protected]>
* Tolerate null ValidationContext in validation resolver APIs

* Make ValidationContext a required property
* Exempt parameters resolved from DI from validation

* Update src/Http/Http.Extensions/gen/Microsoft.AspNetCore.Http.ValidationsGenerator/Parsers/ValidationsGenerator.TypesParser.cs

Co-authored-by: Copilot <[email protected]>

* Add back brace

* Fix up handling for keyed services

---------

Co-authored-by: Copilot <[email protected]>
* Support mapping <returns> to response description

* Add more tests
* Fixed devtools url used for debug with newer versions of chrome and edge

Fixes #61559
Bumps [dotnet/arcade](https://github.com/dotnet/arcade) from d7540e540636883d3d080d087223d28b6b7395ae to 9bbce22e13f399ad3cb8b4b7e53960b621f92ea1.
- [Commits](dotnet/arcade@d7540e5...9bbce22)

---
updated-dependencies:
- dependency-name: dotnet/arcade
  dependency-version: 9bbce22e13f399ad3cb8b4b7e53960b621f92ea1
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…persistent component state (#61748)

* Refactoring + registrations.

* Allow multiple instances of `IPersistentServiceRegistration`.

* Skip assembly name in for all internal types.
[main] Source code updates from dotnet/dotnet
Bumps [src/submodules/googletest](https://github.com/google/googletest) from `90a4152` to `5719306`.
- [Release notes](https://github.com/google/googletest/releases)
- [Commits](google/googletest@90a4152...5719306)

---
updated-dependencies:
- dependency-name: src/submodules/googletest
  dependency-version: 571930618fa96eabcd05b573285edbee9fc13bae
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.