1642 instantiations of JsonObject
AnalyzeCiFailure (24)
AnalyzeCiFailure.TestHost (2)
AnalyzeCiFailure.Tests (92)
AnalyzeCiFailureCollectionTests.cs (18)
654var run = new JsonObject
669["head_repository"] = new JsonObject { ["owner"] = new JsonObject { ["login"] = "fork-owner" } },
684new JsonObject
689["steps"] = new JsonArray(new JsonObject { ["name"] = "Check dependent jobs failed", ["conclusion"] = "failure" }),
691new JsonObject
712new JsonObject { ["name"] = "Set up job", ["status"] = "completed", ["conclusion"] = "success" },
713new JsonObject
727new JsonObject { ["name"] = "Upload E2E diagnostics", ["status"] = "queued", ["conclusion"] = null });
730job["steps"]!.AsArray().Add(new JsonObject { ["name"] = "Post cleanup", ["status"] = "completed", ["conclusion"] = "failure" });
797var artifact = new JsonObject
804["workflow_run"] = new JsonObject { ["id"] = scenario == "wrong-artifact-run" ? 999 : 123, ["head_sha"] = scenario == "wrong-artifact-sha" ? "other-sha" : "failed-sha" },
833artifacts.Add(new JsonObject
837["workflow_run"] = new JsonObject { ["id"] = 123, ["head_sha"] = "failed-sha" },
840pages[0]!["jobs"]!.AsArray().Add(new JsonObject
843["steps"] = new JsonArray(new JsonObject { ["number"] = 1, ["name"] = "Run tests", ["conclusion"] = "failure" }),
856new JsonArray(new JsonObject { ["artifacts"] = artifacts }, new JsonObject { ["artifacts"] = new JsonArray() }).ToJsonString());
AnalyzeCiFailurePublicationTests.cs (21)
132tests.Add(new JsonObject
146var collected = new JsonArray(tests.Select(test => (JsonNode)new JsonObject
205var issue = new JsonObject
212["labels"] = new JsonArray(new JsonObject { ["name"] = "ci-failure-cause" }),
383new JsonObject
388["labels"] = new JsonArray(new JsonObject { ["name"] = "ci-failure-cause" }),
513summary["failed_jobs"]!.AsArray().Add(new JsonObject { ["id"] = 124, ["classification"] = "flaky-test" });
598var observations = new JsonArray(Enumerable.Range(start: 1, count).Select(index => (JsonNode)new JsonObject
605["tests"] = new JsonArray(new JsonObject
612var history = new JsonObject
745new JsonArray(new JsonObject { ["id"] = 123, ["name"] = text }).ToJsonString());
775new JsonArray(new JsonObject
780["labels"] = new JsonArray(new JsonObject { ["name"] = "ci-failure-cause" }),
848new JsonArray(new JsonObject
853["labels"] = new JsonArray(new JsonObject { ["name"] = "ci-failure-cause" }),
902new JsonArray(new JsonObject
908["labels"] = new JsonArray(new JsonObject { ["name"] = "ci-failure-cause" }),
1295((JsonArray)summary["failed_jobs"]!).Add(new JsonObject { ["id"] = 456, ["classification"] = "flaky-test" });
1377var projection = new JsonObject
1465new JsonArray(new JsonObject
1471["labels"] = new JsonArray(new JsonObject { ["name"] = "ci-failure-cause" }),
aspire (96)
Utils\EnvironmentChecker\VsCodeExtensionCheck.cs (1)
221=> new()
Aspire.Cli.EndToEnd.Tests (17)
Aspire.Cli.Tests (171)
Agents\AgentConfigurationTests.cs (11)
161edit.PublishAsync(path, new JsonObject(), CancellationToken.None)).DefaultTimeout();
186edit.PublishAsync(path, new JsonObject(), CancellationToken.None)).DefaultTimeout();
203var config = await edit.ReadObjectForEditAsync(path, CancellationToken.None) ?? new JsonObject();
224var config = await edit.ReadObjectForEditAsync(path, CancellationToken.None) ?? new JsonObject();
254var config = await edit.ReadObjectForEditAsync(path, CancellationToken.None) ?? new JsonObject();
282var config = await edit.ReadObjectForEditAsync(path, CancellationToken.None) ?? new JsonObject();
335path, new JsonObject(), CancellationToken.None)).DefaultTimeout();
373var write = edit.PublishAsync(path, new JsonObject { ["token"] = "replacement" }, CancellationToken.None);
414await edit.PublishAsync(path, new JsonObject { ["token"] = "replacement" },
443await edit.PublishAsync(path, new JsonObject { ["token"] = "replacement" },
495var settings = new JsonObject
Commands\ConfigSourceCommandTests.cs (19)
539git.ReadConfiguration = (_, _) => Task.FromResult(("version-2", new JsonObject()));
593git.ReadConfiguration = (_, _) => Task.FromResult(("version-2", new JsonObject()));
674git.ReadConfiguration = (_, _) => Task.FromResult(("version-2", new JsonObject()));
743ReadConfiguration = (_, _) => Task.FromResult(("version-1", new JsonObject
745["skillSources"] = new JsonObject { ["team"] = new JsonObject { ["repository"] = "example/team" } },
746["docs"] = new JsonObject { ["llmsTxtUrl"] = "https://docs.example/llms.txt" }
893return Task.FromResult(("version-1", new JsonObject()));
916ReadConfiguration = (_, _) => Task.FromResult(("version-1", new JsonObject
918["skillSources"] = new JsonObject { ["team"] = new JsonObject { ["repository"] = inheritedRepository } }
1022return Task.FromResult(("version-2", new JsonObject()));
1318return Task.FromResult(("version-2", new JsonObject
1320["skillSources"] = new JsonObject { ["team"] = new JsonObject { ["repository"] = "example/updated" } }
1375ReadConfiguration = (_, _) => Task.FromResult(("version-1", new JsonObject
1377["skillSources"] = new JsonObject { ["team"] = new JsonObject { ["repository"] = "example/team" } },
1378["sdk"] = new JsonObject { ["version"] = "99.0.0" }
Configuration\ConfigSourceServiceTests.cs (17)
324return Task.FromResult(("version-2", new JsonObject { ["skillSources"] = new JsonObject { ["team"] = new JsonObject { ["repository"] = "example/updated" } } }));
421return Task.FromResult(("version-2", new JsonObject()));
666ReadConfiguration = (_, _) => Task.FromResult(("version-2", new JsonObject
668["skillSources"] = new JsonObject { ["team"] = new JsonObject { ["repository"] = "example/shared" } }
1018return Task.FromResult(("version-1", new JsonObject()));
1740return Task.FromResult(("version-1", new JsonObject()));
1869return Task.FromResult(("version-1", new JsonObject
1871["skillSources"] = new JsonObject { ["team"] = new JsonObject { ["repository"] = "example/team" } }
1911return ("version-2", new JsonObject());
1935return Task.FromResult(("version-2", new JsonObject()));
1959return Task.FromResult(("version-2", new JsonObject()));
2088git.ReadConfiguration = (_, _) => Task.FromResult(("version-2", new JsonObject()));
2132ReadConfiguration = (_, _) => Task.FromResult(("version-2", new JsonObject()))
Configuration\ConfigurationHelperTests.cs (22)
34path, new JsonObject { ["custom"] = "updated" }, CancellationToken.None, rejectSymbolicLinks: true));
58path, new JsonObject { ["custom"] = "updated" }, CancellationToken.None,
81path, new JsonObject { ["custom"] = "updated" }, CancellationToken.None,
114await ConfigurationHelper.WriteSettingsFileAtomicallyAsync(path, new JsonObject { ["custom"] = "updated" }, CancellationToken.None);
135await ConfigurationHelper.WriteSettingsFileAtomicallyAsync(path, new JsonObject { ["custom"] = "updated" }, CancellationToken.None);
153ConfigurationHelper.WriteSettingsFileAtomicallyAsync(path, new JsonObject { ["custom"] = "updated" }, CancellationToken.None));
180await ConfigurationHelper.WriteSettingsFileAtomicallyAsync(path, new JsonObject { ["custom"] = "updated" }, CancellationToken.None);
206await ConfigurationHelper.WriteSettingsFileAtomicallyAsync(file.FullName, new JsonObject { ["custom"] = "updated" }, CancellationToken.None);
455var settings = new JsonObject
457["appHost"] = new JsonObject { ["path"] = "MyApp.csproj" },
491var settings = new JsonObject
493["appHost"] = new JsonObject { ["path"] = "MyApp.csproj" },
509var settings = new JsonObject
511["appHost"] = new JsonObject { ["path"] = "MyApp.csproj" },
533var settings = new JsonObject
535["appHost"] = new JsonObject { ["path"] = "MyApp.csproj" },
648var nested = new JsonObject();
649var settings = new JsonObject
651["DOCS"] = new JsonObject { ["custom"] = "preserved" },
652["docs"] = new JsonObject { ["api"] = nested }
791var settings = new JsonObject();
794var existing = new JsonObject();
Aspire.Dashboard (3)
Aspire.Dashboard.Tests (10)
Aspire.Hosting (18)
Aspire.Hosting.Azure (17)
Aspire.Hosting.Azure.EntraId.Tests (2)
Aspire.Hosting.Azure.Kubernetes.Tests (49)
AzureKubernetesInfrastructureTests.cs (49)
332stateManager.SetSection("Azure", new JsonObject
337stateManager.SetSection("Azure:Deployments:aks", new JsonObject
339["Outputs"] = new JsonObject
341["id"] = new JsonObject
348["name"] = new JsonObject
354["Scope"] = new JsonObject
360stateManager.SetSection("HelmChart:aks:podinfo", new JsonObject
496stateManager.SetSection("Azure", new JsonObject
501stateManager.SetSection("Azure:Deployments:aks", new JsonObject
503["Outputs"] = new JsonObject
505["id"] = new JsonObject
510["name"] = new JsonObject
516["Scope"] = new JsonObject
522stateManager.SetSection("Helm:aks", new JsonObject
585stateManager.SetSection("Azure", new JsonObject
590stateManager.SetSection("Azure:Deployments:aks", new JsonObject
592["Outputs"] = new JsonObject
594["id"] = new JsonObject
601stateManager.SetSection("Helm:aks", new JsonObject
665stateManager.SetSection("Azure:Deployments:aks", new JsonObject
669stateManager.SetSection("Helm:aks", new JsonObject
710stateManager.SetSection("Azure:Deployments:aks", new JsonObject
712["Outputs"] = new JsonObject
714["id"] = new JsonObject
758stateManager.SetSection("Sentinel", new JsonObject { ["Value"] = "cleared-by-destroy" });
793stateManager.SetSection("Azure:Deployments:aks", new JsonObject
834stateManager.SetSection("Azure:Deployments:aks", new JsonObject
836["Outputs"] = new JsonObject
838["id"] = new JsonObject
889stateManager.SetSection("Azure:Deployments:aks", new JsonObject
891["Outputs"] = new JsonObject
893["id"] = new JsonObject
900stateManager.SetSection("Helm:aks", new JsonObject
957stateManager.SetSection("Azure:Deployments:aks", new JsonObject
959["Outputs"] = new JsonObject
961["id"] = new JsonObject
1029stateManager.SetSection("Azure:Deployments:aks", new JsonObject
1031["Outputs"] = new JsonObject
1033["id"] = new JsonObject
1098stateManager.SetSection("Azure:Deployments:aks", new JsonObject
1100["Outputs"] = new JsonObject
1102["id"] = new JsonObject
1202deploymentStateManager.SetSection("Azure", new JsonObject
1227deploymentStateManager.SetSection("Azure", new JsonObject
1416deploymentStateManager.SetSection("Azure", new JsonObject
1514deploymentStateManager.SetSection("Azure", new JsonObject
1730deploymentStateManager.SetSection("Azure", new JsonObject
1817deploymentStateManager.SetSection("Azure", new JsonObject
1909var azureState = new JsonObject { ["SubscriptionId"] = subscriptionId };
Aspire.Hosting.Azure.Sandboxes (6)
Aspire.Hosting.Azure.Tests (99)
BicepUtilitiesTests.cs (59)
28var scope = new JsonObject();
56var moduleScope = new JsonObject();
77var scope = new JsonObject();
107var scope = new JsonObject();
136var scope = new JsonObject();
169var parameters = new JsonObject();
186var parameters = new JsonObject();
219var parameters = new JsonObject();
250.WithParameter("jsonObj", new JsonObject { ["key"] = "value" })
255var parameters = new JsonObject();
311var parameters = new JsonObject();
330.WithParameter("jsonObj", new JsonObject { ["key"] = "value" });
336.WithParameter("jsonObj", new JsonObject { ["key"] = "value" });
338var parameters0 = new JsonObject();
342var parameters1 = new JsonObject();
363.WithParameter("jsonObj", new JsonObject { ["key"] = "value" });
365var parameters0 = new JsonObject();
369var parameters1 = new JsonObject();
389var parameters0 = new JsonObject();
390var scope0 = new JsonObject();
395var parameters1 = new JsonObject();
396var scope1 = new JsonObject();
417var parameters0 = new JsonObject();
418var scope0 = new JsonObject();
423var parameters1 = new JsonObject();
424var scope1 = new JsonObject();
440var parameters = new JsonObject
442["param1"] = new JsonObject { ["value"] = "value1" }
460var parameters1 = new JsonObject
462["param1"] = new JsonObject { ["value"] = "value1" }
465var parameters2 = new JsonObject
467["param1"] = new JsonObject { ["value"] = "value2" }
485var parameters = new JsonObject
487["param1"] = new JsonObject { ["value"] = "value1" }
490var scope1 = new JsonObject { ["resourceGroup"] = "rg1" };
491var scope2 = new JsonObject { ["resourceGroup"] = "rg2" };
513var parameters1 = new JsonObject
515["param1"] = new JsonObject { ["value"] = value1 }
518var parameters2 = new JsonObject
520["param1"] = new JsonObject { ["value"] = value2 }
548var parameters = new JsonObject();
567var scope = new JsonObject();
582var scope = new JsonObject();
598var scope = new JsonObject();
613var scope = new JsonObject
632var scope = new JsonObject();
646var scope = new JsonObject();
672var stateSection = new DeploymentStateSection("test", new JsonObject
689var parameters = new JsonObject
691["param1"] = new JsonObject { ["value"] = "value1" }
694var stateSection = new DeploymentStateSection("test", new JsonObject
713var legacyParameters = new JsonObject();
719var stateSection = new DeploymentStateSection("test", new JsonObject
726var currentParameters = new JsonObject();
727var currentScope = new JsonObject();
750var parameters = new JsonObject
752[AzureBicepResource.KnownParameters.PrincipalType] = new JsonObject { ["value"] = "User" },
753[AzureBicepResource.KnownParameters.PrincipalId] = new JsonObject { ["value"] = "1234" },
756var stateSection = new DeploymentStateSection("test", new JsonObject
Aspire.Hosting.Azure.WebPubSub (5)
Aspire.Hosting.Blazor (3)
Aspire.Hosting.CodeGeneration.Go (9)
Aspire.Hosting.CodeGeneration.Go.Tests (1)
Aspire.Hosting.CodeGeneration.Java.Tests (1)
Aspire.Hosting.CodeGeneration.TypeScript (10)
Aspire.Hosting.Docker.Tests (1)
Aspire.Hosting.Kubernetes (2)
Aspire.Hosting.Kubernetes.Tests (4)
Aspire.Hosting.Native.Client (2)
Aspire.Hosting.Native.CodeGeneration (7)
Aspire.Hosting.Native.Core.Tests (46)
ApplicationRevisionTests.cs (6)
75("result", new JsonObject { ["status"] = "succeeded", ["message"] = "pong" }))));
367Arguments(("context", writer), ("revision", JsonValue.Create(revision)), ("container", new JsonObject
375Arguments(("context", context.Writer), ("container", new JsonObject
385EnsureSuccess(author.Invoke("setResourceConfiguration", Arguments(("context", resource), ("configuration", new JsonObject
387["properties"] = new JsonArray(new JsonObject { ["name"] = "value", ["value"] = value })
393("result", new JsonObject { ["status"] = status, ["message"] = "" })));
NativeDashboardTests.cs (4)
104("requestId", pending["requestId"]), ("result", new JsonObject { ["status"] = "succeeded", ["message"] = "refreshed" })));
157("context", cache), ("configuration", new JsonObject
159["properties"] = new JsonArray(new JsonObject { ["name"] = "value", ["value"] = "updated" })
173("result", new JsonObject { ["status"] = "succeeded", ["message"] = "" }))));
Aspire.Hosting.Native.Server (24)
Aspire.Hosting.Radius (3)
Aspire.Hosting.RemoteHost (8)
Aspire.Hosting.RemoteHost.Tests (272)
CapabilityDispatcherTests.cs (159)
39var result = await dispatcher.InvokeAsync("Aspire.Hosting.Radius/withContainerImage", new JsonObject
41["builder"] = new JsonObject { ["$handle"] = handleId },
142dispatcher.Invoke("Aspire.Hosting/withTerminal", new JsonObject
144["builder"] = new JsonObject { ["$handle"] = handle },
185ResultToReturn = optionsJson is null ? null : new JsonObject { ["p0"] = JsonNode.Parse(optionsJson) }
191var args = new JsonObject { ["builder"] = new JsonObject { ["$handle"] = handleId } };
237ResultToReturn = new JsonObject { ["p0"] = JsonNode.Parse(optionsJson) }
243var args = new JsonObject
245["builder"] = new JsonObject { ["$handle"] = handleId },
314dispatcher.Invoke("test/capability@1", new JsonObject { ["name"] = "test-value" });
425var args = new JsonObject { ["value"] = "hello" };
437var args = new JsonObject { ["required"] = "test" };
449var args = new JsonObject { ["required"] = "test", ["optional"] = "custom" };
461var args = new JsonObject { ["value"] = "test" };
504var args = new JsonObject { ["context"] = new JsonObject { ["$handle"] = handleId } };
531var args = new JsonObject { ["context"] = "not-a-handle" };
543var args = new JsonObject { ["context"] = new JsonObject { ["$handle"] = "Aspire.Hosting.RemoteHost.Tests/Aspire.Hosting.RemoteHost.Tests.TestContextType:999" } };
560var getArgs = new JsonObject { ["context"] = new JsonObject { ["$handle"] = handleId } };
567var invokeArgs = new JsonObject { ["cancellationToken"] = tokenResult };
620var args = new JsonObject { ["context"] = new JsonObject { ["$handle"] = handleId } };
639var nestedArgs = new JsonObject { ["context"] = new JsonObject { ["$handle"] = nestedHandleId } };
697var args = new JsonObject
699["context"] = new JsonObject { ["$handle"] = handleId },
718var args = new JsonObject
720["context"] = new JsonObject { ["$handle"] = handleId },
737var args = new JsonObject
739["context"] = new JsonObject { ["$handle"] = handleId },
756var args = new JsonObject
758["context"] = new JsonObject { ["$handle"] = handleId }
789var args = new JsonObject
791["context"] = new JsonObject { ["$handle"] = handleId }
807var args = new JsonObject
809["context"] = new JsonObject { ["$handle"] = handleId },
828var args = new JsonObject
830["context"] = new JsonObject { ["$handle"] = handleId },
848var args = new JsonObject
850["context"] = new JsonObject { ["$handle"] = handleId },
864var args = new JsonObject { ["value"] = "value-task" };
905var args = new JsonObject
928var args = new JsonObject
949var args = new JsonObject
972var args = new JsonObject
1071new JsonObject { ["callback"] = "background-callback" });
1095new JsonObject { ["callback"] = "background-callback" });
1115var first = Task.Run(() => dispatcher.InvokeAsync(capabilityId, new JsonObject { ["name"] = "first" }));
1118var second = dispatcher.InvokeAsync(capabilityId, new JsonObject { ["name"] = "second" });
1141new JsonObject { ["name"] = "nested" })));
1148new JsonObject { ["callback"] = "reentrant-callback" })).WaitAsync(TimeSpan.FromSeconds(30));
1162var args = new JsonObject
1190var args = new JsonObject { ["value"] = "test" };
1201var args = new JsonObject { ["value"] = "hello" };
1213var args = new JsonObject { ["value"] = "test" };
1227var args = new JsonObject
1242var args = new JsonObject { ["count"] = 3 };
1259var args = new JsonObject
1275var args = new JsonObject { ["value"] = "hello" };
1287var args = new JsonObject { ["value"] = 42 };
1299var args = new JsonObject
1301["value"] = new JsonObject
1317var args = new JsonObject { ["value"] = nameof(TestDispatchEnum.ValueB) };
1329var args = new JsonObject { ["value"] = "/usr/local/lib/redis/modules/redisearch.so" };
1341var args = new JsonObject
1343["value"] = new JsonObject
1367var args = new JsonObject
1369["value"] = new JsonObject { ["$handle"] = handleId }
1382var args = new JsonObject
1400var args = new JsonObject
1402["value"] = new JsonObject
1445var args = new JsonObject
1447["list"] = new JsonObject { ["$handle"] = listHandle },
1467var args = new JsonObject
1469["list"] = new JsonObject { ["$handle"] = listHandle },
1491var removeArgs = new JsonObject
1493["list"] = new JsonObject { ["$handle"] = listHandle },
1502var lengthArgs = new JsonObject
1504["list"] = new JsonObject { ["$handle"] = listHandle }
1523var args = new JsonObject
1525["list"] = new JsonObject { ["$handle"] = listHandle }
1546var clearArgs = new JsonObject
1548["list"] = new JsonObject { ["$handle"] = listHandle }
1553var lengthArgs = new JsonObject
1555["list"] = new JsonObject { ["$handle"] = listHandle }
1591var args = new JsonObject
1593["dict"] = new JsonObject { ["$handle"] = dictHandle },
1613var args = new JsonObject
1615["dict"] = new JsonObject { ["$handle"] = dictHandle },
1635var args = new JsonObject
1637["dict"] = new JsonObject { ["$handle"] = dictHandle },
1659var removeArgs = new JsonObject
1661["dict"] = new JsonObject { ["$handle"] = dictHandle },
1670var countArgs = new JsonObject
1672["dict"] = new JsonObject { ["$handle"] = dictHandle }
1692var hasArgs = new JsonObject
1694["dict"] = new JsonObject { ["$handle"] = dictHandle },
1703var hasArgs2 = new JsonObject
1705["dict"] = new JsonObject { ["$handle"] = dictHandle },
1725var args = new JsonObject
1727["dict"] = new JsonObject { ["$handle"] = dictHandle }
1750var args = new JsonObject
1752["dict"] = new JsonObject { ["$handle"] = dictHandle }
1774var args = new JsonObject
1776["dict"] = new JsonObject { ["$handle"] = dictHandle }
1794var args = new JsonObject
1796["dict"] = new JsonObject { ["$handle"] = dictHandle }
1811var args = new JsonObject
1828var args = new JsonObject
1845var args = new JsonObject
1862var args = new JsonObject
1879var result = dispatcher.Invoke("Aspire.Hosting.RemoteHost.Tests/acceptOptionalEnum", new JsonObject());
1888var args = new JsonObject
1890["dto"] = new JsonObject
1907var args = new JsonObject
1909["dto"] = new JsonObject
1925var args = new JsonObject
1927["dto"] = new JsonObject
1943var args = new JsonObject();
1965var args = new JsonObject { ["context"] = new JsonObject { ["$handle"] = handleId } };
1983var args = new JsonObject
1985["context"] = new JsonObject { ["$handle"] = handleId },
2003var args = new JsonObject
2005["context"] = new JsonObject { ["$handle"] = handleId },
2024var args = new JsonObject { ["context"] = new JsonObject { ["$handle"] = handleId } };
2041var args = new JsonObject { ["context"] = new JsonObject { ["$handle"] = handleId } };
2056var args = new JsonObject { ["context"] = new JsonObject { ["$handle"] = handleId } };
2076var args = new JsonObject
2078["builder"] = new JsonObject { ["$handle"] = targetHandleId },
2079["source"] = new JsonObject { ["$handle"] = sourceHandleId }
2100var args = new JsonObject
2102["builder"] = new JsonObject { ["$handle"] = builderHandleId }
2122var args = new JsonObject
2124["builder"] = new JsonObject { ["$handle"] = builderHandleId }
2144var args = new JsonObject
2146["builder"] = new JsonObject { ["$handle"] = resourceHandleId }
2165var args = new JsonObject
2167["builder"] = new JsonObject { ["$handle"] = builderHandleId }
2191var args = new JsonObject
2193["context"] = new JsonObject { ["$handle"] = targetHandleId },
2194["value"] = new JsonObject { ["$handle"] = valueHandleId }
2219var args = new JsonObject
2221["builder"] = new JsonObject { ["$handle"] = targetHandleId },
2222["source"] = new JsonObject { ["$handle"] = sourceHandleId }
2239var args = new JsonObject
2241["builder"] = new JsonObject { ["$handle"] = builderHandleId }
2266var args = new JsonObject
2268["builder"] = new JsonObject { ["$handle"] = builderHandleId }
2294var args = new JsonObject
2296["builder"] = new JsonObject { ["$handle"] = handles.Register(new TestResourceBuilder<TestResourceWithProperties>(target), "target-type") }
2380var args = new JsonObject
2382["resource"] = new JsonObject { ["$handle"] = handleId },
ExternalCapabilityRegistryTests.cs (12)
36await registry.TryInvokeAsync("test.external/callback", new JsonObject { ["configure"] = "guest_callback" }, owner);
198await registry.TryInvokeAsync("test.external/callback", new JsonObject { ["configure"] = "guest_callback" }, guest.CallbackInvoker);
202new JsonObject { ["p0"] = "configured" }, TestContext.Current.CancellationToken);
211"test.external/callback", new JsonObject { ["configure"] = "late_callback" }, guest.CallbackInvoker));
270new JsonObject { ["cancellationToken"] = "ct_guest" }, cancellationToken: TestContext.Current.CancellationToken);
313await registry.TryInvokeAsync("test.external/callback", new JsonObject { ["configure"] = "guest_callback" }, guestInvoker);
327"test.external/callback", new JsonObject { ["configure"] = "guest_callback" }, guestInvoker)).Found);
372await registry.TryInvokeAsync("test.external/callback", new JsonObject { ["configure"] = "guest_callback" }, guestInvoker);
637new JsonObject { ["configure"] = "guest_callback" }, new JsonRpcCallbackInvoker(NullLogger<JsonRpcCallbackInvoker>.Instance));
674var firstArgs = new JsonObject { ["name"] = "first", ["configure"] = "guest_callback" };
675var secondArgs = new JsonObject { ["name"] = "second", ["configure"] = "guest_callback" };
726new JsonObject { ["configure"] = "guest_callback" },
KubernetesManifestTests.cs (11)
41var manifestHandle = dispatcher.Invoke("Aspire.Hosting.Kubernetes/addManifest", new JsonObject
52var result = dispatcher.Invoke("Aspire.Hosting.Kubernetes/withField", new JsonObject
99var manifestHandle = dispatcher.Invoke("Aspire.Hosting.Kubernetes/addManifest", new JsonObject
107dispatcher.Invoke("Aspire.Hosting.Kubernetes/withField", new JsonObject
116"object" => new JsonObject { ["label"] = handle },
118"nested" => new JsonObject { ["items"] = new JsonArray(new JsonObject { ["label"] = handle }) },
123"Aspire.Hosting.Kubernetes/withField", new JsonObject
133"Aspire.Hosting.Kubernetes/withField", new JsonObject
152var manifestHandle = dispatcher.Invoke("Aspire.Hosting.Kubernetes/addManifest", new JsonObject
161"Aspire.Hosting.Kubernetes/withField", new JsonObject
Aspire.Hosting.Tests (35)
Aspire.Hosting.Yarp (4)
Aspire.Managed.Tests (9)
ConfigurationSchemaGenerator (13)
dotnet-user-jwts (7)
GenerateTemplateManifest (4)
Infrastructure.Tests (402)
WorkflowScripts\AutoSecWorkflowTests.cs (399)
26var result = await RunHarnessAsync(new JsonObject
29["alerts"] = empty ? new JsonArray() : new JsonArray(new JsonObject
32["dependency"] = new JsonObject
34["package"] = new JsonObject { ["ecosystem"] = "npm", ["name"] = "example" },
37["security_vulnerability"] = new JsonObject
40["first_patched_version"] = new JsonObject { ["identifier"] = "1.2.3" },
42["security_advisory"] = new JsonObject { ["description"] = "synthetic private advisory", ["vulnerabilities"] = new JsonArray() },
44["malware"] = empty ? new JsonArray() : new JsonArray(new JsonObject { ["number"] = 7 }),
73var result = await RunHarnessAsync(new JsonObject { ["mode"] = "collect-alerts", ["failure"] = phase });
104request["failure"] = new JsonObject { ["endpoint"] = endpoint, ["status"] = status };
171request["failure"] = new JsonObject
225scenario["files"] = new JsonArray(new JsonObject
232scenario["contentFailure"] = new JsonObject
252scenario["files"] = new JsonArray("extension/package.json", new JsonObject
261scenario["responses"]!["https://registry.npmjs.org/transitive"] = Response(new JsonObject
263["time"] = new JsonObject { ["4.1.0"] = "2026-09-01T00:00:00Z", ["5.0.0"] = "2026-09-01T00:00:00Z" },
282scenario["files"] = new JsonArray("extension/package.json", new JsonObject { ["filename"] = "extension/yarn.lock", ["status"] = status });
303scenario["files"] = new JsonArray(new JsonObject
377var valid = new JsonObject { ["status"] = "ahead", ["merge_base_commit"] = new JsonObject { ["sha"] = new string('b', 40) } };
513new JsonObject { ["author_login"] = "dependabot[bot]", ["verified"] = true },
514new JsonObject { ["author_login"] = "someone", ["verified"] = true });
518scenario["commits"] = new JsonArray(new JsonObject { ["author_login"] = "dependabot[bot]", ["verified"] = false });
555scenario["responses"]!["https://registry.npmjs.org/react"] = Response(new JsonObject { ["time"] = new JsonObject { ["18.2.0"] = "2026-09-01T00:00:00Z" } });
563scenario["responses"]!["https://registry.npmjs.org/foo"] = Response(new JsonObject { ["time"] = new JsonObject { ["2.1.0"] = "2026-09-01T00:00:00Z" } });
571scenario["responses"]!["https://registry.npmjs.org/foo"] = Response(new JsonObject { ["time"] = new JsonObject { ["2.1.0"] = "2026-09-01T00:00:00Z" } });
579scenario["responses"]!["https://registry.npmjs.org/minimist"] = Response(new JsonObject { ["time"] = new JsonObject { ["1.2.8"] = "2026-09-01T00:00:00Z" } });
580scenario["alerts"]!.AsArray().Add(new JsonObject
595scenario["responses"]!["https://registry.npmjs.org/minimist"] = Response(new JsonObject { ["time"] = new JsonObject { ["1.2.8"] = "2026-09-28T00:00:00Z" } });
646scenario["liveCheckRuns"] = new JsonArray(new JsonObject { ["name"] = "tests", ["status"] = "in_progress", ["conclusion"] = null });
651scenario["liveStatuses"] = new JsonArray(new JsonObject { ["context"] = "license/cla", ["state"] = "failure" });
667scenario["responses"]!["https://registry.npmjs.org/minimist"] = Response(new JsonObject { ["time"] = new JsonObject { ["1.2.8"] = "2026-09-01T00:00:00Z" } });
679scenario["checkRuns"]!.AsArray().Add(new JsonObject { ["name"] = "tests", ["status"] = "in_progress", ["conclusion"] = null });
682scenario["statuses"] = new JsonArray(new JsonObject { ["context"] = "license/cla", ["state"] = "pending" });
690statuses.Add(new JsonObject { ["context"] = $"ok-{i}", ["state"] = "success" });
692statuses.Add(new JsonObject { ["context"] = "license/cla", ["state"] = "failure" });
697scenario["statuses"] = new JsonArray(new JsonObject { ["context"] = "license/cla", ["state"] = "success" });
701scenario["reviews"] = new JsonArray(new JsonObject { ["user_login"] = "aspire-repo-bot[bot]", ["state"] = "APPROVED", ["commit_id"] = HeadSha });
719var result = await RunHarnessAsync(new JsonObject
723["args"] = new JsonArray(new JsonObject
726new JsonObject { ["type"] = "approve_dependabot_pr", ["pr_number"] = 5, ["head_sha"] = HeadSha },
727new JsonObject { ["type"] = "approve_dependabot_pr", ["pr_number"] = 5, ["head_sha"] = HeadSha },
728new JsonObject { ["type"] = "approve_dependabot_pr", ["pr_number"] = 6, ["head_sha"] = "main" },
729new JsonObject { ["type"] = "approve_dependabot_pr", ["pr_number"] = -1, ["head_sha"] = HeadSha },
730new JsonObject { ["type"] = "create_pull_request", ["pr_number"] = 7, ["head_sha"] = HeadSha }),
752var result = await RunHarnessAsync(new JsonObject
773var result = await RunHarnessAsync(new JsonObject
830var result = await RunHarnessAsync(new JsonObject
887var workspaceFiles = new JsonObject
891var request = new JsonObject
894["patchFiles"] = new JsonObject { ["aw-auto-sec-security-updates.patch"] = patch },
897["responses"] = new JsonObject
899["https://registry.npmjs.org/lodash"] = Response(new JsonObject
901["time"] = new JsonObject { ["4.17.21"] = "2026-08-01T00:00:00Z", ["4.17.22"] = "2026-08-30T00:00:00Z", ["5.0.0"] = "2026-08-01T00:00:00Z" },
903["https://api.nuget.org/v3/registration5-gz-semver2/x/9.0.5.json"] = Response(new JsonObject { ["published"] = "2026-08-01T00:00:00Z" }),
904["https://api.nuget.org/v3/registration5-gz-semver2/x/9.0.6.json"] = Response(new JsonObject { ["published"] = "2026-08-01T00:00:00Z" }),
906[$"{flat}x/index.json"] = Response(new JsonObject { ["versions"] = new JsonArray("9.0.4", "9.0.5") }),
915request["branchFiles"] = new JsonObject { [path] = baseText };
921request["branchFiles"] = new JsonObject { [path] = baseText + "{\"resolved\": \"https://evil.example/lodash/-/lodash-4.17.21.tgz\"}\n" };
975var result = await RunHarnessAsync(new JsonObject
978["patchFiles"] = new JsonObject
983["workspaceFiles"] = new JsonObject
989["responses"] = new JsonObject
991["https://registry.npmjs.org/lodash"] = Response(new JsonObject
993["time"] = new JsonObject { ["4.17.21"] = "2026-08-01T00:00:00Z", ["4.17.22"] = "2026-08-30T00:00:00Z", ["5.0.0"] = "2026-08-01T00:00:00Z" },
995["https://api.nuget.org/v3/registration5-gz-semver2/x/9.0.5.json"] = Response(new JsonObject { ["published"] = "2026-08-01T00:00:00Z" }),
996["https://api.nuget.org/v3/registration5-gz-semver2/x/9.0.6.json"] = Response(new JsonObject { ["published"] = "2026-08-01T00:00:00Z" }),
998[$"{flat}x/index.json"] = Response(new JsonObject { ["versions"] = new JsonArray("9.0.4", "9.0.5") }),
1011var result = await RunHarnessAsync(new JsonObject
1014["patchFiles"] = new JsonObject
1043var request = new JsonObject
1046["patchFiles"] = new JsonObject { ["aw-auto-sec-security-updates.patch"] = patch },
1050request["workspaceFiles"] = new JsonObject { ["extension/package-lock.json"] = baseText };
1127var result = await RunHarnessAsync(new JsonObject
1131["workspaceFiles"] = new JsonObject { ["extension/package-lock.json"] = PublicTextBase },
1133["patchFiles"] = new JsonObject { ["aw-auto-sec-security-updates.patch"] = PublicTextPatch },
1154var result = await RunHarnessAsync(new JsonObject
1171var result = await RunHarnessAsync(new JsonObject
1175["workspaceFiles"] = new JsonObject { ["extension/package-lock.json"] = PublicTextBase },
1177["patchFiles"] = new JsonObject
1195var result = await RunHarnessAsync(new JsonObject
1200["patchFiles"] = new JsonObject
1204["baseFiles"] = new JsonObject { [alias] = PublicTextBase },
1288? new JsonObject { ["type"] = "push_to_pull_request_branch", ["pull_request_number"] = 202, ["message"] = pushMessage }
1289: new JsonObject { ["type"] = "create_pull_request", ["branch"] = "auto-sec/security-updates", ["title"] = title, ["body"] = body };
1290var result = await RunHarnessAsync(new JsonObject
1294["patchFiles"] = new JsonObject { ["aw-auto-sec-security-updates.patch"] = patch },
1335var result = await RunHarnessAsync(new JsonObject
1349var result = await RunHarnessAsync(new JsonObject
1354new JsonArray(new JsonObject { ["malware"] = true }, new JsonObject()),
1355new JsonObject
1357["version_alerts"] = new JsonArray(new JsonObject()),
1358["other_rule_counts"] = new JsonArray(new JsonObject { ["count"] = 2 }, new JsonObject { ["count"] = 3 }),
1378var output = new JsonObject { ["type"] = "noop", ["message"] = message }.ToJsonString();
1379var result = await RunHarnessAsync(new JsonObject
1382["collectedCounts"] = new JsonObject { ["alerts"] = alerts, ["codeFindings"] = codeFindings },
1385["patchFiles"] = new JsonObject { ["aw-auto-sec-security-updates.patch"] = PublicTextPatch.ReplaceLineEndings("\n") },
1387["workFiles"] = new JsonObject
1410var result = await RunHarnessAsync(new JsonObject
1423["outputLines"] = new JsonArray(new JsonObject
1443var output = new JsonObject
1448var result = await RunHarnessAsync(new JsonObject
1475var result = await RunHarnessAsync(new JsonObject
1480["patchFiles"] = new JsonObject { ["aw-auto-sec-security-updates.patch"] = PublicTextPatch.Replace("\r\n", "\n") },
1499var result = await RunHarnessAsync(new JsonObject
1503["patchFiles"] = new JsonObject { ["aw-auto-sec-security-updates.patch"] = PublicTextPatch.Replace("\r\n", "\n") },
1538var result = await RunHarnessAsync(new JsonObject
1542["baseFiles"] = new JsonObject { ["extension/package-lock.json"] = PublicTextBase },
1543["generatedPatch"] = new JsonObject
1545["headFiles"] = new JsonObject
1601var result = await RunHarnessAsync(new JsonObject
1605["baseFiles"] = new JsonObject { ["extension/package-lock.json"] = PublicTextBase },
1606["generatedPatch"] = new JsonObject
1609new JsonObject { ["headFiles"] = new JsonObject { ["extension/package-lock.json"] = firstHead }, ["message"] = firstMessage },
1610new JsonObject
1612["headFiles"] = new JsonObject { ["extension/package-lock.json"] = firstHead.Replace("4.17.20", "4.17.21", StringComparison.Ordinal).Replace("22.0.1", "22.1.0", StringComparison.Ordinal) },
1658? new JsonObject
1662: new JsonObject
1669var heads = new JsonObject();
1679head["packages"]!["node_modules/y"] = new JsonObject { ["version"] = "1.0.2" };
1687var result = await RunHarnessAsync(new JsonObject
1692["generatedPatch"] = new JsonObject { ["headFiles"] = heads, ["message"] = field == "commit" ? message : complete },
1729var result = await RunHarnessAsync(new JsonObject
1734["patchFiles"] = new JsonObject { ["aw-auto-sec-security-updates.patch"] = PublicTextPatch.Replace("\r\n", "\n") },
1735["workFiles"] = new JsonObject { [filename] = "private advisory detail" },
1748var result = await RunHarnessAsync(new JsonObject
1753["patchFiles"] = new JsonObject { ["aw-auto-sec-security-updates.patch"] = PublicTextPatch.Replace("\r\n", "\n") },
1754["workFiles"] = new JsonObject { ["safeoutputs/private.txt"] = "private advisory detail" },
1767var result = await RunHarnessAsync(new JsonObject
1771["collectedCounts"] = new JsonObject { ["alerts"] = 2, ["codeFindings"] = 5 },
1773new JsonObject { ["type"] = "create_pull_request", ["branch"] = "auto-sec/security-updates", ["title"] = "Automated dependency updates", ["body"] = PublicTextBody.Replace("\r\n", "\n") }.ToJsonString(),
1774new JsonObject { ["type"] = "approve_dependabot_pr", ["pr_number"] = 101, ["head_sha"] = headSha, ["note"] = "fixes alert 42" }.ToJsonString(),
1775new JsonObject { ["type"] = "missing_tool", ["tool"] = "alerts", ["reason"] = "alert 42 needs a tool" }.ToJsonString(),
1776new JsonObject { ["type"] = "noop", ["message"] = "alerts=2 dependabot-pr=1 auto-sec-pr=1 blocked=0 code-findings-out-of-scope=5" }.ToJsonString()),
1777["patchFiles"] = new JsonObject { ["aw-auto-sec-security-updates.patch"] = PublicTextPatch.Replace("\r\n", "\n") },
1778["workFiles"] = new JsonObject
1799item => Assert.Equal(new JsonObject { ["type"] = "approve_dependabot_pr", ["pr_number"] = 101, ["head_sha"] = headSha }.ToJsonString(), item.ToJsonString()),
1810var result = await RunHarnessAsync(new JsonObject
1815["patchFiles"] = new JsonObject { ["aw-auto-sec-security-updates.patch"] = PublicTextPatch.Replace("\r\n", "\n") },
1845var result = await RunHarnessAsync(new JsonObject
1850["patchFiles"] = new JsonObject { ["aw-auto-sec-security-updates.patch"] = patch },
1893baseline["metadata"] = new JsonArray(new JsonObject { ["version"] = "1.0.0" });
1914head["node_modules/alert-42"] = new JsonObject { ["version"] = "1.2.3" };
1917head["dependencies"] = new JsonObject { ["alert-42"] = "1.2.3" };
1920head["requires"] = new JsonObject { ["alert-42"] = "1.2.3" };
1923package["engines"] = new JsonObject { ["alert-42"] = "1.2.3" };
1936package[scenario] = new JsonObject { ["@types/node"] = "^22.1.0" };
1950var result = await RunHarnessAsync(new JsonObject
1954["baseFiles"] = new JsonObject { [path] = baseText },
1955["generatedPatch"] = new JsonObject
1957["headFiles"] = new JsonObject { [path] = text },
1996var baseline = new JsonObject { ["lockfileVersion"] = version, ["requires"] = true };
1999baseline["dependencies"] = new JsonObject
2001["lodash"] = new JsonObject
2004["requires"] = new JsonObject { ["@types/node"] = "^22.0.0" },
2005["dependencies"] = new JsonObject { ["@types/node"] = new JsonObject { ["version"] = "22.0.0" } },
2007["@types/node"] = new JsonObject { ["version"] = "22.0.0" },
2017var result = await RunHarnessAsync(new JsonObject
2021["baseFiles"] = new JsonObject { [path] = baseText },
2022["generatedPatch"] = new JsonObject
2024["headFiles"] = new JsonObject { [path] = baseText.Replace("4.17.20", "4.17.21", StringComparison.Ordinal).Replace("22.0.0", "22.1.0", StringComparison.Ordinal) },
2057baseline["dependencies"] = new JsonObject
2072baseline["dependencies"]!["parent"] = new JsonObject
2075["dependencies"] = new JsonObject { ["lodash"] = new JsonObject { ["version"] = "4.17.20" } },
2080baseline["packages"]!["node_modules/parent/node_modules/lodash"] = new JsonObject { ["version"] = "4.17.20" };
2111var result = await RunHarnessAsync(new JsonObject
2115["baseFiles"] = new JsonObject { [path] = baseline.ToJsonString(options) + "\n" },
2116["generatedPatch"] = new JsonObject
2118["headFiles"] = new JsonObject { [path] = head.ToJsonString(options) + "\n" },
2202var result = await RunHarnessAsync(new JsonObject
2206["baseFiles"] = new JsonObject { [path] = baseText },
2207["generatedPatch"] = new JsonObject { ["headFiles"] = new JsonObject { [path] = headText }, ["message"] = message },
2243var result = await RunHarnessAsync(new JsonObject
2246["workspaceFiles"] = new JsonObject { ["extension/package.json"] = PackageJsonBase, ["extension/package-lock.json"] = baseText },
2247["patchFiles"] = new JsonObject
2272baseline["packages"]![""] = new JsonObject { ["dependencies"] = new JsonObject { ["lodash"] = "^4.17.20" } };
2277baseline["packages"]!["node_modules/existing/node_modules/lodash"] = new JsonObject
2297head["packages"]!["node_modules/new/node_modules/lodash"] = new JsonObject
2307var result = await RunHarnessAsync(new JsonObject
2311["baseFiles"] = new JsonObject { [path] = baseline.ToJsonString(options) + "\n" },
2312["generatedPatch"] = new JsonObject { ["headFiles"] = new JsonObject { [path] = head.ToJsonString(options) + "\n" }, ["message"] = message },
2361var result = await RunHarnessAsync(new JsonObject
2365["baseFiles"] = new JsonObject { [path] = baseText },
2366["generatedPatch"] = new JsonObject { ["headFiles"] = new JsonObject { [path] = headText }, ["message"] = message },
2430var result = await RunHarnessAsync(new JsonObject
2434["baseFiles"] = new JsonObject { [path] = baseText },
2435["generatedPatch"] = new JsonObject { ["headFiles"] = new JsonObject { [path] = headText }, ["message"] = message },
2473var result = await RunHarnessAsync(new JsonObject
2477["baseFiles"] = new JsonObject { [path] = baseText },
2478["generatedPatch"] = new JsonObject { ["headFiles"] = new JsonObject { [path] = headText }, ["message"] = message },
2512var result = await RunHarnessAsync(new JsonObject
2516["baseFiles"] = new JsonObject { [path] = baseText },
2517["generatedPatch"] = new JsonObject { ["headFiles"] = new JsonObject { [path] = headText }, ["message"] = message },
2542var result = await RunHarnessAsync(new JsonObject
2547["patchFiles"] = new JsonObject { ["aw-auto-sec-security-updates.patch"] = patch },
2578var result = await RunHarnessAsync(new JsonObject
2583["baseFiles"] = new JsonObject { ["extension/package-lock.json"] = PublicTextBase, ["extension/package.json"] = baseText },
2584["patchFiles"] = new JsonObject { ["aw-auto-sec-security-updates.patch"] = patch },
2633var result = await RunHarnessAsync(new JsonObject
2638["patchFiles"] = new JsonObject { ["aw-auto-sec-security-updates.patch"] = patch },
2661var result = await RunHarnessAsync(new JsonObject
2666["patchFiles"] = new JsonObject { ["aw-auto-sec-security-updates.patch"] = patch },
2681var result = await RunHarnessAsync(new JsonObject
2686["patchFiles"] = new JsonObject { ["aw-auto-sec-security-updates.patch"] = PublicTextPatch.Replace("\r\n", "\n") },
2687["workFiles"] = new JsonObject { [name] = patch ? PublicTextPatch.Replace("\r\n", "\n") : "alert 42: prototype pollution" },
2729var result = await RunHarnessAsync(new JsonObject
2735["patchFiles"] = new JsonObject { ["aw-auto-sec-security-updates.patch"] = patch },
2761var result = await RunHarnessAsync(new JsonObject
2766["patchFiles"] = new JsonObject { ["aw-auto-sec-security-updates.patch"] = patch },
2806var result = await RunHarnessAsync(new JsonObject
2846var result = await RunHarnessAsync(new JsonObject
2866var result = await RunHarnessAsync(new JsonObject
2870["patchFiles"] = new JsonObject { ["aw-auto-sec-security-updates.patch"] = patch },
2872["baseFiles"] = new JsonObject { ["extension/package-lock.json"] = PublicTextBase, [path] = baseText },
2901var result = await RunHarnessAsync(new JsonObject
2905["patchFiles"] = new JsonObject { ["aw-auto-sec-security-updates.patch"] = PublicTextPatch.Replace("\r\n", "\n") },
2922var result = await RunHarnessAsync(new JsonObject
2928["patchFiles"] = new JsonObject { ["aw-auto-sec-security-updates.patch"] = PublicTextPatch.Replace("\r\n", "\n") },
2948var result = await RunHarnessAsync(new JsonObject
2952["generatedPatch"] = new JsonObject
2954["headFiles"] = new JsonObject { ["extension/package-lock.json"] = PublicTextBase.Replace("4.17.20", "4.17.21", StringComparison.Ordinal).Replace("22.0.0", "22.1.0", StringComparison.Ordinal) },
2978var result = await RunHarnessAsync(new JsonObject
2983["branchFiles"] = new JsonObject { ["extension/package-lock.json"] = PublicTextBase },
2986["patchFiles"] = new JsonObject { ["aw-auto-sec-security-updates.patch"] = patch },
3006var result = await RunHarnessAsync(new JsonObject
3012["patchFiles"] = new JsonObject { ["aw-auto-sec-security-updates.patch"] = patch },
3030var request = new JsonObject
3035["patchFiles"] = new JsonObject { ["aw-auto-sec-security-updates.patch"] = PublicTextPatch.Replace("\r\n", "\n") },
3037request[source == "workspace" ? "workspaceFiles" : "branchFiles"] = new JsonObject { ["extension/package-lock.json"] = PublicTextBase };
3059? new JsonObject { ["private advisory"] = new JsonArray("alert 42") }
3061var result = await RunHarnessAsync(new JsonObject
3066["patchFiles"] = new JsonObject { ["aw-auto-sec-security-updates.patch"] = PublicTextPatch.Replace("\r\n", "\n") },
3093var result = await RunHarnessAsync(new JsonObject
3097["patchFiles"] = new JsonObject { ["aw-auto-sec-security-updates.patch"] = PublicTextPatch.Replace("\r\n", "\n") },
3130var result = await RunHarnessAsync(new JsonObject
3135["patchFiles"] = new JsonObject { ["aw-auto-sec-security-updates.patch"] = PublicTextPatch.Replace("\r\n", "\n") },
3148"create_pull_request" => new JsonObject { ["type"] = type, ["branch"] = "auto-sec/security-updates", ["title"] = "Automated dependency updates", ["body"] = PublicTextBody.Replace("\r\n", "\n") },
3149"push_to_pull_request_branch" => new JsonObject { ["type"] = type, ["pull_request_number"] = 202, ["message"] = "Update dependencies\n\nlodash 4.17.20 -> 4.17.21\n@types/node 22.0.0 -> 22.1.0" },
3150"approve_dependabot_pr" => new JsonObject { ["type"] = type, ["pr_number"] = 101, ["head_sha"] = "0123456789abcdef0123456789abcdef01234567" },
3151"noop" => new JsonObject { ["type"] = type, ["message"] = "alerts=1 dependabot-pr=0 auto-sec-pr=1 blocked=0 code-findings-out-of-scope=0" },
3169var second = new JsonObject { ["type"] = "noop", ["message"] = "alerts=1 dependabot-pr=0 auto-sec-pr=1 blocked=0 code-findings-out-of-scope=0" }.ToJsonString();
3173second = new JsonObject { ["type"] = "noop", ["message"] = "Fixed alert 42 in lodash" }.ToJsonString();
3179second = new JsonObject { ["type"] = "approve_dependabot_pr", ["pr_number"] = 101, ["head_sha"] = "alert 42" }.ToJsonString();
3195var result = await RunHarnessAsync(new JsonObject
3199new JsonObject { ["type"] = "create_pull_request", ["branch"] = "auto-sec/security-updates", ["title"] = "Automated dependency updates", ["body"] = body }.ToJsonString(),
3201["patchFiles"] = new JsonObject { ["aw-auto-sec-security-updates.patch"] = patch },
3232var result = await RunHarnessAsync(new JsonObject
3235["ioFailure"] = new JsonObject { ["operation"] = operation, ["path"] = path },
3237["outputLines"] = new JsonArray(new JsonObject
3242["patchFiles"] = new JsonObject { ["aw-auto-sec-security-updates.patch"] = PublicTextPatch.Replace("\r\n", "\n") },
3243["workFiles"] = new JsonObject
3269var result = await RunHarnessAsync(new JsonObject
3274["stepOutputs"] = ready is null ? new JsonObject() : new JsonObject { ["publication_ready"] = ready },
3286var result = await RunHarnessAsync(new JsonObject { ["mode"] = "publication-guard", ["workflow"] = workflow });
3303var result = await RunHarnessAsync(new JsonObject
3320var unguarded = await RunHarnessAsync(new JsonObject { ["mode"] = "private-shell", ["script"] = script });
3328var result = await RunHarnessAsync(new JsonObject { ["mode"] = "publication-guard", ["workflow"] = workflow });
3332var quiet = await RunHarnessAsync(new JsonObject
3348var result = await RunHarnessAsync(new JsonObject { ["mode"] = "publication-guard", ["workflow"] = PublicationGuardFixture });
3369var original = await RunHarnessAsync(new JsonObject { ["mode"] = "private-shell", ["script"] = script });
3376var result = await RunHarnessAsync(new JsonObject { ["mode"] = "publication-guard", ["workflow"] = workflow });
3379var quiet = await RunHarnessAsync(new JsonObject
3402var result = await RunHarnessAsync(new JsonObject { ["mode"] = "publication-guard", ["workflow"] = workflow });
3430var result = await RunHarnessAsync(new JsonObject { ["mode"] = "publication-guard", ["workflow"] = workflow });
3446var result = await RunHarnessAsync(new JsonObject { ["mode"] = "publication-guard", ["workflow"] = workflow });
3473var result = await RunHarnessAsync(new JsonObject { ["mode"] = "publication-guard", ["workflow"] = workflow });
3534var result = await RunHarnessAsync(new JsonObject { ["mode"] = "publication-guard", ["workflow"] = workflow });
3725var result = await RunHarnessAsync(new JsonObject
3748var result = await RunHarnessAsync(new JsonObject
3767var result = await RunHarnessAsync(new JsonObject
3770["patchFiles"] = new JsonObject { ["aw-test.patch"] = ReplacementPatch("uv.lock", baseText, source, $"source = {{ {kind} = \"../pkg\" }}") },
3771["workspaceFiles"] = new JsonObject { ["uv.lock"] = baseText },
3792var result = await RunHarnessAsync(new JsonObject
3829var result = await RunHarnessAsync(new JsonObject
3872var result = await RunHarnessAsync(new JsonObject
3889scenario["responses"]!["https://registry.npmjs.org/minimist"] = Response(new JsonObject { ["time"] = new JsonObject { ["1.2.8"] = "2026-09-01T00:00:00Z" } });
3890scenario["responses"]!["https://registry.npmjs.org/left-pad"] = Response(new JsonObject { ["time"] = new JsonObject { ["1.3.0"] = "2026-09-01T00:00:00Z" } });
3905scenario["alerts"]!.AsArray().Add(new JsonObject
3929scenario["responses"]!["https://registry.npmjs.org/minimist"] = Response(new JsonObject { ["time"] = new JsonObject { ["1.2.8"] = "2026-09-01T00:00:00Z" } });
3930scenario["alerts"]!.AsArray().Add(new JsonObject
3976scenario["alerts"]!.AsArray().Add(new JsonObject
3998var overrides = new JsonObject();
4001items.Add(new JsonObject { ["type"] = "approve_dependabot_pr", ["pr_number"] = number, ["head_sha"] = HeadSha });
4004overrides[number.ToString(System.Globalization.CultureInfo.InvariantCulture)] = new JsonObject { ["user_login"] = "someone" };
4029items.Add(new JsonObject { ["type"] = "approve_dependabot_pr", ["pr_number"] = number, ["head_sha"] = HeadSha });
4068var result = await RunHarnessAsync(new JsonObject
4082var result = await RunHarnessAsync(new JsonObject
4129var result = await RunHarnessAsync(new JsonObject
4144new JsonObject { ["number"] = 1, ["ecosystem"] = "npm", ["package"] = "lodash", ["manifest_path"] = "app/yarn.lock", ["first_patched_version"] = "4.17.21", ["malware"] = false },
4145new JsonObject { ["number"] = 2, ["ecosystem"] = "npm", ["package"] = "lodash", ["manifest_path"] = "other/yarn.lock", ["first_patched_version"] = "4.17.21", ["malware"] = false },
4146new JsonObject { ["number"] = 3, ["ecosystem"] = "npm", ["package"] = "lodash", ["manifest_path"] = "app/yarn.lock", ["first_patched_version"] = "4.17.22", ["malware"] = false },
4147new JsonObject { ["number"] = 4, ["ecosystem"] = "npm", ["package"] = "lodash", ["manifest_path"] = "app/yarn.lock", ["first_patched_version"] = null, ["malware"] = true, ["vulnerable_ranges"] = new JsonArray(">= 4.17.20, < 4.17.21") },
4150new JsonObject { ["number"] = 12, ["ecosystem"] = "npm", ["package"] = "lodash", ["manifest_path"] = "app/yarn.lock", ["first_patched_version"] = null, ["malware"] = true, ["vulnerable_ranges"] = new JsonArray(">= 0") },
4151new JsonObject { ["number"] = 13, ["ecosystem"] = "npm", ["package"] = "lodash", ["manifest_path"] = "app/yarn.lock", ["first_patched_version"] = null, ["malware"] = true },
4152new JsonObject { ["number"] = 5, ["ecosystem"] = "pip", ["package"] = "lodash", ["manifest_path"] = "app/uv.lock", ["first_patched_version"] = "4.17.21", ["malware"] = false },
4153new JsonObject { ["number"] = 6, ["ecosystem"] = "npm", ["package"] = "lodash", ["manifest_path"] = "nested/yarn.lock", ["first_patched_version"] = "4.17.21", ["malware"] = false },
4154new JsonObject { ["number"] = 8, ["ecosystem"] = "npm", ["package"] = "lodash", ["manifest_path"] = "nested/yarn.lock", ["first_patched_version"] = null, ["malware"] = true },
4156new JsonObject { ["number"] = 9, ["ecosystem"] = "npm", ["package"] = "minimist", ["manifest_path"] = "app/yarn.lock", ["first_patched_version"] = "1.2.6", ["malware"] = false },
4158new JsonObject { ["number"] = 10, ["ecosystem"] = "npm", ["package"] = "left-pad", ["manifest_path"] = "app/yarn.lock", ["first_patched_version"] = "1.3.1", ["malware"] = false },
4160new JsonObject { ["number"] = 11, ["ecosystem"] = "npm", ["package"] = "left-pad", ["manifest_path"] = "other/yarn.lock", ["first_patched_version"] = "1.3.1", ["malware"] = false });
4161var updates = new JsonArray(new JsonObject { ["name"] = "lodash", ["from"] = "4.17.20", ["to"] = "4.17.21" });
4162var versionChanges = new JsonArray(new JsonObject { ["name"] = "minimist", ["from"] = new JsonArray("1.2.5"), ["to"] = "1.2.8" });
4163var headContents = new JsonObject
4170var baseContents = new JsonObject
4177var result = await RunHarnessAsync(new JsonObject
4196new JsonObject { ["number"] = 1, ["ecosystem"] = "npm", ["package"] = "left-pad", ["manifest_path"] = "app/package-lock.json", ["first_patched_version"] = "1.3.1", ["malware"] = false });
4197var baseContents = new JsonObject
4202var result = await RunHarnessAsync(new JsonObject
4206["args"] = new JsonArray(alerts, "npm", new JsonArray(), new JsonArray(), new JsonObject { ["app/package-lock.json"] = headText }, baseContents),
4216var result = await RunHarnessAsync(new JsonObject
4224["responses"] = new JsonObject
4226["https://api.nuget.org/v3/registration5-gz-semver2/system.text.json/9.0.5.json"] = Response(new JsonObject { ["published"] = "2026-08-01T00:00:00Z" }),
4228["https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/flat2/system.text.json/index.json"] = Response(new JsonObject { ["versions"] = new JsonArray("9.0.4", "9.0.5") }),
4258var responses = new JsonObject
4260["https://api.nuget.org/v3/registration5-gz-semver2/contoso.build.engine/1.0.0.json"] = Response(new JsonObject { ["published"] = "2026-08-01T00:00:00Z" }),
4262[$"{transportFlat}contoso.build.engine/index.json"] = Response(new JsonObject { ["versions"] = new JsonArray("1.0.0") }),
4284static JsonObject NuGetLookup(string name, string config, JsonObject responses) => new()
4303var leaf = new JsonObject { ["published"] = published };
4308var result = await RunHarnessAsync(new JsonObject
4315["responses"] = new JsonObject { ["https://api.nuget.org/v3/registration5-gz-semver2/contoso.lib/1.2.3.json"] = Response(leaf) },
4325var nuget = await RunHarnessAsync(new JsonObject
4333["responses"] = new JsonObject
4335["https://api.nuget.org/v3/registration5-gz-semver2/contoso.lib/1.2.3.json"] = Response(new JsonObject { ["published"] = "2026-08-01T00:00:00Z" }),
4338var npm = await RunHarnessAsync(new JsonObject
4345["responses"] = new JsonObject
4347["https://registry.npmjs.org/@scope%2Fpkg"] = Response(new JsonObject { ["time"] = new JsonObject { ["1.0.1"] = "2026-09-29T00:00:00Z" } }),
4348["https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/@scope%2Fpkg"] = Response(new JsonObject { ["versions"] = new JsonObject { ["1.0.1"] = new JsonObject() } }),
4362var pip = await RunHarnessAsync(new JsonObject
4369["responses"] = new JsonObject
4371["https://pypi.org/pypi/requests/2.32.3/json"] = Response(new JsonObject
4374new JsonObject { ["upload_time_iso_8601"] = "2026-09-29T00:00:00Z" },
4375new JsonObject { ["upload_time_iso_8601"] = "2026-08-01T00:00:00Z" }),
4388var result = await RunHarnessAsync(CreatePushGateScenario(new JsonObject()));
4393var noPush = await RunHarnessAsync(new JsonObject
4396["agentItems"] = new JsonArray(new JsonObject { ["type"] = "create_pull_request" }),
4426var closed = new JsonObject
4429["user"] = new JsonObject { ["login"] = "aspire-repo-bot[bot]" },
4430["head"] = new JsonObject
4434["repo"] = new JsonObject { ["full_name"] = "microsoft/aspire" },
4436["base"] = new JsonObject { ["ref"] = "main" },
4438["labels"] = new JsonArray(new JsonObject { ["name"] = "auto-sec" }),
4440var scenario = new JsonObject
4443["agentItems"] = new JsonArray(new JsonObject { ["type"] = "create_pull_request", ["branch"] = "auto-sec/security-updates" }),
4444["branch"] = new JsonObject { ["commit"] = new JsonObject { ["sha"] = HeadSha } },
4450case "open-pr": scenario["openPrs"] = new JsonArray(new JsonObject { ["state"] = "open", ["user"] = new JsonObject { ["login"] = "someone" } }); break;
4497var pr = new JsonObject();
4498var item = new JsonObject { ["type"] = "push_to_pull_request_branch", ["pull_request_number"] = 202 };
4536var scenario = CreatePushGateScenario(new JsonObject { ["user_login"] = author });
4635var pr = new JsonObject
4649return new JsonObject
4653["agentItems"] = new JsonArray(item ?? new JsonObject { ["type"] = "push_to_pull_request_branch", ["pull_request_number"] = 202 }),
4657private static JsonObject Response(JsonNode body) => new() { ["status"] = 200, ["body"] = body };
4670private static JsonObject ServiceIndex(string flatContainer) => Response(new JsonObject
4672["resources"] = new JsonArray(new JsonObject { ["@id"] = flatContainer, ["@type"] = "PackageBaseAddress/3.0.0" }),
4675private static JsonObject CreateCollectionScenario() => new()
4678["prs"] = new JsonArray(new JsonObject
4687["statusCheckRollup"] = new JsonArray(new JsonObject { ["conclusion"] = "SUCCESS" }),
4690new JsonArray(new JsonObject { ["filename"] = "README.md", ["status"] = "modified" }),
4691new JsonArray(new JsonObject { ["filename"] = "extension/yarn.lock", ["status"] = "modified" })),
4692["contents"] = new JsonObject
4697["alerts"] = new JsonArray(new JsonObject
4720var result = await RunHarnessAsync(new JsonObject
4740private static JsonObject CreateApprovalScenario() => new()
4745["agentItems"] = new JsonArray(new JsonObject { ["type"] = "approve_dependabot_pr", ["pr_number"] = 101, ["head_sha"] = HeadSha }),
4746["pr"] = new JsonObject
4756["contents"] = new JsonObject
4763["alerts"] = new JsonArray(new JsonObject
4772["checkRuns"] = new JsonArray(new JsonObject { ["name"] = "ci", ["status"] = "completed", ["conclusion"] = "success" }),
4775["responses"] = new JsonObject
4777["https://registry.npmjs.org/lodash"] = Response(new JsonObject { ["time"] = new JsonObject { ["4.17.21"] = "2026-09-01T00:00:00Z" } }),
4785request["baseFiles"] ??= new JsonObject
Microsoft.AspNetCore.OpenApi (23)
Microsoft.Extensions.AI (4)
Microsoft.Extensions.AI.Abstractions (9)
Microsoft.Extensions.AI.Abstractions.Tests (2)
Microsoft.Extensions.AI.Evaluation.Quality (1)
Microsoft.Extensions.AI.Evaluation.Safety (13)
Microsoft.NET.Build.Containers (9)
Microsoft.NET.Build.Tasks (4)
Microsoft.NETCore.Platforms (1)
Microsoft.TemplateEngine.Cli (3)
Microsoft.TemplateEngine.Orchestrator.RunnableProjects (1)
MSBuild (8)
NativeIntegrations.DockerCompose (55)
ComposeModels.cs (15)
25var result = new JsonObject();
32result["build"] = new JsonObject { ["context"] = Build.Context, ["dockerfile"] = Build.Dockerfile };
42var exposure = new JsonObject { ["endpoint"] = port.Endpoint, ["hostIp"] = port.HostIp };
145(Model["volumes"] ??= new JsonArray()).AsArray().Add(new JsonObject
192var service = new JsonObject { ["image"] = ComposeJson.Literal(image), ["labels"] = new JsonObject() };
195service["environment"] = new JsonObject(environment.Select(pair =>
206var volume = new JsonObject();
213volume["labels"] = new JsonObject(labels.Select(pair =>
218public void AddConfig(string name, string content) => Add("configs", name, new() { ["content"] = ComposeJson.Literal(content) });
221var secret = new JsonObject { ["external"] = true };
231(Model[collection] ??= new JsonObject()).AsObject()[name] = value;
314return new() { ["context"] = Literal(context), ["dockerfile"] = Literal(dockerfile) };
323var result = new JsonObject { ["test"] = Strings(value.Test.Select(part => escape ? Literal(Text(part, true)) : Text(part, true))) };
351JsonObject obj => new JsonObject(obj.Select(pair => KeyValuePair.Create(pair.Key, EscapeNode(pair.Value)))),
DockerComposeGenerator.cs (34)
102var inputs = new JsonObject
104["schemaVersion"] = 1, ["projectName"] = project, ["parameters"] = new JsonArray(), ["variables"] = new JsonObject()
108var compose = new JsonObject { ["name"] = project, ["services"] = new JsonObject() };
132var service = new JsonObject
134["image"] = ComposeJson.Literal(image ?? ""), ["labels"] = new JsonObject { ["aspire.resource"] = ComposeJson.Literal(resourceName) }
181service["environment"] = new JsonObject(serviceEnvironment);
192var exposure = new JsonObject { ["endpoint"] = Text(endpoint, "name") };
211var value = new JsonObject { ["target"] = exposure.Target };
234var captured = (inputs["environment"] ??= new JsonObject()).AsObject();
239captured[variable] = new JsonObject
254volumes[key] = new JsonObject();
262return (JsonNode)new JsonObject
271service["depends_on"] = new JsonObject(dependencies.Select(dependency =>
272KeyValuePair.Create(names[dependency], (JsonNode?)new JsonObject
286compose["volumes"] = new JsonObject(volumes);
288inputs["parameters"] = new JsonArray(used.Select(parameter => (JsonNode)new JsonObject
316return new() { ["kind"] = "literal", ["value"] = ComposeJson.Text(Text(value, "value"), true) };
325return new() { ["kind"] = "parameter", ["name"] = parameter };
329return new() { ["kind"] = "endpoint", ["resource"] = Text(value, "resource"), ["endpoint"] = Text(value, "endpoint"), ["property"] = Text(value, "property") };
331return new() { ["kind"] = "composite", ["parts"] = new JsonArray(Objects(value["parts"]).Select(part => (JsonNode)Normalize(part, depth + 1)).ToArray()) };
333return new() { ["kind"] = "uriEncoded", ["value"] = Normalize(value["value"]!.AsObject(), depth + 1) };
408var captured = (plan.Inputs["environment"] ??= new JsonObject()).AsObject();
414var entry = new JsonObject { ["description"] = $"Deployment parameter {name}", ["secret"] = secret };
426var configuration = source is null ? new JsonObject
451plan.Compose["networks"] = new JsonObject { ["default"] = new JsonObject
472var variables = new JsonObject
482var dashboard = new JsonObject
485["labels"] = new JsonObject { ["aspire.resource"] = resourceName }, ["environment"] = variables,
490dashboard["ports"] = new JsonArray(new JsonObject
501var captured = (plan.Inputs["environment"] ??= new JsonObject()).AsObject();
506captured[variable] = new JsonObject { ["description"] = description, ["secret"] = true };
514var options = resource["configuration"]?["publish.dockerCompose"] is { } source ? JsonNode.Parse(source.GetValue<string>())!.AsObject() : new JsonObject();
NuGet.Protocol (10)
SelectTests (5)
ServiceBus.AppHost (1)
Shared.Tests (1)
Stress.ApiService (1)
System.Text.Json (10)
TestProject.AppHost (3)
2503 references to JsonObject
AnalyzeCiFailure (98)
AnalysisPublisher.cs (34)
100File.Exists(storedRunPath) ? Read(storedRunPath) as JsonObject : null);
104var record = (JsonObject)Read(runPath)!;
132var occurrence = CreateOccurrence(analysis, cause, runId, _observedAt);
133JsonObject? existing = null;
137existing = Read(path) as JsonObject ?? throw new ValidationException($"Stored cause is not readable: {cause.FileName}");
160var definition = existing ?? (JsonObject?)ToNode(cause.Definition)
162var history = MergeCause(definition, existing, occurrence);
169private async Task<Dictionary<string, JsonObject?>> ResolveDestinationsAsync(List<PreparedCause> prepared)
172var destinations = new Dictionary<string, JsonObject?>(StringComparer.Ordinal);
175JsonObject? issue = null;
180issue = await _github.GetAsync($"repos/{_repository}/issues/{linked.Split('/')[^1]}") as JsonObject;
189issue = issueInventory.OfType<JsonObject>().Where(i => MatchesIssue(i, cause))
196issue = await _github.GetAsync($"repos/{_repository}/issues/{number}") as JsonObject;
230var storedRun = File.Exists(runPath) ? Read(runPath) as JsonObject : null;
231var record = (JsonObject)ToNode(RunSummaryBuilder.Create(analysis.Report, analysis.Evidence, evidence, _observedAt))!;
249Dictionary<string, JsonObject?> destinations)
253var issue = destinations[cause.Id];
277var request = new JsonObject();
349JsonObject history,
350JsonObject? issue,
414internal static JsonObject MergeCause(JsonObject definition, JsonObject? existing, JsonObject occurrence)
416var history = (JsonObject)(existing ?? definition).DeepClone();
430internal static JsonObject CreateOccurrence(ValidatedAnalysis analysis, FailureCause cause, JsonNode runId, string observedAt)
471return (JsonObject)ToNode(occurrence)!;
474private static bool MatchesIssue(JsonObject issue, FailureCause cause)
634private sealed record PreparedCause(FailureCause Cause, JsonObject History, string Path, bool Replayed);
BranchHistoryReader.cs (15)
18public async Task<JsonObject> FindLastSuccessfulRunAsync(string workflowId, string failedTime, long failedId)
33var found = await FindLastSuccessfulRunInWindowAsync(start, end, workflowId, failedTime, failedId);
45private async Task<JsonObject> FindLastSuccessfulRunInWindowAsync(long start, long end, string workflowId, string failedTime, long failedId)
53static bool HasValidWorkflowRunRows(JsonNode? page) => page is JsonObject && Field(page, "workflow_runs") is JsonArray rows &&
54rows.All(run => run is JsonObject && GitHubJson.TryReadId(Field(run, "id"), out _) &&
76var newer = await FindLastSuccessfulRunInWindowAsync(midpoint, end, workflowId, failedTime, failedId);
106return newest is JsonObject result ? (JsonObject)result.DeepClone() : [];
128array.Any(p => p is not JsonObject || Field(p, "commits") is not JsonArray) ||
130c is not JsonObject || Text(c["sha"]) is not { Length: > 0 } ||
131c["commit"] is not JsonObject || Text(Field(c["commit"], "message")) is null || Text(c["html_url"]) is null))
146JsonObject[] prs;
163var pr = prs[0];
182public JsonObject[] FindMergedPullRequests(JsonArray candidates)
183=> candidates.OfType<JsonObject>().Where(pr => Text(Field(Field(pr["base"], "repo"), "full_name")) == repository &&
AnalyzeCiFailure.TestHost (4)
AnalyzeCiFailure.Tests (53)
AnalyzeCiFailurePublicationTests.cs (12)
205var issue = new JsonObject
223JsonObject? history = storedLink
391var history = storedLink ? JsonNode.Parse("""
612var history = new JsonObject
879JsonObject? history = null,
1065private static JsonObject CreateTrustedOccurrence(string scope, string prNumbers, string job)
1336var definition = JsonNode.Parse("""{"id":"timeout","type":"flaky-test","title":"New title"}""")!.AsObject();
1337var existing = JsonNode.Parse(
1339var occurrence = JsonNode.Parse(
1342var merged = AnalyzeCiFailure.AnalysisPublisher.MergeCause(definition, existing, occurrence);
1368var occurrence = AnalyzeCiFailure.AnalysisPublisher.CreateOccurrence(collected, Assert.Single(collected.Causes), JsonValue.Create(value: 123)!, "2026-10-21T01:00:00Z");
1377var projection = new JsonObject
aspire (311)
Agents\AspireSkills\AspireSkillsRemoteConfiguration.cs (27)
50public static void ApplyOpenCodeCatalog(JsonObject root, IEnumerable<JsonObject> configs, IReadOnlyList<SkillSource> skillSources)
64foreach (var config in settings)
91public static bool HasOpenCodeCatalog(JsonObject root, IReadOnlyList<SkillSource> sources)
96internal static JsonArray? ReadOpenCodeSkills(JsonObject root)
103if (skills is JsonObject v1)
142JsonObject root, IEnumerable<string> settingsPaths, string targetPath,
151foreach (var config in settings.Append(root))
167private static void ApplyPlugin(JsonObject root, IReadOnlyList<JsonObject> settings, SkillSource skillSource)
171JsonObject? selectedSource = null;
172foreach (var config in settings.Append(root))
174var plugins = OptionalObject(config, "enabledPlugins");
183var marketplaces = OptionalObject(config, "extraKnownMarketplaces");
187var source = OptionalObject(marketplaceNode.AsObject(), "source");
214var targetMarketplaces = Object(root, "extraKnownMarketplaces");
225var targetPlugins = Object(root, "enabledPlugins");
235public static async Task<IReadOnlyList<JsonObject>> ReadSettingsAsync(
238var settings = new List<JsonObject>();
251public static JsonObject? OptionalObject(JsonObject parent, string key)
262public static JsonObject Object(JsonObject parent, string key)
264var value = OptionalObject(parent, key);
274public static JsonArray? OptionalStrings(JsonObject parent, string key)
299public static bool? Boolean(JsonObject parent, string key)
313private static bool IsMatchingSource(JsonObject source, SkillSource configuration)
Agents\OpenCode\OpenCodeAgentClient.cs (16)
73var config = AgentConfiguration.ReadObject(path);
95private IEnumerable<string> GetConfiguredSkillDirectories(JsonObject config)
106var paths = skills is JsonObject v1
132public async Task<(JsonObject Config, string Path)> ReadMcpConfigAsync(
136var config = await McpConfigFileHelper.ReadConfigAsync(configFilePath, s_mcp.JsonDocumentOptions, edit, cancellationToken);
150var candidateConfig = StringComparers.FileSystemPath.Equals(candidate, configFilePath)
164server is not JsonObject aspire ||
179JsonObject config, string configFilePath, bool configureServer, AgentConfigurationScope scope)
182var root = native ? config["mcp"]!.AsObject() : config;
201private static (JsonObject? Servers, bool Native) GetMcpServerContainer(JsonObject root, string path)
203var mcp = McpConfigFileHelper.GetServerContainer(root, s_mcp.ServersPropertyName, path);
210var legacyServer = servers is JsonObject server &&
215if (servers is not JsonObject native)
257JsonObject config, DirectoryInfo workspaceRoot, AgentConfigurationScope scope,
269var inlineConfig = AgentConfiguration.ParseObject(inline);
Configuration\ConfigSourceService.cs (18)
242var configuration = await ReadProjectConfigurationAsync(path, cancellationToken);
263var configuration = await ReadProjectConfigurationAsync(path, cancellationToken);
290var configuration = await ReadConfigurationFileAsync(path, cancellationToken) ?? new JsonObject();
304internal async Task<JsonObject> GetTemplateSourcesAsync(CancellationToken cancellationToken)
329internal async Task<JsonObject> GetTemplateSourcesAsync(ConfigSource source, CancellationToken cancellationToken)
337var sources = new JsonObject();
344if (value is not JsonObject section)
376var configuration = await ReadConfigurationFileAsync(path, cancellationToken) ?? new JsonObject();
504private async Task<JsonObject?> ReadProjectConfigurationAsync(string configPath, CancellationToken cancellationToken)
511private static async Task<JsonObject?> ReadConfigurationFileAsync(string path, CancellationToken cancellationToken)
518var configuration = JsonNode.Parse(await File.ReadAllTextAsync(path, cancellationToken),
519documentOptions: ConfigurationHelper.ParseOptions) as JsonObject
528private static ConfigSource? ReadBinding(JsonObject? config)
708private async Task<(string Commit, string Version, JsonObject Configuration)> AcquireRepositoryAsync(
721var configuration = JsonNode.Parse(json, documentOptions: ConfigurationHelper.ParseOptions) as JsonObject
830var json = JsonSerializer.SerializeToNode(metadata, JsonSourceGenerationContext.Default.ConfigSourceCheckMetadata)!.AsObject();
875private static string GetKey(JsonObject configuration, string key)
Configuration\ConfigurationService.cs (13)
38JsonObject settings;
92var settings = JsonNode.Parse(existingContent, nodeOptions: null, ConfigurationHelper.ParseOptions)?.AsObject();
215var settings = JsonNode.Parse(content, nodeOptions: null, ConfigurationHelper.ParseOptions)?.AsObject();
233private static void SetNestedValue(JsonObject settings, KeyPart[] keyParts, string key, string value)
258else if (child is not JsonObject and not JsonArray)
274private static void RemoveConflictingFlattenedKeys(JsonObject settings, string[] keyParts)
289if (settings.ContainsKey(partialKey) && settings[partialKey] is not JsonObject)
303if (current is not JsonObject and not JsonArray)
332if (child is JsonObject { Count: 0 } && current is JsonObject parent)
343private static void FlattenJsonObject(JsonObject obj, Dictionary<string, string> result, string prefix)
357if (value is JsonObject { Count: > 0 } obj)
509if (node is not JsonObject)
Scaffolding\PackageJsonMerger.cs (30)
58JsonObject? existingJson;
59JsonObject? scaffoldJson;
62existingJson = JsonNode.Parse(existingContent, documentOptions: s_jsonDocumentOptions) as JsonObject;
63scaffoldJson = JsonNode.Parse(scaffoldContent, documentOptions: s_jsonDocumentOptions) as JsonObject;
94private static void MergeObjects(JsonObject existing, JsonObject scaffold, ILogger logger, string toolchainCommand)
97var scaffoldScripts = scaffold[ScriptsKey]?.AsObject();
100var existingScripts = EnsureObject(existing, ScriptsKey, logger);
130else if (targetValue is JsonObject targetObj && sourceValue is JsonObject sourceObj)
151internal static void MergeScripts(JsonObject existingScripts, JsonObject scaffoldScripts, string toolchainCommand = "npm")
184private static void AddConvenienceAliases(JsonObject scripts, string toolchainCommand)
220private static void MergeDependencySection(JsonObject existing, JsonObject scaffold, string sectionName, ILogger logger)
222var scaffoldDeps = scaffold[sectionName]?.AsObject();
228var existingDeps = EnsureObject(existing, sectionName, logger);
262private static bool TryMergeExistingDependency(JsonObject existing, string sectionName, string packageName, string desiredVersion)
264if (existing[sectionName] is not JsonObject existingDeps)
291private static void MergeEngines(JsonObject existing, JsonObject scaffold, ILogger logger)
293var scaffoldEngines = scaffold[EnginesKey]?.AsObject();
299var existingEngines = EnsureObject(existing, EnginesKey, logger);
325internal static void DeepMerge(JsonObject target, JsonObject source)
340else if (targetValue is JsonObject targetObj && sourceValue is JsonObject sourceObj)
348private static JsonObject EnsureObject(JsonObject parent, string propertyName, ILogger logger)
350if (parent[propertyName] is JsonObject obj)
Scaffolding\ScaffoldingService.cs (12)
327JsonObject packageJson;
330packageJson = JsonNode.Parse(existingContent, documentOptions: s_scaffoldJsonDocumentOptions) as JsonObject
340var scripts = EnsureJsonObject(packageJson, "scripts");
355internal static IReadOnlyList<string> AddRootTypeScriptAppHostDelegateScripts(JsonObject scripts, TypeScriptAppHostToolchain toolchain, string relativeAppHostDirectory)
366internal static IReadOnlyList<string> AddRootTypeScriptAppHostDelegateScripts(JsonObject scripts, DirectoryInfo appHostDirectory, string relativeAppHostDirectory, IEnvironment environment, ILogger? logger)
372internal static string SerializePackageJson(JsonObject packageJson, string existingContent)
402private static JsonObject EnsureJsonObject(JsonObject parent, string propertyName)
404if (parent[propertyName] is JsonObject obj)
429private static void AddRootTypeScriptAppHostDelegateScript(JsonObject scripts, TypeScriptAppHostToolchain toolchain, string relativeAppHostDirectory, string scriptName, ref List<string>? preservedScriptNames)
726private static JsonObject? ParseJsonC(string content)
730return JsonNode.Parse(content, documentOptions: s_scaffoldJsonDocumentOptions) as JsonObject;
Utils\ConfigurationHelper.cs (17)
241if (node is not JsonObject)
320internal static async Task WriteSettingsFileAsync(string filePath, JsonObject settings, CancellationToken cancellationToken = default)
329string filePath, JsonObject settings, CancellationToken cancellationToken,
604internal static void WriteSettingsFile(string filePath, JsonObject settings)
621private static JsonObject? AddSettingsFile(IConfigurationBuilder configuration, string filePath, bool persistNormalization)
638if (!persistNormalization && node is JsonObject settings)
650return node as JsonObject;
678var settings = JsonNode.Parse(content, documentOptions: ParseOptions)?.AsObject();
695internal static bool NormalizeSettings(JsonObject settings)
717var keyLookups = new Dictionary<JsonObject, Dictionary<string, string>>(ReferenceEqualityComparer.Instance);
718string GetKey(JsonObject obj, string key)
743void IndexProperties(JsonObject obj, string? prefix)
753if (property.Value is JsonObject section)
768var parent = settings;
778if (child is not JsonObject section)
798if (value is JsonObject section)
808private readonly record struct SettingsProperty(JsonObject Parent, string Key);
Aspire.Cli.EndToEnd.Tests (63)
Aspire.Cli.Tests (267)
Aspire.Dashboard (22)
Aspire.Dashboard.Tests (10)
Aspire.Hosting (187)
Pipelines\Internal\DeploymentStateManagerBase.cs (19)
37private JsonObject? _state;
56JsonObject state,
58JsonObject? originalSectionData,
64protected virtual JsonNode? GetSectionState(JsonObject? state, string sectionName, bool includeLegacyState) =>
72protected async Task<JsonObject> LoadStateAsync(CancellationToken cancellationToken = default)
96protected virtual Task<JsonObject> LoadStateFromStorageAsync(CancellationToken cancellationToken = default) =>
102protected static async Task<JsonObject> LoadStateFileAsync(string? statePath, CancellationToken cancellationToken)
113protected static JsonObject LoadStateFile(string? statePath)
121private static JsonObject ParseStateFile(string? fileContent)
134if (JsonNode.Parse(fileContent, documentOptions: jsonDocumentOptions) is not JsonObject flattenedState)
143public async Task SaveStateAsync(JsonObject state, CancellationToken cancellationToken = default)
187JsonObject? data = null;
191if (sectionData is JsonObject o)
222protected static JsonNode? TryGetNestedPropertyValue(JsonObject? node, string path)
234if (current is not JsonObject currentObj || !currentObj.TryGetPropertyValue(segment, out var nextNode))
324protected static void SetNestedPropertyValue(JsonObject root, string path, JsonObject? value)
328var current = root;
332if (!current.TryGetPropertyValue(segment, out var nextNode) || nextNode is not JsonObject nextObj)
Pipelines\Internal\FileDeploymentStateManager.cs (68)
30private JsonObject _currentState = [];
31private JsonObject _legacyState = [];
32private JsonObject _legacyStateSnapshot = [];
88internal static async Task<JsonObject> LoadEffectiveStateAsync(
93JsonObject currentState;
116JsonObject legacyState = [];
138var effectiveState = MergeState(MergeState(legacyStateSnapshot, legacyState), currentState);
144internal static JsonObject LoadEffectiveState(string canonicalStatePath, string? legacyStatePath)
146JsonObject currentState;
168JsonObject legacyState = [];
187var effectiveState = MergeState(MergeState(legacyStateSnapshot, legacyState), currentState);
227protected override async Task<JsonObject> LoadStateFromStorageAsync(CancellationToken cancellationToken = default)
268protected override JsonNode? GetSectionState(JsonObject? state, string sectionName, bool includeLegacyState)
286if (mergedSection is not JsonObject mergedObject)
305JsonObject state,
307JsonObject? originalSectionData,
346var sectionData = TryGetNestedPropertyValue(state, sectionName) as JsonObject;
348var latestEffectiveState = MergeState(GetLegacyFallbackState(), _currentState);
350var latestSectionData = NormalizeSectionData(
352var desiredSectionData = ApplyChanges(latestSectionData, originalSectionData, sectionData) as JsonObject;
378private static JsonObject? NormalizeSectionData(JsonNode? sectionData) =>
381JsonObject sectionObject => sectionObject,
428private static JsonObject MergeState(JsonObject legacyState, JsonObject currentState)
430var mergedState = legacyState.DeepClone().AsObject();
434static void MergeInto(JsonObject target, JsonObject source)
438if (sourceValue is JsonObject sourceObject &&
439target[name] is JsonObject targetObject)
451private JsonObject GetLegacyFallbackState() =>
454private static async Task WriteStateAsync(string statePath, JsonObject state, CancellationToken cancellationToken)
456var flattenedSecrets = JsonFlattener.FlattenJsonObject(state);
497JsonObject currentState,
517if (baseline is JsonObject baselineObject && value is JsonObject valueObject)
547if (originalValue is JsonObject originalObject &&
548savedValue is JsonObject savedObject &&
551(latestValue is not JsonObject latestObject || !IsScalarSectionData(latestObject)))
553var result = latestValue?.DeepClone() as JsonObject ?? [];
597if (savedValue is JsonObject savedObject &&
598(originalValue is JsonObject || !originalExists) &&
600(originalValue is not JsonObject originalObject || !IsScalarSectionData(originalObject)) &&
601(latestValue is not JsonObject latestObject || !IsScalarSectionData(latestObject)))
603return (true, ApplyChanges(latestValue, originalValue as JsonObject ?? [], savedObject));
612private static bool IsScalarSectionData(JsonObject value) => value.ContainsKey(string.Empty);
618JsonObject effectiveState,
619JsonObject currentState,
639private static bool NestedPropertyExists(JsonObject root, string path)
642JsonObject current = root;
646nextNode is not JsonObject nextObject)
657private static void SetNestedNodeValue(JsonObject root, string path, JsonNode? value, bool valueExists)
660var current = root;
664if (!current.TryGetPropertyValue(segment, out var nextNode) || nextNode is not JsonObject nextObject)
702var legacyStateSnapshot = migrationState.LegacyStateSnapshot;
731var migrationState = await LoadStateFileAsync(migrationStatePath, cancellationToken).ConfigureAwait(false);
743private static MigrationState ParseMigrationState(JsonObject migrationState)
746var legacyStateSnapshot = migrationState[LegacyStateProperty] switch
749JsonObject legacyState => legacyState,
758var currentState = migrationState[CurrentStateProperty] switch
794JsonObject currentState,
795JsonObject legacyStateSnapshot,
800var migrationState = new JsonObject
814JsonObject LegacyStateSnapshot,
816JsonObject? CurrentState);
Aspire.Hosting.Azure (64)
AzureProvisioningController.cs (17)
2527var json = await CreateCommandResultJsonAsync(commandName, resourceName: null, cancellationToken).ConfigureAwait(false);
2548var json = await CreateCommandResultJsonAsync(DeleteAzureResourcesCommandName, resourceName: null, cancellationToken).ConfigureAwait(false);
2567var json = await CreateResourceCommandResultJsonAsync(DeleteAzureResourceCommandName, model, resourceName, cancellationToken).ConfigureAwait(false);
2579private async Task<JsonObject> CreateResourceCommandResultJsonAsync(string commandName, DistributedApplicationModel model, string resourceName, CancellationToken cancellationToken)
2581var json = await CreateCommandResultJsonAsync(commandName, resourceName, cancellationToken).ConfigureAwait(false);
2602var json = await CreateCommandResultJsonAsync(GetAzureResourceCommandName, resourceName, cancellationToken).ConfigureAwait(false);
2614var deployment = await CreateCachedDeploymentStateInfoAsync(bicepResource, context, cancellationToken).ConfigureAwait(false);
2625private async Task<JsonObject> CreateCachedDeploymentStateInfoAsync(AzureBicepResource resource, AzureContextState context, CancellationToken cancellationToken)
2636var json = new JsonObject
2668private async Task<JsonObject> CreateLiveResourceInfoAsync(string? resourceId, AzureContextState context, CancellationToken cancellationToken)
2672var json = new JsonObject
2776if (outputs is not JsonObject outputsObject ||
2778outputNode is not JsonObject outputObject ||
2787private async Task<JsonObject> CreateCommandResultJsonAsync(string commandName, string? resourceName, CancellationToken cancellationToken)
2793var json = new JsonObject
2827private static CommandResultData CreateJsonResultData(JsonObject json, bool displayImmediately = false) =>
2847var json = new JsonObject
Provisioning\BicepUtilities.cs (7)
40public static async Task SetParametersAsync(JsonObject parameters, AzureBicepResource resource, DistributedApplicationExecutionContext executionContext, bool skipKnownValues = false, CancellationToken cancellationToken = default)
95public static async Task SetScopeAsync(JsonObject scope, AzureBicepResource resource, CancellationToken cancellationToken = default)
122public static string GetChecksum(AzureBicepResource resource, JsonObject parameters, JsonObject? scope)
152var parameters = JsonNode.Parse(jsonString)?.AsObject();
153var scope = section.Data[DeploymentStateScopeKey]?.GetValue<string>() is { Length: > 0 } scopeString
206private static async Task SetScopeValueAsync(JsonObject scope, string propertyName, object? value, CancellationToken cancellationToken)
Provisioning\Provisioners\BicepProvisioner.cs (12)
350JsonObject? outputs,
354if (!TryGetDeploymentStateJsonObject(stateSection, BicepUtilities.DeploymentStateParametersKey, resource.Name, out var parameters) ||
368var scope = TryGetDeploymentStateJsonObject(stateSection, BicepUtilities.DeploymentStateScopeKey, resource.Name, out var cachedScope)
470[NotNullWhen(true)] out JsonObject? value)
565var parameters = new JsonObject();
568var scope = new JsonObject();
793var outputObj = outputs?.ToObjectFromJson<JsonObject>();
1321JsonObject parameters,
1322JsonObject? outputObj,
1323JsonObject? scope,
Aspire.Hosting.Azure.EntraId.Tests (1)
Aspire.Hosting.Azure.Kubernetes (3)
Aspire.Hosting.Azure.Kubernetes.Tests (4)
Aspire.Hosting.Azure.Sandboxes (18)
Aspire.Hosting.Azure.Tests (110)
Aspire.Hosting.Azure.WebPubSub (2)
Aspire.Hosting.Blazor (2)
Aspire.Hosting.Browsers.Tests (1)
Aspire.Hosting.CodeGeneration.Go (15)
Aspire.Hosting.CodeGeneration.Go.Tests (1)
Aspire.Hosting.CodeGeneration.Java (3)
Aspire.Hosting.CodeGeneration.Java.Tests (1)
Aspire.Hosting.CodeGeneration.Python (3)
Aspire.Hosting.CodeGeneration.TypeScript (21)
Aspire.Hosting.CodeGeneration.TypeScript.Tests (19)
Aspire.Hosting.Docker.Tests (3)
Aspire.Hosting.Kubernetes (2)
Aspire.Hosting.Kubernetes.Tests (3)
Aspire.Hosting.Native.Client (4)
Aspire.Hosting.Native.CodeGeneration (4)
Aspire.Hosting.Native.Core.Tests (55)
NativeRpcTests.cs (4)
43var wait = client.Invoke("waitFor", Arguments(("context", web), ("dependency", cache)));
162var duplicate = client.Invoke("addResource", Arguments(("context", composition),
208var rejected = client.Invoke("addResource", Arguments(("context", composition),
223private static string Error(JsonObject response) =>
Aspire.Hosting.Native.Server (79)
Rpc\NativeProviderRegistry.cs (22)
21JsonObject InspectCapabilities();
22Task<JsonNode?> InvokeAsync(NativeRpcConnection caller, string capability, JsonObject arguments);
23Task<JsonNode?> InvokeCoreAsync(NativeRpcConnection provider, string capability, JsonObject arguments);
24Task<JsonNode?> InvokeCallbackAsync(NativeRpcConnection provider, string callback, JsonObject arguments);
28internal sealed partial class NativeProviderRegistry(JsonObject coreContract, NativeServerOptions options, ILogger logger) : INativeProviderRegistry
178public JsonObject InspectCapabilities()
191public async Task<JsonNode?> InvokeAsync(NativeRpcConnection caller, string capability, JsonObject arguments)
212var mapped = new JsonObject();
281public async Task<JsonNode?> InvokeCoreAsync(NativeRpcConnection provider, string capability, JsonObject arguments)
296if (value is JsonObject handle && handle.ContainsKey("$handle"))
324JsonObject obj => new JsonObject(obj.Select(pair => KeyValuePair.Create(pair.Key, Translate(pair.Value)))),
329var translated = (JsonObject)Translate(arguments)!;
339if (value is JsonObject handle && handle.ContainsKey("$handle"))
348JsonObject obj => new JsonObject(obj.Select(pair => KeyValuePair.Create(pair.Key, DelegateResult(pair.Value)))),
355public async Task<JsonNode?> InvokeCallbackAsync(NativeRpcConnection provider, string callbackId, JsonObject arguments)
370var mapped = new JsonObject();
390var handle = value as JsonObject ?? throw RpcFault.InvalidHandle("A typed handle is required.");
537internal sealed record DelegatedCoreReference(NativeRpcConnection Owner, JsonObject Handle) : ICapabilityLifetime
543JsonObject Handle, JsonObject Lifetime, NativeProviderRegistry.PublishedResource Resource) : ICapabilityLifetime
Aspire.Hosting.Radius (4)
Aspire.Hosting.RemoteHost (61)
Ats\AtsCallbackProxyFactory.cs (17)
135var jsonObjectType = typeof(JsonObject);
195argsExpr ?? Expression.Constant(null, typeof(JsonObject)),
210argsExpr ?? Expression.Constant(null, typeof(JsonObject)),
225argsExpr ?? Expression.Constant(null, typeof(JsonObject)),
240argsExpr ?? Expression.Constant(null, typeof(JsonObject)),
245private Task<JsonNode?> InvokeCallbackAsync(string callbackId, JsonObject? args, CancellationToken cancellationToken)
252private void InvokeSyncVoid(string callbackId, JsonObject? args, CancellationToken cancellationToken, int ctParamIndex)
258private void InvokeSyncVoidWithDtoWriteback(string callbackId, JsonObject? args, object?[] originalArgs, Type[] argTypes, CancellationToken cancellationToken, int ctParamIndex)
265private T? InvokeSyncResult<T>(string callbackId, JsonObject? args, CancellationToken cancellationToken, int ctParamIndex)
272private async Task InvokeAsyncVoid(string callbackId, JsonObject? args, CancellationToken cancellationToken, int ctParamIndex)
278private async Task InvokeAsyncVoidWithDtoWriteback(string callbackId, JsonObject? args, object?[] originalArgs, Type[] argTypes, CancellationToken cancellationToken, int ctParamIndex)
285private async Task<T?> InvokeAsyncResult<T>(string callbackId, JsonObject? args, CancellationToken cancellationToken, int ctParamIndex)
308private void AddCancellationTokenToArgs(ref JsonObject? args, CancellationToken cancellationToken, int ctParamIndex)
341argsExpr ?? Expression.Constant(null, typeof(JsonObject)),
360argsExpr ?? Expression.Constant(null, typeof(JsonObject)),
391if (result is not JsonObject returnedArgs)
419if (returnedArgs[key] is JsonObject modifiedDto)
Ats\CapabilityDispatcher.cs (15)
22JsonObject? args,
547string capabilityId, JsonObject? args, JsonRpcCallbackInvoker? ownerInvoker = null, CancellationToken cancellationToken = default)
651public JsonNode? Invoke(string capabilityId, JsonObject? args)
784JsonObject? args,
827JsonObject? args,
985JsonObject obj when obj.ContainsKey("$handle") => "handle",
986JsonObject => "object",
994JsonObject? args,
1056public static string GetRequiredString(this JsonObject args, string name, string capabilityId)
1070public static string? GetOptionalString(this JsonObject args, string name)
1082public static int? GetOptionalInt(this JsonObject args, string name)
1095this JsonObject args,
1125public static T? GetDto<T>(this JsonObject args, string name) where T : class
1127if (args.TryGetPropertyValue(name, out var node) && node is JsonObject obj)
1137public static JsonObject CreateHandleResult(this HandleRegistry handles, object obj, string typeId)
Ats\ExternalCapabilityRegistry.cs (5)
445string capabilityId, JsonObject? args, JsonRpcCallbackInvoker? ownerInvoker = null, CancellationToken cancellationToken = default)
467var forwardedArgs = args?.DeepClone().AsObject();
552internal async Task<JsonNode?> InvokeGuestCallbackAsync(JsonRpc host, string callbackId, JsonObject? args, CancellationToken cancellationToken)
598internal CancellationToken[] GetCancellationTokens(string capabilityId, JsonObject? args, AtsMarshaller marshaller)
634private void RegisterCallbackOwners(ExternalCapabilityRegistration registration, JsonObject? args, JsonRpcCallbackInvoker? ownerInvoker, string invocationId)
Aspire.Hosting.RemoteHost.Tests (206)
TestServices\IntegrationHostTestConnection.cs (5)
22public IntegrationHostTestConnection(JsonElement capabilities, Func<string, JsonObject?, Task<JsonNode?>> handleCapability)
27public IntegrationHostTestConnection(JsonElement capabilities, Func<string, JsonObject?, CancellationToken, Task<JsonNode?>> invokeCallback)
39Func<string, JsonObject?, Task<JsonNode?>>? handleCapability,
40Func<string, JsonObject?, CancellationToken, Task<JsonNode?>>? invokeCallback)
52(string capabilityId, JsonObject? args, string invocationId) =>
Aspire.Hosting.Tests (37)
Aspire.Hosting.TestUtilities (1)
Aspire.Hosting.Yarp (5)
ConfigurationSchemaGenerator (23)
ConfigSchemaEmitter.cs (23)
44var root = new JsonObject();
51private void GenerateLogCategories(JsonObject parent)
59var propertiesNode = new JsonObject(s_ignoreCaseNodeOptions);
62var categoryNode = new JsonObject();
76private void GenerateGraph(JsonObject rootNode)
101private bool GeneratePathSegment(JsonObject currentNode, TypeSpec type, Queue<string> pathSegments)
123if (currentNode[propertiesName] is not JsonObject propertiesNode)
132if (propertiesNode[pathSegment] is not JsonObject pathSegmentNode)
182private bool GenerateType(JsonObject currentNode, TypeSpec type)
226private bool GenerateObject(JsonObject currentNode, ObjectSpec objectSpec)
244if (currentNode["properties"] is not JsonObject propertiesNode)
275private bool GenerateProperty(JsonObject currentNode, PropertySpec property, IPropertySymbol? propertySymbol)
286var propertyNode = new JsonObject();
306private bool GenerateCollection(JsonObject currentNode, CollectionSpec collection, string typeName, string containerName)
319var containerNode = new JsonObject();
334private static void RestoreBackup(JsonNode? backupNode, string name, JsonObject parentNode)
434private static void GenerateDescriptionFromDocComment(JsonObject propertyNode, string docComment)
490private void GenerateDescriptionForType(JsonObject currentNode, TypeSpec type)
587private void GenerateParsableFromString(JsonObject propertyNode, ParsableFromStringSpec parsable)
678private bool IsExcluded(JsonObject currentNode, PropertySpec property)
718private static void ReplaceNodeWithKeyCasingChange(JsonObject jsonObject, string key, JsonNode value)
739case JsonObject obj:
743obj.Parent is JsonObject && obj.GetPropertyName() == "properties" ?
dotnet-user-jwts (19)
GenerateTemplateManifest (6)
Infrastructure.Tests (106)
Microsoft.AspNetCore.JsonPatch.SystemTextJson (13)
Microsoft.AspNetCore.OpenApi (10)
Microsoft.Extensions.AI (4)
Microsoft.Extensions.AI.Abstractions (29)
Microsoft.Extensions.AI.Abstractions.Tests (8)
Microsoft.Extensions.AI.Evaluation.Safety (9)
Microsoft.Extensions.AI.OpenAI (2)
Microsoft.ML.AutoML (1)
Microsoft.ML.AutoML.SourceGenerator (1)
Microsoft.NET.Build.Containers (16)
Microsoft.NET.Build.Tasks (12)
Microsoft.NETCore.Platforms (1)
Microsoft.TemplateEngine.Cli (23)
Microsoft.TemplateEngine.Edge (59)
parent\Shared\JExtensions.cs (33)
44if (token is not JsonObject obj)
156if (token is not JsonObject obj)
197internal static IReadOnlyList<string> ToStringReadOnlyList(this JsonObject jObject, string propertyName, IReadOnlyList<string>? defaultValue = null)
210if (token is not JsonObject obj)
222return element is not JsonObject jObj ? [] : GetObjectProperties(jObj);
228/// Enumerates the properties of a <see cref="JsonObject"/>, handling duplicate keys gracefully.
231/// <see cref="JsonObject"/> lazily initializes its internal dictionary when first accessed.
236private static IReadOnlyList<KeyValuePair<string, JsonNode?>> GetObjectProperties(JsonObject obj)
251/// Enumerates the properties of a <see cref="JsonObject"/> by re-parsing its JSON text via
255/// <see cref="JsonObject.WriteTo"/> falls back to the underlying <see cref="System.Text.Json.JsonElement"/>
257/// safe to call even after a failed <see cref="JsonObject"/> initialization.
260private static List<KeyValuePair<string, JsonNode?>> GetObjectPropertiesViaDocument(JsonObject obj)
285if (token is not JsonObject obj || key == null)
439internal static JsonObject ReadJObjectFromIFile(this IFile file)
444return (JsonObject?)JsonNode.Parse(json, null, DocOptions)
448internal static JsonObject ReadObject(this IPhysicalFileSystem fileSystem, string path)
453return (JsonObject?)JsonNode.Parse(json, null, DocOptions)
507/// Tries to get a property value from a <see cref="JsonObject"/> using case-insensitive key matching.
509internal static bool TryGetValueCaseInsensitive(this JsonObject obj, string key, out JsonNode? result)
519internal static JsonNode? GetPropertyCaseInsensitive(JsonObject obj, string key)
552private static JsonNode? GetPropertyCaseInsensitiveViaDocument(JsonObject obj, string key)
580internal static JsonObject ParseJsonObject(string json)
582return (JsonObject?)JsonNode.Parse(json, null, DocOptions)
602internal static JsonObject FromObject(object obj)
605return (JsonObject?)JsonNode.Parse(json, null, DocOptions)
610/// Creates a deep clone of a <see cref="JsonObject"/> by round-tripping through JSON text.
612internal static JsonObject DeepCloneObject(this JsonObject source)
614return (JsonObject?)JsonNode.Parse(source.ToJsonString(), null, DocOptions)
625internal static void Merge(this JsonObject target, JsonObject source)
629if (property.Value is JsonObject sourceObj
631&& targetNode is JsonObject targetObj)
Settings\TemplateCache.cs (6)
63(string, JsonObject?)? hostFile = GetBestHostConfigMatch(chosenTemplate.Template, environmentSettings, chosenTemplate.MountPoint);
76public TemplateCache(JsonObject? contentJObject)
97if (contentJObject.TryGetValueCaseInsensitive(nameof(MountPointsInfo), out JsonNode? mountPointInfoToken) && mountPointInfoToken is JsonObject mountPointInfoObj)
116if (entry is JsonObject entryObj)
286private (string, JsonObject?)? GetBestHostConfigMatch(IScanTemplateInfo newTemplate, IEngineEnvironmentSettings settings, IMountPoint mountPoint)
303private JsonObject? ReadHostFile(IScanTemplateInfo template, string path, IEngineEnvironmentSettings settings, IMountPoint mountPoint)
Microsoft.TemplateEngine.Orchestrator.RunnableProjects (103)
parent\Shared\JExtensions.cs (33)
44if (token is not JsonObject obj)
156if (token is not JsonObject obj)
197internal static IReadOnlyList<string> ToStringReadOnlyList(this JsonObject jObject, string propertyName, IReadOnlyList<string>? defaultValue = null)
210if (token is not JsonObject obj)
222return element is not JsonObject jObj ? [] : GetObjectProperties(jObj);
228/// Enumerates the properties of a <see cref="JsonObject"/>, handling duplicate keys gracefully.
231/// <see cref="JsonObject"/> lazily initializes its internal dictionary when first accessed.
236private static IReadOnlyList<KeyValuePair<string, JsonNode?>> GetObjectProperties(JsonObject obj)
251/// Enumerates the properties of a <see cref="JsonObject"/> by re-parsing its JSON text via
255/// <see cref="JsonObject.WriteTo"/> falls back to the underlying <see cref="System.Text.Json.JsonElement"/>
257/// safe to call even after a failed <see cref="JsonObject"/> initialization.
260private static List<KeyValuePair<string, JsonNode?>> GetObjectPropertiesViaDocument(JsonObject obj)
285if (token is not JsonObject obj || key == null)
439internal static JsonObject ReadJObjectFromIFile(this IFile file)
444return (JsonObject?)JsonNode.Parse(json, null, DocOptions)
448internal static JsonObject ReadObject(this IPhysicalFileSystem fileSystem, string path)
453return (JsonObject?)JsonNode.Parse(json, null, DocOptions)
507/// Tries to get a property value from a <see cref="JsonObject"/> using case-insensitive key matching.
509internal static bool TryGetValueCaseInsensitive(this JsonObject obj, string key, out JsonNode? result)
519internal static JsonNode? GetPropertyCaseInsensitive(JsonObject obj, string key)
552private static JsonNode? GetPropertyCaseInsensitiveViaDocument(JsonObject obj, string key)
580internal static JsonObject ParseJsonObject(string json)
582return (JsonObject?)JsonNode.Parse(json, null, DocOptions)
602internal static JsonObject FromObject(object obj)
605return (JsonObject?)JsonNode.Parse(json, null, DocOptions)
610/// Creates a deep clone of a <see cref="JsonObject"/> by round-tripping through JSON text.
612internal static JsonObject DeepCloneObject(this JsonObject source)
614return (JsonObject?)JsonNode.Parse(source.ToJsonString(), null, DocOptions)
625internal static void Merge(this JsonObject target, JsonObject source)
629if (property.Value is JsonObject sourceObj
631&& targetNode is JsonObject targetObj)
Microsoft.TemplateEngine.Utils (33)
parent\Shared\JExtensions.cs (33)
44if (token is not JsonObject obj)
156if (token is not JsonObject obj)
197internal static IReadOnlyList<string> ToStringReadOnlyList(this JsonObject jObject, string propertyName, IReadOnlyList<string>? defaultValue = null)
210if (token is not JsonObject obj)
222return element is not JsonObject jObj ? [] : GetObjectProperties(jObj);
228/// Enumerates the properties of a <see cref="JsonObject"/>, handling duplicate keys gracefully.
231/// <see cref="JsonObject"/> lazily initializes its internal dictionary when first accessed.
236private static IReadOnlyList<KeyValuePair<string, JsonNode?>> GetObjectProperties(JsonObject obj)
251/// Enumerates the properties of a <see cref="JsonObject"/> by re-parsing its JSON text via
255/// <see cref="JsonObject.WriteTo"/> falls back to the underlying <see cref="System.Text.Json.JsonElement"/>
257/// safe to call even after a failed <see cref="JsonObject"/> initialization.
260private static List<KeyValuePair<string, JsonNode?>> GetObjectPropertiesViaDocument(JsonObject obj)
285if (token is not JsonObject obj || key == null)
439internal static JsonObject ReadJObjectFromIFile(this IFile file)
444return (JsonObject?)JsonNode.Parse(json, null, DocOptions)
448internal static JsonObject ReadObject(this IPhysicalFileSystem fileSystem, string path)
453return (JsonObject?)JsonNode.Parse(json, null, DocOptions)
507/// Tries to get a property value from a <see cref="JsonObject"/> using case-insensitive key matching.
509internal static bool TryGetValueCaseInsensitive(this JsonObject obj, string key, out JsonNode? result)
519internal static JsonNode? GetPropertyCaseInsensitive(JsonObject obj, string key)
552private static JsonNode? GetPropertyCaseInsensitiveViaDocument(JsonObject obj, string key)
580internal static JsonObject ParseJsonObject(string json)
582return (JsonObject?)JsonNode.Parse(json, null, DocOptions)
602internal static JsonObject FromObject(object obj)
605return (JsonObject?)JsonNode.Parse(json, null, DocOptions)
610/// Creates a deep clone of a <see cref="JsonObject"/> by round-tripping through JSON text.
612internal static JsonObject DeepCloneObject(this JsonObject source)
614return (JsonObject?)JsonNode.Parse(source.ToJsonString(), null, DocOptions)
625internal static void Merge(this JsonObject target, JsonObject source)
629if (property.Value is JsonObject sourceObj
631&& targetNode is JsonObject targetObj)
Microsoft.TemplateSearch.Common (71)
parent\Shared\JExtensions.cs (33)
44if (token is not JsonObject obj)
156if (token is not JsonObject obj)
197internal static IReadOnlyList<string> ToStringReadOnlyList(this JsonObject jObject, string propertyName, IReadOnlyList<string>? defaultValue = null)
210if (token is not JsonObject obj)
222return element is not JsonObject jObj ? [] : GetObjectProperties(jObj);
228/// Enumerates the properties of a <see cref="JsonObject"/>, handling duplicate keys gracefully.
231/// <see cref="JsonObject"/> lazily initializes its internal dictionary when first accessed.
236private static IReadOnlyList<KeyValuePair<string, JsonNode?>> GetObjectProperties(JsonObject obj)
251/// Enumerates the properties of a <see cref="JsonObject"/> by re-parsing its JSON text via
255/// <see cref="JsonObject.WriteTo"/> falls back to the underlying <see cref="System.Text.Json.JsonElement"/>
257/// safe to call even after a failed <see cref="JsonObject"/> initialization.
260private static List<KeyValuePair<string, JsonNode?>> GetObjectPropertiesViaDocument(JsonObject obj)
285if (token is not JsonObject obj || key == null)
439internal static JsonObject ReadJObjectFromIFile(this IFile file)
444return (JsonObject?)JsonNode.Parse(json, null, DocOptions)
448internal static JsonObject ReadObject(this IPhysicalFileSystem fileSystem, string path)
453return (JsonObject?)JsonNode.Parse(json, null, DocOptions)
507/// Tries to get a property value from a <see cref="JsonObject"/> using case-insensitive key matching.
509internal static bool TryGetValueCaseInsensitive(this JsonObject obj, string key, out JsonNode? result)
519internal static JsonNode? GetPropertyCaseInsensitive(JsonObject obj, string key)
552private static JsonNode? GetPropertyCaseInsensitiveViaDocument(JsonObject obj, string key)
580internal static JsonObject ParseJsonObject(string json)
582return (JsonObject?)JsonNode.Parse(json, null, DocOptions)
602internal static JsonObject FromObject(object obj)
605return (JsonObject?)JsonNode.Parse(json, null, DocOptions)
610/// Creates a deep clone of a <see cref="JsonObject"/> by round-tripping through JSON text.
612internal static JsonObject DeepCloneObject(this JsonObject source)
614return (JsonObject?)JsonNode.Parse(source.ToJsonString(), null, DocOptions)
625internal static void Merge(this JsonObject target, JsonObject source)
629if (property.Value is JsonObject sourceObj
631&& targetNode is JsonObject targetObj)
TemplateDiscoveryMetadata\LegacySearchCacheReader.cs (12)
61JsonObject cacheObject = JExtensions.ParseJsonObject(cacheText);
66internal static bool TryReadDiscoveryMetadata(JsonObject cacheObject, ILogger logger, IReadOnlyDictionary<string, Func<object, object>>? additionalDataReaders, out TemplateDiscoveryMetadata? discoveryMetadata)
81private static bool TryReadVersion(ILogger logger, JsonObject cacheObject, out string? version)
97JsonObject cacheObject,
112if (entry is JsonObject entryObj)
143private static bool TryReadPackToTemplateMap(ILogger logger, JsonObject cacheObject, out IReadOnlyDictionary<string, PackToTemplateEntry>? packToTemplateMap)
149if (packToTemplateMapToken is not JsonObject packToTemplateMapObject)
163JsonObject entryValue = (JsonObject)packEntry.Value;
208private static bool TryReadAdditionalData(ILogger logger, JsonObject cacheObject, IReadOnlyDictionary<string, Func<object, object>>? additionalDataReaders, out IReadOnlyDictionary<string, object>? additionalData)
218if (additionalDataToken is not JsonObject additionalDataObject)
233if (dataNode is not JsonObject dataObject)
MSBuild (5)
NativeIntegrations.DockerCompose (96)
ComposeModels.cs (25)
23internal JsonObject ToJson()
25var result = new JsonObject();
42var exposure = new JsonObject { ["endpoint"] = port.Endpoint, ["hostIp"] = port.HostIp };
66public sealed record DockerComposePlan(JsonObject Compose, JsonObject Inputs, List<ComposePlannedService> Services);
73public JsonObject Model { get; }
75internal ComposeServiceBuilder(JsonObject model, string applicationDirectory, Func<string, string>? render = null)
97get => Model["build"] is JsonObject build ? new(build["context"]!.GetValue<string>(), build["dockerfile"]!.GetValue<string>()) : null;
103get => Model["healthcheck"] is JsonObject health ? ComposeJson.ReadHealthcheck(health) : null;
164public sealed class ComposeFileBuilder(JsonObject model, string applicationDirectory)
166public JsonObject Model { get; } = model;
187var services = Model["services"]!.AsObject();
192var service = new JsonObject { ["image"] = ComposeJson.Literal(image), ["labels"] = new JsonObject() };
203public void AddNetwork(string name, JsonObject options) => Add("networks", name, ComposeJson.Escape(options));
206var volume = new JsonObject();
221var secret = new JsonObject { ["external"] = true };
228private void Add(string collection, string name, JsonObject value)
235public sealed class CapturedEnvironmentVariable(JsonObject model)
304internal static JsonObject BuildPaths(ComposeBuild build, string applicationDirectory)
316internal static JsonObject Healthcheck(ComposeHealthcheck value, bool escape = false)
323var result = new JsonObject { ["test"] = Strings(value.Test.Select(part => escape ? Literal(Text(part, true)) : Text(part, true))) };
344internal static ComposeHealthcheck ReadHealthcheck(JsonObject value) => new(
348internal static JsonObject Escape(JsonObject source) => EscapeNode(source)!.AsObject();
351JsonObject obj => new JsonObject(obj.Select(pair => KeyValuePair.Create(pair.Key, EscapeNode(pair.Value)))),
DockerComposeGenerator.cs (55)
40var environment = environments.SingleOrDefault(resource => Text(resource, "name") == name);
45var resources = new Dictionary<string, JsonObject>(StringComparer.Ordinal);
47var options = new Dictionary<string, JsonObject>(StringComparer.Ordinal);
49foreach (var resource in all.OrderBy(resource => Text(resource, "name"), StringComparer.Ordinal))
60var configuration = Options(resource);
102var inputs = new JsonObject
108var compose = new JsonObject { ["name"] = project, ["services"] = new JsonObject() };
114var configuration = options[resourceName];
132var service = new JsonObject
136if (configuration["build"] is JsonObject build)
160foreach (var endpoint in endpoints)
192var exposure = new JsonObject { ["endpoint"] = Text(endpoint, "name") };
200foreach (var exposure in exposures.OrderBy(value => Text(value, "endpoint"), StringComparer.Ordinal))
202var endpoint = endpoints.SingleOrDefault(endpoint => Text(endpoint, "name") == Text(exposure, "endpoint"))
211var value = new JsonObject { ["target"] = exposure.Target };
234var captured = (inputs["environment"] ??= new JsonObject()).AsObject();
277if (configuration["healthcheck"] is JsonObject healthcheck)
307JsonObject Normalize(JsonObject value, int depth = 0)
339string Render(JsonObject value)
371public static IReadOnlyDictionary<string, string> ResolveInputs(DockerComposePlan plan, JsonObject model,
375foreach (var parameter in Objects(plan.Inputs["parameters"]))
387var entry = node!.AsObject();
402internal static void CaptureParameters(DockerComposePlan plan, JsonObject model)
404foreach (var parameter in Objects(plan.Inputs["parameters"]))
408var captured = (plan.Inputs["environment"] ??= new JsonObject()).AsObject();
414var entry = new JsonObject { ["description"] = $"Deployment parameter {name}", ["secret"] = secret };
423private static void ConfigureEnvironment(DockerComposePlan plan, JsonObject environment)
426var configuration = source is null ? new JsonObject
429} : JsonNode.Parse(source) as JsonObject ?? throw new ArgumentException("Docker Compose environment configuration must be an object.");
462var services = plan.Compose["services"]!.AsObject();
472var variables = new JsonObject
482var dashboard = new JsonObject
501var captured = (plan.Inputs["environment"] ??= new JsonObject()).AsObject();
512internal static JsonObject Options(JsonObject resource)
514var options = resource["configuration"]?["publish.dockerCompose"] is { } source ? JsonNode.Parse(source.GetValue<string>())!.AsObject() : new JsonObject();
519internal static void ValidateOptions(JsonObject options)
535var build = options["build"]?.AsObject() ?? throw new ArgumentException("Build configuration must be an object.", nameof(options));
542var health = options["healthcheck"]?.AsObject() ?? throw new ArgumentException("Healthcheck must be an object.", nameof(options));
549foreach (var exposure in Objects(options["ports"]))
569internal static IEnumerable<JsonObject> Objects(JsonNode? value) => (value ?? throw new ArgumentException("Expected a JSON array.")).AsArray().Select(node => node!.AsObject());
571internal static string Text(JsonObject value, string property) => value[property]?.GetValue<string>() ?? throw new ArgumentException($"Missing string '{property}'.");
572internal static bool Boolean(JsonObject value, string property) => value[property]?.GetValue<bool>() ?? false;
573private static int Integer(JsonObject value, string property) => value[property]!.GetValue<int>();
594private static void Fields(JsonObject value, string[] allowed)
608private static bool ContainsParameter(JsonObject value) => Text(value, "kind") switch
615private static string Evaluate(JsonObject value, IReadOnlyDictionary<string, JsonObject> resources,
630private static string EndpointValue(JsonObject value, IReadOnlyDictionary<string, JsonObject> resources, IReadOnlyDictionary<string, string> names)
633if (!resources.TryGetValue(name, out var resource) || !names.TryGetValue(name, out var host))
637var endpoint = Objects(resource["endpoints"]).SingleOrDefault(endpoint => Text(endpoint, "name") == Text(value, "endpoint"))
651private static void ValidateDependencies(IReadOnlyDictionary<string, JsonObject> resources)
666if (!resources.TryGetValue(name, out var resource))
NuGet.Protocol (11)
sdk-tasks (7)
SelectTests (2)
Shared.Tests (2)
System.Text.Json (81)
TestProject.AppHost (3)