Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
]
},
"dotnet-ef": {
"version": "11.0.0-rc.2.26458.109",
"version": "11.0.0-rc.2.26461.110",
"commands": [
"dotnet-ef"
]
Expand All @@ -27,7 +27,7 @@
]
},
"microsoft.dotnet.helix.jobmonitor": {
"version": "11.0.0-beta.26458.109",
"version": "11.0.0-beta.26461.110",
"commands": [
"dotnet-helix-job-monitor"
]
Expand Down
188 changes: 94 additions & 94 deletions eng/Version.Details.props

Large diffs are not rendered by default.

378 changes: 189 additions & 189 deletions eng/Version.Details.xml

Large diffs are not rendered by default.

48 changes: 17 additions & 31 deletions eng/common/core-templates/job/onelocbuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,10 @@ parameters:
# Optional: A defined YAML pool - https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=vsts&tabs=schema#pool
pool: ''

CeapexPat: $(dn-bot-ceapex-package-r) # PAT for the loc AzDO instance https://dev.azure.com/ceapex
GithubPat: $(BotAccount-dotnet-bot-repo-PAT)

# Service connection for WIF-based Entra authentication to ceapex feeds (replaces CeapexPat).
# When set, dnceng/internal builds acquire a federated Entra token instead of using a PAT.
# All other projects (e.g. DevDiv, public), where this dnceng-scoped service connection does not
# exist, and any pipeline that sets this to '' fall back to PAT-based auth via the CeapexPat parameter.
# Project-scoped WIF service connection for Ceapex feed authentication.
CeapexServiceConnection: 'dnceng-onelocbuild-ceapex'

# GitHub App authentication for the OneLoc check-in PR.
# dnceng/internal and DevDiv/DevDiv are enabled by default with their project-scoped service
# connections. Other projects must explicitly opt in after provisioning equivalent infrastructure.
UseGitHubAppAuthentication: true
UseGitHubAppAuthenticationInOtherProjects: false
GitHubAppServiceConnection: 'dnceng-oneloc-githubapp'
GitHubAppClientId: 'Iv23lijBU8x3gc9lDOc9'
GitHubAppKeyVaultName: 'EngKeyVault'
Expand Down Expand Up @@ -50,7 +40,6 @@ jobs:
displayName: OneLocBuild${{ parameters.JobNameSuffix }}

variables:
- group: OneLocBuildVariables # Contains the CeapexPat and GithubPat
- name: _GenerateLocProjectArguments
value: -SourcesDirectory ${{ parameters.SourcesDirectory }}
-LanguageSet "${{ parameters.LanguageSet }}"
Expand Down Expand Up @@ -81,6 +70,12 @@ jobs:
steps:
- ${{ if eq(parameters.is1ESPipeline, '') }}:
- 'Illegal entry point, is1ESPipeline is not defined. Repository yaml should not directly reference templates in core-templates folder.': error
- ${{ if notin(variables['System.TeamProject'], 'internal', 'DevDiv') }}:
- 'OneLocBuild is supported only in dnceng/internal and DevDiv/DevDiv.': error
- ${{ if eq(parameters.CeapexServiceConnection, '') }}:
- 'CeapexServiceConnection must identify a WIF service connection.': error
- ${{ if and(eq(parameters.RepoType, 'gitHub'), eq(parameters.GitHubAppServiceConnection, '')) }}:
- 'GitHubAppServiceConnection must identify a WIF service connection for GitHub repositories.': error

- ${{ if ne(parameters.SkipLocProjectJsonGeneration, 'true') }}:
- task: Powershell@2
Expand All @@ -90,18 +85,15 @@ jobs:
displayName: Generate LocProject.json
condition: ${{ parameters.condition }}

# Acquire an Entra token for ceapex feed access via WIF (dnceng/internal only).
# All other projects use PAT-based auth, since the ceapex service connection is scoped to dnceng/internal.
- ${{ if and(ne(parameters.CeapexServiceConnection, ''), eq(variables['System.TeamProject'], 'internal')) }}:
- template: /eng/common/templates/steps/get-federated-access-token.yml
parameters:
federatedServiceConnection: ${{ parameters.CeapexServiceConnection }}
outputVariableName: 'CeapexEntraToken'
condition: ${{ parameters.condition }}
# Acquire a short-lived Entra token for Ceapex feed access.
- template: /eng/common/templates/steps/get-federated-access-token.yml
parameters:
federatedServiceConnection: ${{ parameters.CeapexServiceConnection }}
outputVariableName: 'CeapexEntraToken'
condition: ${{ parameters.condition }}

# Mint a short-lived GitHub App installation token for the loc check-in PR. Use the connection
# provisioned in each supported project; other projects must explicitly opt in and override it.
- ${{ if and(eq(parameters.RepoType, 'gitHub'), eq(parameters.UseGitHubAppAuthentication, true), or(eq(variables['System.TeamProject'], 'internal'), eq(variables['System.TeamProject'], 'DevDiv'), eq(parameters.UseGitHubAppAuthenticationInOtherProjects, true))) }}:
# Mint a short-lived GitHub App installation token for the loc check-in PR.
- ${{ if eq(parameters.RepoType, 'gitHub') }}:
- template: /eng/common/core-templates/steps/get-github-app-token.yml
parameters:
is1ESPipeline: ${{ parameters.is1ESPipeline }}
Expand Down Expand Up @@ -131,16 +123,10 @@ jobs:
isUseLfLineEndingsSelected: ${{ parameters.UseLfLineEndings }}
isShouldReusePrSelected: ${{ parameters.ReusePr }}
packageSourceAuth: patAuth
${{ if and(ne(parameters.CeapexServiceConnection, ''), eq(variables['System.TeamProject'], 'internal')) }}:
patVariable: $(CeapexEntraToken)
${{ if or(eq(parameters.CeapexServiceConnection, ''), ne(variables['System.TeamProject'], 'internal')) }}:
patVariable: ${{ parameters.CeapexPat }}
patVariable: $(CeapexEntraToken)
${{ if eq(parameters.RepoType, 'gitHub') }}:
repoType: ${{ parameters.RepoType }}
${{ if and(eq(parameters.UseGitHubAppAuthentication, true), or(eq(variables['System.TeamProject'], 'internal'), eq(variables['System.TeamProject'], 'DevDiv'), eq(parameters.UseGitHubAppAuthenticationInOtherProjects, true))) }}:
gitHubPatVariable: "$(GitHubAppInstallationToken)"
${{ else }}:
gitHubPatVariable: "${{ parameters.GithubPat }}"
gitHubPatVariable: "$(GitHubAppInstallationToken)"
${{ if ne(parameters.MirrorRepo, '') }}:
isMirrorRepoSelected: true
gitHubOrganization: ${{ parameters.GitHubOrg }}
Expand Down
10 changes: 5 additions & 5 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"sdk": {
"version": "11.0.100-rc.1.26420.103",
"version": "11.0.100-rc.1.26425.128",
"paths": [
".dotnet",
"$host$"
],
"errorMessage": "The .NET SDK could not be found, run ./restore.cmd or ./restore.sh first."
},
"tools": {
"dotnet": "11.0.100-rc.1.26420.103",
"dotnet": "11.0.100-rc.1.26425.128",
"runtimes": {
"dotnet/x86": [
"$(MicrosoftInternalRuntimeAspNetCoreTransportVersion)"
Expand All @@ -22,9 +22,9 @@
"jdk": "latest"
},
"msbuild-sdks": {
"Microsoft.DotNet.Arcade.Sdk": "11.0.0-beta.26458.109",
"Microsoft.DotNet.Helix.Sdk": "11.0.0-beta.26458.109",
"Microsoft.DotNet.SharedFramework.Sdk": "11.0.0-beta.26458.109",
"Microsoft.DotNet.Arcade.Sdk": "11.0.0-beta.26461.110",
"Microsoft.DotNet.Helix.Sdk": "11.0.0-beta.26461.110",
"Microsoft.DotNet.SharedFramework.Sdk": "11.0.0-beta.26461.110",
"Microsoft.Build.NoTargets": "3.7.134",
"Microsoft.Build.Traversal": "3.4.0",
"Microsoft.WixToolset.Sdk": "6.0.3-dotnet.6"
Expand Down
10 changes: 2 additions & 8 deletions src/Components/Components/src/Routing/Router.cs
Original file line number Diff line number Diff line change
Expand Up @@ -417,10 +417,7 @@ internal void RenderComponentByRoute(RenderTreeBuilder builder, string route)
$"Ensure the route matches a component with a [Route] attribute.");
}

builder.OpenComponent<RouteView>(0);
builder.AddAttribute(1, nameof(RouteView.RouteData),
new RouteData(componentType, new Dictionary<string, object>()));
builder.CloseComponent();
Found(new RouteData(componentType, new Dictionary<string, object>()))(builder);
}

[return: DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)]
Expand All @@ -446,10 +443,7 @@ private void RenderNotFound()
{
if (NotFoundPage != null)
{
builder.OpenComponent<RouteView>(0);
builder.AddAttribute(1, nameof(RouteView.RouteData),
new RouteData(NotFoundPage, _emptyParametersDictionary));
builder.CloseComponent();
Found(new RouteData(NotFoundPage, _emptyParametersDictionary))(builder);
}
#pragma warning disable CS0618 // Type or member is obsolete
else if (NotFound != null)
Expand Down
48 changes: 19 additions & 29 deletions src/Components/Components/test/Routing/RouterTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -339,14 +339,7 @@ await testRenderer.Dispatcher.InvokeAsync(() =>
// Assert
var lastBatch = testRenderer.Batches.Last();
var renderedFrame = lastBatch.ReferenceFrames.First();
Assert.Equal(RenderTreeFrameType.Component, renderedFrame.FrameType);
Assert.Equal(typeof(RouteView), renderedFrame.ComponentType);

// Verify that the RouteData contains the NotFoundTestComponent
var routeViewFrame = lastBatch.ReferenceFrames.Skip(1).First();
Assert.Equal(RenderTreeFrameType.Attribute, routeViewFrame.FrameType);
var routeData = (RouteData)routeViewFrame.AttributeValue;
Assert.Equal(typeof(NotFoundTestComponent), routeData.PageType);
Assert.Equal($"Rendering route matching {typeof(NotFoundTestComponent)}", renderedFrame.TextContent);
}

[Fact]
Expand Down Expand Up @@ -389,16 +382,12 @@ await testRenderer.Dispatcher.InvokeAsync(() =>
await testRenderer.Dispatcher.InvokeAsync(() => testNavManager.TriggerNotFound());

// Assert
var lastBatch = testRenderer.Batches.Last();
var renderedFrame = lastBatch.ReferenceFrames.First();
Assert.Equal(RenderTreeFrameType.Component, renderedFrame.FrameType);
Assert.Equal(typeof(RouteView), renderedFrame.ComponentType);

// Verify that the RouteData contains the correct component type
var routeViewFrame = lastBatch.ReferenceFrames.Skip(1).First();
Assert.Equal(RenderTreeFrameType.Attribute, routeViewFrame.FrameType);
var routeData = (RouteData)routeViewFrame.AttributeValue;
Assert.Equal(typeof(JanComponent), routeData.PageType);
var textFrame = testRenderer.Batches
.SelectMany(b => b.ReferenceFrames)
.FirstOrDefault(f => f.FrameType == RenderTreeFrameType.Text
&& f.TextContent == $"Rendering route matching {typeof(JanComponent)}");
Assert.True(textFrame.FrameType == RenderTreeFrameType.Text,
"Expected the Found fragment's rendered text for JanComponent to appear in a batch.");
}

[Fact]
Expand Down Expand Up @@ -440,17 +429,18 @@ await testRenderer.Dispatcher.InvokeAsync(() =>
// trigger the NavigationManager's OnNotFound event
await testRenderer.Dispatcher.InvokeAsync(() => testNavManager.TriggerNotFound());

// The Router should have rendered using RenderComponentByRoute (args.Path) instead of NotFoundPage
var lastBatch = testRenderer.Batches.Last();
var renderedFrame = lastBatch.ReferenceFrames.First();
Assert.Equal(RenderTreeFrameType.Component, renderedFrame.FrameType);
Assert.Equal(typeof(RouteView), renderedFrame.ComponentType);

// Verify that the RouteData contains the JanComponent (from args.Path), not NotFoundTestComponent
var routeViewFrame = lastBatch.ReferenceFrames.Skip(1).First();
Assert.Equal(RenderTreeFrameType.Attribute, routeViewFrame.FrameType);
var routeData = (RouteData)routeViewFrame.AttributeValue;
Assert.Equal(typeof(JanComponent), routeData.PageType);
// The Router should have rendered using RenderComponentByRoute (args.Path) instead of NotFoundPage,
// routed through the user-supplied <Found> fragment.
var textFrame = testRenderer.Batches
.SelectMany(b => b.ReferenceFrames)
.FirstOrDefault(f => f.FrameType == RenderTreeFrameType.Text
&& f.TextContent == $"Rendering route matching {typeof(JanComponent)}");
Assert.True(textFrame.FrameType == RenderTreeFrameType.Text,
"Expected the args.Path component (JanComponent) to be rendered through Found, not NotFoundTestComponent.");
Assert.DoesNotContain(testRenderer.Batches
.SelectMany(b => b.ReferenceFrames),
f => f.FrameType == RenderTreeFrameType.Text
&& f.TextContent == $"Rendering route matching {typeof(NotFoundTestComponent)}");
}

[Fact]
Expand Down
21 changes: 19 additions & 2 deletions src/Components/Web/src/JSComponents/JSComponentInterop.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ static JSComponentInterop()
}

private const int MaxParameters = 100;
private readonly HashSet<int> _jsComponentIds = [];
private WebRenderer? _renderer;

internal JSComponentConfigurationStore Configuration { get; }
Expand Down Expand Up @@ -70,7 +71,9 @@ protected internal virtual int AddRootComponent(string identifier, string domEle
throw new ArgumentException($"There is no registered JS component with identifier '{identifier}'.");
}

return Renderer.AddRootComponent(componentType, domElementSelector);
var componentId = Renderer.AddRootComponent(componentType, domElementSelector);
_jsComponentIds.Add(componentId);
return componentId;
}

/// <summary>
Expand All @@ -80,6 +83,8 @@ protected internal virtual int AddRootComponent(string identifier, string domEle
Justification = "OpenComponent already has the right set of attributes")]
protected internal void SetRootComponentParameters(int componentId, int parameterCount, JsonElement parametersJson, JsonSerializerOptions jsonOptions)
{
EnsureValidJSComponentId(componentId);

// In case the client misreports the number of parameters, impose bounds so we know the amount
// of work done is limited to a fixed, low amount.
if (parameterCount < 0 || parameterCount > MaxParameters)
Expand Down Expand Up @@ -153,7 +158,11 @@ protected internal void SetRootComponentParameters(int componentId, int paramete
/// For framework use only.
/// </summary>
protected internal virtual void RemoveRootComponent(int componentId)
=> Renderer.RemoveRootComponent(componentId);
{
EnsureValidJSComponentId(componentId);
Renderer.RemoveRootComponent(componentId);
_jsComponentIds.Remove(componentId);
}

internal static ParameterTypeCache GetComponentParameters(Type componentType)
=> ParameterTypeCaches.GetOrAdd(componentType, static type => new ParameterTypeCache(type));
Expand Down Expand Up @@ -192,6 +201,14 @@ private static bool TryGetComponentParameterInfo(Type componentType, string para
return cacheForComponent.ParameterInfoByName.TryGetValue(parameterName, out parameterInfo);
}

private void EnsureValidJSComponentId(int componentId)
{
if (!_jsComponentIds.Contains(componentId))
{
throw new InvalidOperationException($"Root component with ID '{componentId}' was not added by JavaScript.");
}
}

internal readonly struct ParameterTypeCache
{
public readonly Dictionary<string, ParameterInfo> ParameterInfoByName;
Expand Down
Loading
Loading