1642 instantiations of JsonObject
AnalyzeCiFailure (24)
AnalysisDiagnostics.cs (3)
150var entry = new JsonObject 181var summary = new JsonObject 215internal static JsonObject DescribeException(Exception error) => new()
AnalysisPublisher.cs (8)
277var request = new JsonObject(); 308new JsonObject { ["labels"] = new JsonArray(labels.Split(',').Select(label => JsonValue.Create(label)).ToArray()) }, 319new JsonObject { ["state"] = "open" }, 332new JsonObject 524Write(request, new JsonObject { ["body"] = comment }); 547new JsonObject { ["body"] = comment }, 558new JsonObject { ["body"] = comment }, 581new JsonObject
AnalysisPublisher.Overflow.cs (3)
152new JsonObject 169new JsonObject { ["body"] = publication.Body, ["title"] = publication.Title }, 182new JsonObject { ["body"] = page.Body },
CiFailureJson.cs (1)
111var obj = new JsonObject();
DiagnosticTextSanitizer.cs (2)
75JsonObject obj => new JsonObject(obj.Select(p => KeyValuePair.Create(p.Key, SanitizeJson(p.Value, limit, multiline)))), 84JsonValueKind.Object => new JsonObject(node.EnumerateObject().Select(property =>
EvidencePreparation.cs (1)
123new System.Text.Json.Nodes.JsonObject
RecoveryCaptureWriter.cs (3)
118new JsonObject 144=> entries.Add(new JsonObject { ["file"] = name, ["state"] = "omitted", ["reason"] = "recovery size limit" }); 158entries.Add(new JsonObject { ["file"] = name, ["state"] = "retained", ["bytes"] = bytes, ["transform"] = transform });
WorkflowRunEvidenceCollector.cs (3)
581new JsonArray(files.Select(file => (JsonNode)new JsonObject( 604new JsonObject 620CaptureDiagnostic("pr-metadata.json", new JsonObject());
AnalyzeCiFailure.TestHost (2)
tests\AnalyzeCiFailure.Tests\TestServices\GitHubFixtureHandler.cs (2)
43new JsonObject 205var response = new JsonObject { ["html_url"] = url, [createdKind == "issue" ? "number" : "id"] = JsonNode.Parse(digits.Length == 0 ? "0" : digits) };
AnalyzeCiFailure.Tests (92)
AnalyzeCiFailureAlternateWorkflowTests.cs (13)
341: Assert.Single(adapter.DescribeTestArtifacts(new JsonObject { ["name"] = "Alternate tests" }, runAttempt: 2)); 424pages[0]!["artifacts"]!.AsArray().Add(new JsonObject 431["workflow_run"] = new JsonObject { ["id"] = 123, ["head_sha"] = "failed-sha" }, 443pages[0]!["artifacts"]!.AsArray().Add(new JsonObject 447["workflow_run"] = new JsonObject { ["id"] = 123, ["head_sha"] = "failed-sha" }, 466jobs[0]!["jobs"]!.AsArray().Add(new JsonObject 482pages[0]!["artifacts"]!.AsArray().Add(new JsonObject 540=> new JsonObject 542["tests"] = new JsonArray(new JsonObject { ["fullTitle"] = "Alternate test" }), 543["failures"] = new JsonArray(Enumerable.Range(0, 2000).Select(index => new JsonObject 546["err"] = new JsonObject 551}).Append(new JsonObject 554["err"] = new JsonObject { ["name"] = "AssertionError", ["message"] = "assertion failed" },
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());
AnalyzeCiFailureEvidenceTests.cs (5)
58test["result_file"] = new JsonObject { ["forged"] = true }; 104var source = new JsonObject 242new JsonObject 248["labels"] = new JsonArray(new JsonObject { ["name"] = "ci-failure-cause" }), 316var projection = new JsonObject
AnalyzeCiFailureMigrationTests.cs (7)
237["diagnostics/annotations-123.json"] = JsonSerializer.SerializeToElement(new JsonArray(new JsonObject { ["message"] = new string('a', count: 1005) })), 327new JsonArray(new JsonObject 332["labels"] = new JsonArray(new JsonObject { ["name"] = "ci-failure-cause" }), 352new JsonArray(new JsonObject 357["labels"] = new JsonArray(new JsonObject { ["name"] = "ci-failure-cause" }), 390JsonObject? history = scenario == "existing-missing" ? null : new JsonObject 396["occurrences"] = new JsonArray(new JsonObject { ["run_id"] = scenario.StartsWith("new-replay", StringComparison.Ordinal) ? 123 : 999, ["observed_at"] = "2026-10-20T01:00:00Z" }),
AnalyzeCiFailureOccurrenceTests.cs (6)
79? [new JsonObject { ["name"] = new string('t', count: 500), ["job_id"] = 123, ["job"] = "Tests" }] 176new JsonArray(new JsonObject 181["labels"] = new JsonArray(new JsonObject { ["name"] = "ci-failure-cause" }), 204summary["pr"] = replayScope == "main" ? null : new JsonObject { ["number"] = 43 }; 208new JsonObject { ["run_id"] = 123, ["run_scope"] = replayScope, ["pr_numbers"] = replayScope == "main" ? "" : "43" }.ToJsonString()); 227new JsonObject
AnalyzeCiFailurePreparationTests.cs (8)
581new JsonObject 690jobs.Add(new JsonObject { ["id"] = 124, ["name"] = jobName }); 694collected.Add(new JsonObject { ["test"] = "Tests.Method(value: 1/2)", ["job"] = jobName, ["job_id"] = 124, ["error"] = "Legacy timeout" }); 699analysis["failed_jobs"]!.AsArray().Add(new JsonObject { ["id"] = 124, ["classification"] = "flaky-test" }); 700analysis["failed_tests"]!.AsArray().Add(new JsonObject 803summary["failed_tests"] = new JsonArray(failures.Select(test => (JsonNode)new JsonObject 816cause["tests"] = new JsonArray(failures.Select(test => (JsonNode)new JsonObject 842summary["failed_tests"] = new JsonArray(new JsonObject
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" }),
AnalyzeCiFailureRenderingTests.cs (1)
72CiFailureJson.Write(args[11], new JsonObject { ["title"] = projection.Title, ["labels"] = projection.Labels });
AnalyzeCiFailureTextTests.cs (2)
169var document = new JsonObject { ["job_id"] = "123", ["classification"] = "code-issue" }; 203new JsonObject { ["number"] = "42", ["metadata"] = text }.ToJsonString()));
AnalyzeCiFailureWorkflowAdapterTests.cs (6)
25var job = new JsonObject 28["steps"] = new JsonArray(new JsonObject 73new JsonObject { ["name"] = name }, 81new JsonObject { ["name"] = name }, 91var job = new JsonObject 94["steps"] = new JsonArray(new JsonObject { ["name"] = step, ["conclusion"] = "failure" }),
AnalyzeCiFailureWorkflowTests.cs (3)
489node["unknown"] = new System.Text.Json.Nodes.JsonObject { ["keep"] = true }; 1317facts["subject_pr"] = new System.Text.Json.Nodes.JsonObject { ["number"] = "42,43", ["metadata"] = null }; 1321facts["subject_pr"] = new System.Text.Json.Nodes.JsonObject { ["number"] = "42", ["metadata"] = null };
TestServices\GitHubFixtureHandler.cs (2)
43new JsonObject 205var response = new JsonObject { ["html_url"] = url, [createdKind == "issue" ? "number" : "id"] = JsonNode.Parse(digits.Length == 0 ? "0" : digits) };
aspire (96)
Agents\AgentConfiguration.cs (2)
35var root = original?.DeepClone().AsObject() ?? new JsonObject(); 41if (JsonNode.DeepEquals(original ?? new JsonObject(), root))
Agents\AspireSkills\AspireSkillsRemoteConfiguration.cs (4)
206? new JsonObject { ["source"] = "github", ["repo"] = skillSource.Repository } 207: new JsonObject { ["source"] = "git", ["url"] = skillSource.Repository }; 217targetMarketplaces[marketplaceName] = new JsonObject 267value = new JsonObject();
Agents\ClaudeCode\ClaudeCodeAgentClient.cs (5)
133settings = new JsonObject(); 144settings = new JsonObject(); 158hooks = new JsonObject(); 181JsonNode hookGroup = new JsonObject 184["hooks"] = new JsonArray(new JsonObject
Agents\Copilot\CopilotAgentClient.cs (5)
23GlobalServerConfiguration = new JsonObject 28["env"] = new JsonObject { ["DOTNET_ROOT"] = "${DOTNET_ROOT}" }, 128var config = new JsonObject 131["hooks"] = new JsonObject 134new JsonObject
Agents\McpConfigFileHelper.cs (3)
21public JsonObject ServerConfiguration { get; init; } = new() 48return new JsonObject(); 89servers = new JsonObject();
Agents\OpenCode\OpenCodeAgentClient.cs (2)
23ServerConfiguration = new JsonObject 35ServerConfiguration = new JsonObject
Commands\InitCommand.cs (15)
614settings = new JsonObject(); 620settings = JsonNode.Parse(existingContent)?.AsObject() ?? new JsonObject(); 632settings = new JsonObject(); 638appHost = new JsonObject(); 693settings["profiles"] = new JsonObject 695["https"] = new JsonObject 698["environmentVariables"] = new JsonObject 704["http"] = new JsonObject 707["environmentVariables"] = new JsonObject 875var settings = new JsonObject 878["profiles"] = new JsonObject 880["https"] = new JsonObject 886["environmentVariables"] = new JsonObject 894["http"] = new JsonObject 900["environmentVariables"] = new JsonObject
Commands\ResourceCommand.cs (2)
281var arguments = new JsonObject(); 373var arguments = new JsonObject();
Commands\SecretListCommand.cs (3)
82var obj = new JsonObject(); 131var root = new JsonObject(); 134var obj = new JsonObject();
Commands\TemplateManagementCommand.cs (2)
47JsonObject source = new(); 115JsonObject result = new();
Configuration\ConfigSourceService.cs (7)
290var configuration = await ReadConfigurationFileAsync(path, cancellationToken) ?? new JsonObject(); 295configuration[GetKey(configuration, ConfigSource.SectionName)] = new JsonObject { ["optOut"] = true }; 309return new JsonObject(); 317return new JsonObject(); 333return new JsonObject(); 337var sources = new JsonObject(); 376var configuration = await ReadConfigurationFileAsync(path, cancellationToken) ?? new JsonObject();
Configuration\ConfigurationService.cs (4)
46? new JsonObject() 47: JsonNode.Parse(existingContent, nodeOptions: null, ConfigurationHelper.ParseOptions)?.AsObject() ?? new JsonObject(); 51settings = new JsonObject(); 260child = new JsonObject();
Mcp\Tools\ExecuteResourceCommandTool.cs (1)
183var arguments = new JsonObject();
Migrations\TypeScriptAppHostMigration.cs (1)
82Metadata = new JsonObject
Projects\FallbackProjectParser.cs (5)
187var rootObject = new JsonObject(); 190var itemsObject = new JsonObject(); 196var packageObj = new JsonObject(); 207var projectObj = new JsonObject(); 217var propertiesObject = new JsonObject();
Projects\NativeAppHostServerProject.cs (4)
124await File.WriteAllTextAsync(requestPath, new JsonObject 128["providers"] = new JsonArray(providers.Select(provider => (JsonNode)new JsonObject 132["sdkFiles"] = new JsonObject(provider.Descriptor.SdkFiles.Select(file => 156runtimeProviders.Add((JsonNode)new JsonObject
Scaffolding\PackageJsonMerger.cs (1)
362obj = new JsonObject();
Scaffolding\ScaffoldingService.cs (1)
409obj = new JsonObject();
src\Shared\ConsoleLogs\SharedAIHelpers.cs (6)
220var attributesObj = new JsonObject(); 233var linkObjects = span.Links.Select(link => (JsonNode)new JsonObject 255var spanObj = new JsonObject 400var traceData = new JsonObject 722var attributesObject = new JsonObject(); 730var log = new JsonObject
src\Shared\Json\JsonFlattener.cs (3)
18var result = new JsonObject(); 28var result = new JsonObject(); 40var newObject = new JsonObject();
src\Shared\UserSecrets\SecretsStore.cs (1)
102var obj = new JsonObject();
Templating\ConfiguredTemplateSourceService.cs (1)
36var inheritedSettings = new JsonObject
Templating\TemplateSourceStore.cs (4)
24var inherited = configSource is null ? new JsonObject() 26return new JsonObject(TemplateSourceConfiguration.MergeSources(inherited, GetSources(settings)) 95var sources = new JsonObject(); 112return new JsonObject();
Utils\ConfigurationHelper.cs (1)
775child = new JsonObject();
Utils\EnvironmentChecker\AspireSkillsCheck.cs (1)
58Metadata = new JsonObject
Utils\EnvironmentChecker\AspireVersionCheck.cs (2)
425var metadata = new JsonObject(); 462var metadata = new JsonObject
Utils\EnvironmentChecker\DevCertsCheck.cs (2)
530var certNode = new JsonObject 541return new JsonObject
Utils\EnvironmentChecker\EnvironmentChecker.cs (1)
133Metadata = new JsonObject
Utils\EnvironmentChecker\GoAppHostToolingCheck.cs (1)
285var metadata = new JsonObject
Utils\EnvironmentChecker\OperatingSystemCheck.cs (1)
144var metadata = new JsonObject
Utils\EnvironmentChecker\TypeScriptAppHostToolingCheck.cs (4)
91Metadata = new JsonObject 127Metadata = new JsonObject 161Metadata = new JsonObject 205Metadata = new JsonObject
Utils\EnvironmentChecker\VsCodeExtensionCheck.cs (1)
221=> new()
Aspire.Cli.EndToEnd.Tests (17)
Helpers\CliE2ETestHelpers.cs (3)
1195? JsonNode.Parse(File.ReadAllText(configPath))?.AsObject() ?? new JsonObject() 1196: new JsonObject(); 1199config["sdk"] = new JsonObject
Helpers\IntegrationHostLifetimeTestHelper.cs (4)
103config["features"] ??= new JsonObject(); 105config["packages"] ??= new JsonObject(); 107packages["@e2e/lifetime"] = new JsonObject 120manifest["scripts"] = new JsonObject { ["postinstall"] = "node install-lifetime.mjs" };
ProjectReferenceTests.cs (2)
79var packages = config["packages"] as JsonObject ?? new JsonObject(); 316var packages = config["packages"] as JsonObject ?? new JsonObject();
SettledNpmReleasesTests.cs (6)
122var packument = new JsonObject 125["dist-tags"] = new JsonObject { ["latest"] = "1.1.0" }, 126["versions"] = new JsonObject 132["time"] = new JsonObject 159private static JsonObject CreateVersion(string registryUrl, string version, byte[] tarball) => new() 163["dist"] = new JsonObject
TypeScriptEmptyAppHostTemplateTests.cs (1)
179config["packages"] = new JsonObject
TypeScriptPolyglotTests.cs (1)
354config["features"] = new JsonObject
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
Agents\OpenCodeAgentClientTests.cs (5)
215var original = new JsonObject { ["mcp"] = JsonNode.Parse(mcp) }; 244var original = new JsonObject 247["skills"] = array ? urls : new JsonObject { ["paths"] = new JsonArray("./team-skills"), ["urls"] = urls } 268var inherited = new JsonObject 270["skills"] = array ? new JsonObject { ["urls"] = new JsonArray(pin) } : new JsonArray(pin)
Agents\SkillSourceTests.cs (2)
218var configurations = new JsonObject(); 429var configurations = new JsonObject();
Agents\TelemetryHookConfiguratorTests.cs (8)
153var existing = new JsonObject 156["hooks"] = new JsonObject 159new JsonObject 163new JsonObject 245var existingHook = new JsonObject 251var settings = new JsonObject 253["hooks"] = new JsonObject 255["PostToolUse"] = new JsonArray(new JsonObject
Commands\AgentInitCommandTests.cs (2)
859var config = new JsonObject 861["skills"] = array ? catalogs : new JsonObject { ["urls"] = catalogs }
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" }
Commands\DescribeCommandTests.cs (1)
867[KnownProperties.Resource.ConnectionProperties] = new JsonObject
Commands\InitCommandTests.cs (6)
1149var existingConfig = new JsonObject 1152["features"] = new JsonObject { ["polyglotSupportEnabled"] = true } 1654var existing = new JsonObject { ["channel"] = "pr-99999" }; 1862var existing = new JsonObject { ["channel"] = "pr-99999" }; 2670var config = new JsonObject 2672["appHost"] = new JsonObject
Commands\NewCommandLocalTemplateTests.InitConfig.cs (1)
106await store.AddAsync("SHARED", new JsonObject { ["path"] = workspace.Path, ["displayName"] = "Personal templates" }, default);
Commands\NewCommandLocalTemplateTests.NuGetValues.cs (4)
275template["symbols"]!["Dependent"] = new JsonObject 305template["symbols"]!["IncludeIntegration"] = new JsonObject 394host["symbolInfo"] = new JsonObject { [target] = source }; 480template["symbols"]!["KubernetesVersion"] = new JsonObject
Commands\NewCommandLocalTemplateTests.SourceList.cs (1)
404return Task.FromResult(("version-1", new JsonObject()));
Commands\NewCommandLocalTemplateTests.SourceManagement.cs (7)
345var original = new JsonObject { ["TemplateSources"] = new JsonObject { ["Company"] = new JsonObject { ["path"] = workspace.Path } } }.ToJsonString(); 380var settings = new JsonObject 382["templateSources"] = new JsonObject 384["company"] = new JsonObject 390["futureFeature"] = new JsonObject { ["enabled"] = true }
Commands\ResourceCommandHelperTests.cs (1)
127var arguments = new JsonObject
Commands\TemplateSourceStartupTests.cs (1)
207_ => store.AddAsync("extra", new JsonObject { ["repository"] = "https://example.com/extra" }, CancellationToken.None)
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();
Configuration\ConfigurationServiceTests.cs (1)
112await store.AddAsync("added", new JsonObject { ["repository"] = "https://example.test/added" }, CancellationToken.None);
DotNet\DotNetRestoreConfigurationTests.cs (4)
35var values = new JsonObject(properties.Select(name => KeyValuePair.Create<string, JsonNode?>(name, JsonValue.Create("")))); 39return (0, JsonDocument.Parse(new JsonObject { ["Properties"] = values }.ToJsonString())); 65var values = new JsonObject(properties.Select(name => KeyValuePair.Create<string, JsonNode?>(name, JsonValue.Create("")))); 68return (0, JsonDocument.Parse(new JsonObject { ["Properties"] = values }.ToJsonString()));
Migrations\PendingMigrationsCheckTests.cs (1)
39Metadata = new JsonObject { ["language"] = "typescript" }
Projects\NativeAppHostServerProjectTests.cs (2)
439await File.WriteAllTextAsync(Path.Combine(root.FullName, "aspire.apphost-server.json"), new JsonObject 444["sdkFiles"] = new JsonObject(),
Projects\ProjectUpdaterNuGetConfigurationTests.cs (1)
1754var properties = new JsonObject();
Projects\ProjectUpdaterTests.cs (46)
104var document = new JsonObject() 250var document = new JsonObject(); 361var document = new JsonObject() 476var itemsAndProperties = new JsonObject(); 601var itemsAndProperties = new JsonObject(); 756var itemsAndProperties = new JsonObject(); 879var itemsAndProperties = new JsonObject(); 1033var itemsAndProperties = new JsonObject(); 1153var itemsAndProperties = new JsonObject(); 1314var itemsAndProperties = new JsonObject(); 1432var itemsAndProperties = new JsonObject(); 1535var itemsAndProperties = new JsonObject(); 1661var itemsAndProperties = new JsonObject(); 1755var itemsAndProperties = new JsonObject(); 1829var itemsAndProperties = new JsonObject(); 1925var itemsAndProperties = new JsonObject(); 2108var itemsAndProperties = new JsonObject(); 2273var itemsAndProperties = new JsonObject(); 2390var itemsAndProperties = new JsonObject(); 2510var itemsAndProperties = new JsonObject(); 2623var itemsAndProperties = new JsonObject(); 2991var itemsAndProperties = new JsonObject(); 3073var itemsAndProperties = new JsonObject(); 3169var itemsAndProperties = new JsonObject(); 3173var items = new JsonObject 3177new JsonObject { ["Identity"] = "Aspire.Hosting.AppHost", ["Version"] = "9.4.1" }, 3178new JsonObject { ["Identity"] = "Aspire.Hosting.Redis", ["Version"] = "9.4.1" }, 3260var itemsAndProperties = new JsonObject(); 3262var items = new JsonObject 3266new JsonObject { ["Identity"] = "Aspire.Hosting.AppHost", ["Version"] = "9.5.0" }, 3336var itemsAndProperties = new JsonObject(); 3417var itemsAndProperties = new JsonObject(); 3506var itemsAndProperties = new JsonObject(); 3585var itemsAndProperties = new JsonObject(); 3665var itemsAndProperties = new JsonObject(); 3818var itemsAndProperties = new JsonObject(); 4204var itemsAndProperties = new JsonObject(); 4312var itemsAndProperties = new JsonObject(); 4393var itemsAndProperties = new JsonObject(); 4475var itemsAndProperties = new JsonObject(); 4524JsonObject properties = new JsonObject(); 4536JsonObject items = new JsonObject(); 4564JsonObject newPackageReference = new JsonObject 4580JsonObject newPackageReference = new JsonObject 4596JsonObject newProjectReference = new JsonObject 4607JsonObject properties = new JsonObject();
Scaffolding\ScaffoldingServiceTests.cs (2)
166var scripts = new JsonObject(); 189var scripts = new JsonObject();
Secrets\SecretStoreResolverTests.cs (2)
437SecretsStore.SaveJson(path, new System.Text.Json.Nodes.JsonObject { ["Count"] = i }); 483SecretsStore.SaveJson(path, new JsonObject { ["Count"] = 42 });
TestServices\TestConfigSourceServices.cs (2)
25: new JsonObject(); 99= (_, _) => Task.FromResult(("version-1", new JsonObject()));
TestServices\TestDotNetCliRunner.cs (2)
173var values = new JsonObject(properties.Select(name => 180return JsonDocument.Parse(new JsonObject { ["Properties"] = values }.ToJsonString());
Aspire.Dashboard (3)
Model\GenAI\GenAIItemPartViewModel.cs (1)
140var jsonObject = new JsonObject();
Model\TelemetryExportService.cs (1)
808var jsonObject = new JsonObject();
Otlp\Model\OtlpHelpers.cs (1)
224var o = new JsonObject();
Aspire.Dashboard.Tests (10)
Integration\OtlpGrpcServiceTests.cs (6)
166var configJson = new JsonObject 168["Dashboard"] = new JsonObject 170["Otlp"] = new JsonObject 214configJson = new JsonObject 216["Dashboard"] = new JsonObject 218["Otlp"] = new JsonObject
Integration\StartupTests.cs (3)
685var configJson = new JsonObject 687["Logging"] = new JsonObject 689["LogLevel"] = new JsonObject
Model\DashboardDataSourceTests.cs (1)
846metadata["FutureMetadata"] = new JsonObject
Aspire.Hosting (18)
Backchannel\AuxiliaryBackchannelRpcTarget.cs (1)
1437var jsonObject = new JsonObject();
Dcp\JsonPatch.cs (1)
107var result = new JsonObject
Dcp\PersistentPortAllocationStore.cs (4)
122var resourcesObject = new JsonObject(); 129endpointsObject = new JsonObject(); 135endpointObject = new JsonObject(); 142return new JsonObject
Pipelines\Internal\DeploymentStateManagerBase.cs (1)
339nextObj = new JsonObject();
Pipelines\Internal\FileDeploymentStateManager.cs (2)
383new JsonObject { [""] = sectionValue.DeepClone() }, 800var migrationState = new JsonObject
Pipelines\Internal\JsonFlattener.cs (3)
21var result = new JsonObject(); 34var result = new JsonObject(); 46var newObject = new JsonObject();
Publishing\ContainerImageArchiveRewriter.cs (2)
281var rewrittenRepositories = new JsonObject(); 300var rewrittenTags = new JsonObject();
src\Shared\Json\JsonFlattener.cs (3)
18var result = new JsonObject(); 28var result = new JsonObject(); 40var newObject = new JsonObject();
src\Shared\UserSecrets\SecretsStore.cs (1)
102var obj = new JsonObject();
Aspire.Hosting.Azure (17)
AzureDeploymentOperationDetails.cs (3)
78var json = new JsonObject 136var json = new JsonObject(); 171return new JsonObject
AzureProvisioningController.cs (7)
2552json["remainingResources"] = new JsonArray([.. result.RemainingResources.Select(resource => (JsonNode)new JsonObject 2636var json = new JsonObject 2672var json = new JsonObject 2763return new JsonObject 2793var json = new JsonObject 2802["azureContext"] = new JsonObject 2847var json = new JsonObject
AzureProvisioningFailureDetails.cs (2)
377array.Add(new JsonObject 455var json = new JsonObject
Provisioning\BicepUtilities.cs (2)
74parameters[parameter.Key] = new JsonObject() 156? new JsonObject()
Provisioning\JsonExtensions.cs (1)
22node = new JsonObject();
Provisioning\Provisioners\BicepProvisioner.cs (2)
565var parameters = new JsonObject(); 568var scope = new JsonObject();
Aspire.Hosting.Azure.EntraId.Tests (2)
LocalDeveloperCertificateProvisioningTests.cs (2)
28var parameters = new JsonObject(); 31var section = new DeploymentStateSection("entra-web", new JsonObject { ["Parameters"] = parameters.ToJsonString() }, 0);
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)
AzureSandboxContainerDeployment.cs (6)
365portStates.Add(new JsonObject 2012return new JsonObject 2018.Select(static endpoint => (JsonNode)new JsonObject 2031.Select(static identity => (JsonNode)new JsonObject 2037["EgressPolicy"] = new JsonObject 2045.Select(static rule => (JsonNode)new JsonObject
Aspire.Hosting.Azure.Tests (99)
AzureBicepProvisionerTests.cs (8)
37var parameters = new JsonObject(); 933var parameters = new JsonObject(); 969var parameters = new JsonObject(); 1020var parameters = new JsonObject(); 1909var parameters = new JsonObject(); 1912var scope = new JsonObject(); 1925=> new() 1927["blobEndpoint"] = new JsonObject
AzureBicepResourceTests.cs (1)
181.WithParameter("param3", new JsonObject() { ["value"] = "nested" })
AzureDeployerTests.cs (3)
1939var cachedState = new JsonObject 2239stateManager.SetSection("Azure", new JsonObject 2291stateManager.SetSection("Azure", new JsonObject
AzureEnvironmentResourceExtensionsTests.cs (8)
2111storageSection.Data["Outputs"] = new JsonObject 2113["id"] = new JsonObject 2214keyVaultSection.Data["Outputs"] = new JsonObject 2216["id"] = new JsonObject 3353storageSection.Data["Outputs"] = new JsonObject 3355["id"] = new JsonObject 3674storageSection.Data["Outputs"] = new JsonObject 3676["id"] = new JsonObject
AzureEventHubsExtensionsTests.cs (1)
395document["UserConfig"]!["LoggingConfig"] = new JsonObject { ["Type"] = "Console" };
AzureSandboxesTests.cs (14)
47state.Data["Ports"] = new JsonArray(new JsonObject 821new JsonObject { ["OwnerId"] = "owner-1" }, 825new JsonObject(), 837new JsonObject 903new JsonObject 939new JsonObject 1006new JsonObject 1123var state = new DeploymentStateSection("sandbox", new JsonObject 1127["Ports"] = new JsonArray(new JsonObject { ["Port"] = 8080 }) 1161var state = new DeploymentStateSection("sandbox", new JsonObject 1165["Ports"] = new JsonArray(new JsonObject { ["Port"] = 8080 }) 2852state.Data["Ports"] = new JsonArray(new JsonObject 2987new JsonObject 3271state.Data["Ports"] = new JsonArray(new JsonObject
AzureServiceBusExtensionsTests.cs (1)
504document["UserConfig"]!["Logging"] = new JsonObject { ["Type"] = "Console" };
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
JsonExtensionsTests.cs (3)
14var rootJson = new JsonObject(); 30var rootJson = new JsonObject(); 44var rootJson = new JsonObject();
ProvisioningTestHelpers.cs (1)
1056: new JsonObject();
Aspire.Hosting.Azure.WebPubSub (5)
AzureWebPubSubExtensions.cs (5)
220var hubs = new JsonObject(); 236handlers.Add(new JsonObject 243hubs[hub.HubName] = new JsonObject { ["EventHandlers"] = handlers }; 246var config = new JsonObject { ["WebPubSub"] = new JsonObject { ["Hubs"] = hubs } };
Aspire.Hosting.Blazor (3)
GatewayConfigurationBuilder.cs (3)
222var environment = new JsonObject(); 253var config = new JsonObject 255["webAssembly"] = new JsonObject
Aspire.Hosting.CodeGeneration.Go (9)
GoApiExportWriter.cs (9)
35declarations.Add((JsonNode)new JsonObject 43return new JsonObject 47["generator"] = new JsonObject 52["package"] = new JsonObject 82var json = new JsonObject { ["name"] = module.Name }; 90var json = new JsonObject 122var json = new JsonObject 166var optionsJson = new JsonObject { ["typeName"] = options.TypeName }; 184var json = new JsonObject
Aspire.Hosting.CodeGeneration.Go.Tests (1)
GoGeneratorEscapingTests.cs (1)
208ExportedValue(["Emoji", "Lookup"], lookupType, new JsonObject { ["\U0001F600"] = "\U0001F600" }),
Aspire.Hosting.CodeGeneration.Java.Tests (1)
AtsJavaCodeGeneratorTests.cs (1)
3854Value = new JsonObject { ["Default"] = "probe" },
Aspire.Hosting.CodeGeneration.TypeScript (10)
TypeScriptApiExportWriter.cs (8)
34declarations.Add((JsonNode)new JsonObject 42return new JsonObject 46["generator"] = new JsonObject 51["package"] = new JsonObject 80var json = new JsonObject { ["name"] = module.Name }; 88var json = new JsonObject 123var json = new JsonObject 150var parameterJson = new JsonObject
TypeScriptLanguageSupport.cs (2)
128var packageJson = new JsonObject(); 214obj = new JsonObject();
Aspire.Hosting.Docker.Tests (1)
DockerComposeTests.cs (1)
968stateManager.SetSection("DockerCompose:env", new System.Text.Json.Nodes.JsonObject
Aspire.Hosting.Kubernetes (2)
KubernetesEnvironmentResource.cs (2)
2123var metadataNode = new System.Text.Json.Nodes.JsonObject 2143var minimal = new System.Text.Json.Nodes.JsonObject
Aspire.Hosting.Kubernetes.Tests (4)
KubernetesDeployTests.cs (4)
1931stateManager.SetSection("Helm:env", new JsonObject 2002stateManager.SetSection("Helm:env", new JsonObject 2047stateManager.SetSection("Helm:env", new JsonObject 2095stateManager.SetSection("HelmChart:env:podinfo", new JsonObject
Aspire.Hosting.Native.Client (2)
Authoring\NativePipeline.cs (2)
112var graph = new JsonObject 115["steps"] = new JsonArray(_steps.Select(step => (JsonNode)new JsonObject
Aspire.Hosting.Native.CodeGeneration (7)
NativeProviderProjection.cs (4)
36var manifest = new JsonObject { ["protocolVersion"] = 2, ["capabilities"] = new JsonArray() }; 68capabilities.Add(new JsonObject 182JsonObject Parameter(string name, Type type) => new() { ["name"] = name, ["type"] = TypeRef(type) }; 183JsonObject TypeRef(Type type) => new() { ["typeId"] = TypeId(type), ["category"] = IsHandle(type) ? "Handle" : "Primitive" };
Program.cs (3)
215await File.WriteAllTextAsync(Path.Combine(output, "languages.json"), new JsonArray(new JsonObject 241"export const nativeTypes = " + new JsonObject(context.HandleTypes.Select(handle => KeyValuePair.Create( 242handle.ClrType!.Name, (JsonNode?)new JsonObject { ["typeId"] = handle.AtsTypeId, ["category"] = "Handle" }))).ToJsonString() +
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"] = "" })));
DcpWorkloadCleanupTests.cs (1)
68("context", context.Writer), ("container", new JsonObject
NativeAuxiliaryBackchannelTests.cs (1)
348Arguments = new JsonObject { ["unsupported"] = "value" }
NativeCliControlTests.cs (1)
79var request = new JsonObject
NativeComposeCSharpTests.cs (9)
38var snapshot = new JsonObject { ["compose"] = first.Compose, ["inputs"] = first.Inputs }; 80cache["mounts"]!.AsArray().Add(new JsonObject 88web["environment"]!.AsObject()["MESSAGE"] = new JsonObject { ["kind"] = "parameter", ["name"] = "message" }; 113context.Model["resources"]!.AsArray().Add(new JsonObject 116["configuration"] = new JsonObject { ["publish.dockerCompose"] = """{"exclude":true}""" } 127var request = new JsonObject 129["context"] = new JsonObject 135["environment"] = new JsonObject(environment.Select(pair => KeyValuePair.Create(pair.Key, (JsonNode?)JsonValue.Create(pair.Value)))) 357new(new JsonObject(), AppContext.BaseDirectory, AppContext.BaseDirectory, "Comparison", TestContext.Current.CancellationToken), "publish"));
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"] = "" }))));
NativeLanguageCatalogTests.cs (2)
22prefix => new JsonObject { ["library.custom"] = prefix }); 39var catalog = new NativeLanguageCatalog(registrations, _ => new());
NativeProviderClientTests.cs (2)
62var response = new JsonObject 134var response = new JsonObject
NativeRpcTests.cs (1)
167Assert.Equal("INVALID_ARGUMENT", Error(client.Invoke("createSession", new JsonObject { ["unexpected"] = true })));
NativeSocketIsolationTests.cs (1)
147Arguments(("context", writer), ("container", new JsonObject
ResourceWorkloadTests.cs (2)
35("context", context.Writer), ("container", new JsonObject 55("context", context.Writer), ("container", new JsonObject
RuntimeRpcTests.cs (2)
51("context", context.Reader), ("observation", new JsonObject { ["state"] = "Running", ["healthy"] = true, ["urls"] = new JsonArray() }))))); 111("requestId", pending["requestId"]), ("result", new JsonObject { ["status"] = "succeeded", ["message"] = "refreshed" })));
TestServices\LifecycleProviderTestIntegration.cs (6)
28static JsonObject Type(string id, string category = "Handle") => new() { ["typeId"] = id, ["category"] = category }; 29static JsonObject Parameter(string name, JsonObject type) => new() { ["name"] = name, ["type"] = type }; 32new JsonObject 42methods.Add(new JsonObject 53methods.Add(new JsonObject 62var manifest = new JsonObject { ["protocolVersion"] = 2, ["capabilities"] = methods };
TestServices\NativeSocketTestHost.cs (1)
106var request = new JsonObject
TestServices\RpcTestClient.cs (2)
51var request = new JsonObject 85new(values.Select(value => KeyValuePair.Create(value.Name, value.Value?.DeepClone())));
TestServices\RuntimeRpcTestContext.cs (1)
54Integration.Invoke("publishObservation", Arguments(("context", Writer), ("observation", new JsonObject
TestServices\WorkspaceRpcTestContext.cs (1)
58Arguments(("context", Writer), ("observation", new JsonObject
WorkloadDefinitionTests.cs (3)
107private static JsonObject Launch() => new() 111["mounts"] = new JsonArray(new JsonObject 119private static JsonObject Endpoint(string name, string scheme, int port) => new()
Aspire.Hosting.Native.Server (24)
Api\PublishingApi.cs (12)
20text => new() { ["kind"] = "literal", ["value"] = text }, 21name => new() { ["kind"] = "parameter", ["name"] = name }, 22(resource, endpoint, property) => new() 27parts => new() { ["kind"] = "composite", ["parts"] = new JsonArray(parts.Cast<JsonNode>().ToArray()) }, 28inner => new() { ["kind"] = "uriEncoded", ["value"] = inner }); 35var environment = new JsonObject(); 37var configuration = new JsonObject(resource.Configuration.Select(entry => 61resources.Add((JsonNode)new JsonObject 73["endpoints"] = new JsonArray((plan?.Endpoints ?? []).Select(endpoint => (JsonNode)new JsonObject 80["mounts"] = new JsonArray(((plan as ContainerWorkload)?.Mounts ?? []).Select(mount => (JsonNode)new JsonObject 92return new JsonObject 100["parameterDefaults"] = new JsonObject(snapshot.Parameters.Where(parameter => parameter.HasDefault)
Rpc\NativeHandles.cs (1)
42return new JsonObject { ["$handle"] = id, ["$type"] = typeId };
Rpc\NativeLanguageCatalog.cs (2)
102var files = new JsonObject(); 117files["apphost-server.json"] = new JsonObject
Rpc\NativeProviderLifecycle.cs (2)
70var arguments = new JsonObject 72[receiver] = new JsonObject { ["$handle"] = binding.ObjectId, ["$type"] = binding.TypeId },
Rpc\NativeProviderRegistry.cs (5)
182return new JsonObject 212var mapped = new JsonObject(); 324JsonObject obj => new JsonObject(obj.Select(pair => KeyValuePair.Create(pair.Key, Translate(pair.Value)))), 348JsonObject obj => new JsonObject(obj.Select(pair => KeyValuePair.Create(pair.Key, DelegateResult(pair.Value)))), 370var mapped = new JsonObject();
Rpc\NativeRpcConnection.cs (1)
198var arguments = new JsonObject { ["p0"] = handle };
Rpc\NativeRpcPeer.cs (1)
42var payload = JsonSerializer.SerializeToUtf8Bytes(new JsonObject
Aspire.Hosting.Radius (3)
Publishing\RadiusDeploymentPipelineStep.cs (3)
675var parametersNode = new JsonObject(); 685parametersNode[identifier] = new JsonObject { ["value"] = value }; 688var document = new JsonObject
Aspire.Hosting.RemoteHost (8)
Ats\AtsCallbackProxyFactory.cs (1)
313args ??= new JsonObject();
Ats\AtsError.cs (2)
45var obj = new JsonObject 96var obj = new JsonObject();
Ats\CapabilityDispatcher.cs (2)
282return Task.FromResult<JsonNode?>(new JsonObject 575args ??= new JsonObject();
Ats\HandleRegistry.cs (1)
141return new JsonObject
RemoteAppHostService.cs (2)
146return new JsonObject 180return new JsonObject
Aspire.Hosting.RemoteHost.Tests (272)
AtsMarshallerTests.cs (53)
401var json = new JsonObject 442var json = new JsonObject { ["$handle"] = handleId }; 454var json = new JsonObject { ["$handle"] = "aspire/Unknown:999" }; 490var json = new JsonObject { ["key1"] = 1, ["key2"] = 2 }; 768var json = new JsonObject { ["a"] = 1, ["b"] = 2 }; 781var json = new JsonObject { ["value"] = 42 }; 794var json = new JsonObject { ["name"] = "test", ["count"] = 5 }; 808var json = new JsonObject 814new JsonObject 816["$expr"] = new JsonObject 852var json = new JsonObject 871var json = new JsonObject 906var json = new JsonObject { ["required"] = double.MaxValue }; 1054var source = new JsonObject { ["name"] = "updated", ["count"] = 42 }; 1067var source = new JsonObject { ["name"] = "updated" }; 1084var source = new JsonObject { ["count"] = JsonNode.Parse(countJson) }; 1098var source = new JsonObject { ["count"] = JsonNode.Parse(countJson) }; 1109var source = new JsonObject 1112["complex"] = new JsonObject { ["value"] = "should-be-ignored" } 1126var source = new JsonObject { ["display_name"] = "updated", ["val"] = 99 }; 1140var source = new JsonObject { ["displayName"] = "should-not-apply" }; 1152var source = new JsonObject { ["name"] = "updated", ["secret"] = "should-be-ignored" }; 1165var source = new JsonObject { ["name"] = "updated", ["computed"] = "should-be-ignored" }; 1179var source = new JsonObject { ["count"] = "not-a-number" }; 1192var source = new JsonObject 1428var json = new JsonObject 1430["$expr"] = new JsonObject 1432["condition"] = new JsonObject 1436["whenTrue"] = new JsonObject 1438["$expr"] = new JsonObject 1443["whenFalse"] = new JsonObject 1445["$expr"] = new JsonObject 1469var json = new JsonObject 1471["$expr"] = new JsonObject 1473["condition"] = new JsonObject 1477["whenTrue"] = new JsonObject 1479["$expr"] = new JsonObject 1484["whenFalse"] = new JsonObject 1486["$expr"] = new JsonObject 1511var json = new JsonObject 1513["$expr"] = new JsonObject 1515["condition"] = new JsonObject 1519["whenTrue"] = new JsonObject 1521["$expr"] = new JsonObject 1526["whenFalse"] = new JsonObject 1528["$expr"] = new JsonObject 1550var json = new JsonObject 1552["$expr"] = new JsonObject 1554["condition"] = new JsonObject 1558["whenTrue"] = new JsonObject 1560["$expr"] = new JsonObject 1565["whenFalse"] = new JsonObject 1567["$expr"] = new JsonObject
CallbackProxyTests.cs (11)
24ResultToReturn = new JsonObject 26["p0"] = new JsonObject 361ResultToReturn = new JsonObject 363["p0"] = new JsonObject { ["name"] = "modified", ["count"] = 42 } 383ResultToReturn = new JsonObject 385["p0"] = new JsonObject { ["name"] = "async-modified", ["count"] = 99 } 407ResultToReturn = new JsonObject 410["p1"] = new JsonObject { ["name"] = "mixed-modified", ["count"] = 77 } 450ResultToReturn = new JsonObject 452["p0"] = new JsonObject { ["name"] = "first-updated", ["count"] = 10 }, 453["p1"] = new JsonObject { ["name"] = "second-updated", ["count"] = 20 }
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" },
HandleRegistryTests.cs (7)
243var json = new JsonObject { ["$handle"] = "42" }; 272var json = new JsonObject { ["name"] = "test", ["value"] = 42 }; 282var json = new JsonObject { ["$handle"] = 42 }; 291var json = new JsonObject 307var json = new JsonObject { ["$handle"] = "1" }; 329var json = new JsonObject { ["name"] = "test" }; 338var json = new JsonObject { ["$handle"] = 42 };
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
ReferenceExpressionRefTests.cs (18)
17var json = new JsonObject 19["$expr"] = new JsonObject 38var json = new JsonObject 40["$expr"] = new JsonObject 45new JsonObject { ["$handle"] = "aspire/EndpointReference:1" }, 46new JsonObject { ["$handle"] = "aspire/EndpointReference:2" } 65var json = new JsonObject 91var json = new JsonObject 93["$expr"] = new JsonObject { ["format"] = "test" } 104var json = new JsonObject { ["format"] = "test" }; 137new JsonObject { ["$handle"] = handle1 }, 138new JsonObject { ["$handle"] = handle2 } 158new JsonObject { ["$handle"] = "aspire/NonExistent:999" } 197new JsonObject { ["$handle"] = handle }, 222var exprRef = new ReferenceExpressionRef_Accessor(format, [new JsonObject { ["$handle"] = handle }]); 237new JsonObject { ["invalid"] = "not-a-handle" } // Invalid format (not a handle or string) 255var json = new JsonObject 257["$expr"] = new JsonObject
RemoteHostProfilingTelemetryTests.cs (1)
161new JsonObject
Aspire.Hosting.Tests (35)
Dcp\AppHostLocalStateStoreTests.cs (2)
87stateStore.Update("runtime", _ => new JsonObject 106stateStore.Update("portAllocations", _ => new JsonObject
JsonFlattenerTests.cs (20)
16var userSecrets = new JsonObject 19["Azure"] = new JsonObject 22["Deployments"] = new JsonObject 24["MyStorage"] = new JsonObject 50var userSecrets = new JsonObject 71var userSecrets = new JsonObject(); 84var userSecrets = new JsonObject 86["Level1"] = new JsonObject 88["Level2"] = new JsonObject 90["Level3"] = new JsonObject 110var userSecrets = new JsonObject 116["Nested"] = new JsonObject 139var userSecrets = new JsonObject 168var userSecrets = new JsonObject 171new JsonObject { ["Name"] = "Item1", ["Value"] = "Value1" }, 172new JsonObject { ["Name"] = "Item2", ["Value"] = "Value2" } 174["NestedConfig"] = new JsonObject 177new JsonObject 180["Settings"] = new JsonObject { ["Enabled"] = true } 203var userSecrets = new JsonObject
Publishing\ContainerImageArchiveRewriterTests.cs (1)
453var metadata = new JsonObject();
Publishing\DeploymentStateManagerTests.cs (12)
224var state = new JsonObject 517await migratingStateManager.SaveStateAsync(new JsonObject 519["Replacement"] = new JsonObject 710firstSection.Data["Features"] = new JsonObject { ["A"] = true }; 711secondSection.Data["Features"] = new JsonObject { ["B"] = true }; 795legacyAzureSection.Data["Sandboxes"] = new JsonObject 797["first"] = new JsonObject { ["SandboxId"] = "first-sandbox" }, 798["second"] = new JsonObject { ["SandboxId"] = "second-sandbox" } 831legacyAzureSection.Data["Sandboxes"] = new JsonObject 833["legacy"] = new JsonObject { ["SandboxId"] = "legacy-sandbox" } 871legacySandboxesSection.Data["first"] = new JsonObject 876legacySandboxesSection.Data["second"] = new JsonObject
Aspire.Hosting.Yarp (4)
YarpJsonConfigGeneratorBuilder.cs (4)
83var jsonObject = new JsonObject(); 84var jsonProxyConfig = jsonObject["ReverseProxy"] = new JsonObject(); 96var routesNode = new JsonObject(); 110var routesNode = new JsonObject();
Aspire.Managed.Tests (9)
AppHostServerV2CodeGenerationTests.cs (9)
42await File.WriteAllTextAsync(request, new JsonObject 70await File.WriteAllTextAsync(request, new JsonObject 75new JsonObject 79["sdkFiles"] = new JsonObject { ["provider.mts"] = source }, 82new JsonObject 86["sdkFiles"] = new JsonObject(), 117await File.WriteAllTextAsync(request, new JsonObject 121["providers"] = new JsonArray((JsonNode)new JsonObject 125["sdkFiles"] = new JsonObject { [sdkFile] = source },
ConfigurationSchemaGenerator (13)
ConfigSchemaEmitter.cs (13)
44var root = new JsonObject(); 59var propertiesNode = new JsonObject(s_ignoreCaseNodeOptions); 62var categoryNode = new JsonObject(); 67parent["definitions"] = new JsonObject 69["logLevel"] = new JsonObject 125propertiesNode = new JsonObject(s_ignoreCaseNodeOptions); 140pathSegmentNode = new JsonObject(); 246propertiesNode = new JsonObject(); 286var propertyNode = new JsonObject(); 319var containerNode = new JsonObject(); 632new JsonObject 637new JsonObject 640["items"] = new JsonObject
dotnet-user-jwts (7)
Helpers\JwtAuthenticationSchemeSettings.cs (6)
20: new JsonObject(); 22var settingsObject = new JsonObject 38authentication.Add(SchemesKey, new JsonObject 46config[AuthenticationKey] = new JsonObject 48[SchemesKey] = new JsonObject 66return JsonSerializer.Deserialize(reader, JwtSerializerContext.Default.JsonObject) ?? new JsonObject();
Helpers\SigningKeysHandler.cs (1)
75secrets ??= new JsonObject();
GenerateTemplateManifest (4)
ComponentManifest.cs (4)
76_registrations[$"{type}/{name}/{version}"] = new JsonObject 78["component"] = new JsonObject 81[type] = new JsonObject { ["name"] = name, ["version"] = version } 93var manifest = new JsonObject
Infrastructure.Tests (402)
Pipelines\NpmCliPackageTests.cs (1)
261var packageMap = new JsonObject();
TemplateManifest\TemplateManifestCacheTests.cs (1)
58var manifests = new JsonObject
WorkflowScripts\AnalyzeCiFailureReportTemplatesTests.cs (1)
60overrides: new JsonObject { [key] = value });
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)
Extensions\JsonNodeSchemaExtensions.cs (1)
444var mappings = new JsonObject();
Schemas\OpenApiJsonSchema.Helpers.cs (1)
157var obj = new JsonObject();
Services\Schemas\OpenApiSchemaService.cs (21)
70schema = new JsonObject 79schema = new JsonObject 82[OpenApiSchemaKeywords.ItemsKeyword] = new JsonObject 99schema = new JsonObject(); 161var addReplaceTest = new JsonObject() 166[OpenApiSchemaKeywords.PropertiesKeyword] = new JsonObject 168["op"] = new JsonObject() 173["path"] = new JsonObject() 177["value"] = new JsonObject() 181var moveCopy = new JsonObject() 186[OpenApiSchemaKeywords.PropertiesKeyword] = new JsonObject 188["op"] = new JsonObject() 193["path"] = new JsonObject() 197["from"] = new JsonObject() 204var remove = new JsonObject() 209[OpenApiSchemaKeywords.PropertiesKeyword] = new JsonObject 211["op"] = new JsonObject() 216["path"] = new JsonObject() 223return new JsonObject 227[OpenApiSchemaKeywords.ItemsKeyword] = new JsonObject 617var newObject = new JsonObject();
Microsoft.Extensions.AI (4)
ChatCompletion\ChatClientStructuredOutputExtensions.cs (2)
162schema = JsonSerializer.SerializeToElement(new JsonObject 166{ "properties", new JsonObject { { "data", JsonElementToJsonNode(schema) } } },
Realtime\LoggingRealtimeClientSession.cs (2)
189var obj = new JsonObject 212var obj = new JsonObject
Microsoft.Extensions.AI.Abstractions (9)
Utilities\AIJsonUtilities.Schema.Create.cs (7)
90JsonObject parameterSchemas = new(); 149JsonNode schema = new JsonObject(); 261return schemaObj ?? new JsonObject(); 266return new JsonObject { [TypePropertyName] = null }; 313objSchema.Add(ItemsPropertyName, new JsonObject()); 414schema = obj = new() { [NotPropertyName] = true }; 651(JsonObject)(obj[NotPropertyName] = new JsonObject());
Utilities\AIJsonUtilities.Schema.Transform.cs (2)
50schema = new JsonObject { [NotPropertyName] = (JsonNode)true }; 58schema = new JsonObject();
Microsoft.Extensions.AI.Abstractions.Tests (2)
test\Shared\JsonSchemaExporter\TestTypes.cs (1)
105yield return new TestData<JsonObject>(new() { ["x"] = 42 }, """{"type":["object","null"]}""");
Utilities\AIJsonUtilitiesTests.cs (1)
273? new JsonObject
Microsoft.Extensions.AI.Evaluation.Quality (1)
AIToolExtensions.cs (1)
25new JsonObject
Microsoft.Extensions.AI.Evaluation.Safety (13)
ContentSafetyServicePayloadUtilities.cs (13)
149new JsonObject 200var item = new JsonObject(); 231new JsonObject 282yield return new JsonObject 297yield return new JsonObject 306yield return new JsonObject 322yield return new JsonObject 330yield return new JsonObject 334new JsonObject 342yield return new JsonObject 346new JsonObject 357new JsonObject 362new JsonObject
Microsoft.NET.Build.Containers (9)
ImageConfig.cs (7)
90var newConfig = new JsonObject(); 151var configContainer = new JsonObject() 156["rootfs"] = new JsonObject() 173var history = new JsonObject(); 304JsonObject container = new(); 307container.Add($"{port.Number}/{port.Type}", new JsonObject()); 325JsonObject container = new();
LocalDaemons\ContainerArchive.cs (1)
166new JsonObject
LocalDaemons\DockerCli.cs (1)
391JsonNode manifestNode = new JsonArray(new JsonObject
Microsoft.NET.Build.Tasks (4)
GenerateRuntimeConfigurationFiles.cs (4)
325configProperties = new JsonObject(); 416JsonObject json = new() 438JsonObject json = new(); 505JsonObject json = new();
Microsoft.NETCore.Platforms (1)
UpdateRuntimeIdentifierGraph.cs (1)
42runtimes.Add(rid.ItemSpec, new JsonObject { ["#import"] = new JsonArray([.. importedRids]) });
Microsoft.TemplateEngine.Cli (3)
Alias\AliasRegistry.cs (2)
149JsonObject root = new(); 150JsonObject commandAliases = new();
PostActionProcessors\AddJsonPropertyPostActionProcessor.cs (1)
270node[property] = childNode = new JsonObject();
Microsoft.TemplateEngine.Orchestrator.RunnableProjects (1)
OperationConfig\BalancedNestingConfig.cs (1)
34JsonObject config = new JsonObject
MSBuild (8)
JsonOutputFormatter.cs (7)
20private readonly JsonNode _topLevelNode = new JsonObject(); 36JsonNode propertiesNode = new JsonObject(); 54JsonNode itemsNode = new JsonObject(); 60JsonObject jsonItem = new(); 90JsonObject targetResultsNode = new(); 94JsonObject targetResults = new(); 99JsonObject jsonItem = new();
XMake.cs (1)
4838var jsonNode = new JsonObject();
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)))),
DockerComposeBuilderExtensions.cs (2)
20internal string Configuration() => new JsonObject 52parameters.Add(new JsonObject { ["name"] = parameter.Resource.Name, ["environmentVariable"] = variable });
DockerComposeEnvironment.cs (4)
148dependencies[dependency] = new JsonObject { ["condition"] = producer["healthcheck"] is null ? "service_started" : "service_healthy" }; 340endpoints.Add(new JsonObject 345services.Add(new JsonObject 352return new() { ["schemaVersion"] = 1, ["projectName"] = Text(plan.Compose, "name"), ["services"] = services };
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)
Plugins\Logging\AssemblyLogMessage.cs (1)
41var message = new JsonObject
Plugins\Logging\CommunicationLogMessage.cs (1)
27var message = new JsonObject
Plugins\Logging\EnvironmentVariablesLogMessage.cs (1)
34var message = new JsonObject();
Plugins\Logging\MachineLogMessage.cs (1)
21var message = new JsonObject
Plugins\Logging\PluginInstanceLogMessage.cs (1)
30var message = new JsonObject
Plugins\Logging\PluginLogMessage.cs (1)
31var outerMessage = new JsonObject
Plugins\Logging\ProcessLogMessage.cs (1)
30var message = new JsonObject
Plugins\Logging\StopwatchLogMessage.cs (1)
21var message = new JsonObject
Plugins\Logging\TaskLogMessage.cs (1)
30var message = new JsonObject
Plugins\Logging\ThreadPoolLogMessage.cs (1)
26var message = new JsonObject
SelectTests (5)
Program.cs (5)
589var selection = new JsonObject(); 627var root = new JsonObject 633["inputs"] = new JsonObject 694causeArray.Add(new JsonObject 704array.Add(new JsonObject
ServiceBus.AppHost (1)
AppHost.cs (1)
38document["UserConfig"]!["Logging"] = new JsonObject { ["Type"] = "Console" };
Shared.Tests (1)
JsonSchemaExporter\TestTypes.cs (1)
105yield return new TestData<JsonObject>(new() { ["x"] = 42 }, """{"type":["object","null"]}""");
Stress.ApiService (1)
Program.cs (1)
410var jsonWithUrl = new JsonObject
System.Text.Json (10)
System\Text\Json\Nodes\JsonObject.cs (4)
64JsonValueKind.Object => new JsonObject(element, options), 90? new JsonObject(jsonElement.Value.Clone(), Options) 91: new JsonObject(Options); 94var jObject = new JsonObject(Options)
System\Text\Json\Schema\JsonSchema.cs (2)
149var objSchema = new JsonObject(); 183var properties = new JsonObject();
System\Text\Json\Serialization\Converters\Node\JsonNodeConverter.cs (1)
89node = new JsonObject(element, options);
System\Text\Json\Serialization\Converters\Node\JsonObjectConverter.cs (3)
15jsonTypeInfo.CreateObjectForExtensionDataProperty = () => new JsonObject(options.GetNodeOptions()); 79return new JsonObject(jElement, options); 86JsonObject jObject = new JsonObject(options);
TestProject.AppHost (3)
TestProgram.cs (3)
177var root = new JsonObject(); 180var projectJson = new JsonObject(); 194var endpointJsonObject = new JsonObject
2503 references to JsonObject
AnalyzeCiFailure (98)
AnalysisDiagnostics.cs (3)
150var entry = new JsonObject 181var summary = new JsonObject 215internal static JsonObject DescribeException(Exception error) => new()
AnalysisPublicationQueries.cs (1)
43if (!(response is JsonObject && CiFailureJson.Text(response["state"]) is not null &&
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);
AnalysisPublisher.Overflow.cs (9)
18JsonObject? storedRun) 23var matches = inventory.OfType<JsonObject>().Where(issue => 30JsonObject? existing = null; 43existing = await _github.GetAsync($"repos/{_repository}/issues/{number}") as JsonObject; 59var owned = new Dictionary<int, JsonObject>(); 62foreach (var comment in comments.OfType<JsonObject>().Where(comment => 84owned.TryGetValue(page, out var previous); 189private sealed record OverflowPublication(JsonObject? Existing, string Body, List<OverflowContinuation> Continuations, string Title);
AnalysisRerunner.cs (1)
105if (current is not JsonObject run || !GitHubJson.TryReadId(run["id"], out var currentId) || currentId != bundle.Run.Id ||
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 &&
CauseIssueRenderer.cs (6)
31JsonObject cause, 40cause = (JsonObject)DiagnosticTextSanitizer.SanitizeCause(cause)!; 157internal static string? FitIssue(string body, JsonObject[] observations, int maxBytes = ValidationRules.MaximumCommentBytes) 315internal static JsonObject[] Observations(JsonObject history) 317.SelectMany(o => (Field(o, "tests") as JsonArray ?? []).OfType<JsonObject>()
CiFailureJson.cs (2)
111var obj = new JsonObject(); 134public static JsonNode? Field(JsonNode? node, string key) => node is JsonObject obj ? obj[key] : null;
CollectionProjection.cs (2)
36JsonObject last, 37JsonObject merge,
DiagnosticTextSanitizer.cs (3)
75JsonObject obj => new JsonObject(obj.Select(p => KeyValuePair.Create(p.Key, SanitizeJson(p.Value, limit, multiline)))), 95if (node is JsonObject obj) 105private static void SanitizeField(JsonObject node, string field, int limit = int.MaxValue, bool multiline = false)
Infrastructure\AnalysisGitHubClient.cs (1)
38if (row is not JsonObject)
TestResultArtifacts.cs (1)
64=> artifacts.OfType<JsonObject>().Select(artifact => new WorkflowArtifact(
WorkflowRunEvidenceCollector.cs (16)
107if (!(runMetadata is JsonObject && GitHubJson.ReadRequiredId(Field(runMetadata, "id")) == runId)) 112var run = (JsonObject)runMetadata!; 159var failedJobs = new JsonArray(allJobs.OfType<JsonObject>().Where(job => 337private async Task<long?> FindAssociatedPullRequestNumberAsync(AnalysisGitHubClient gitHub, JsonObject run) 382private async Task CollectMainBranchComparisonContextAsync(AnalysisGitHubClient gitHub, JsonObject run, long runId) 386JsonObject triggeringMergePr = []; 401JsonObject lastSuccessfulRun = []; 489annotations.OfType<JsonObject>().Any(annotation => 593if (!(pullRequest is JsonObject)) 626JsonObject run, 638foreach (var job in failedJobs.OfType<JsonObject>()) 652!artifacts.OfType<JsonObject>().Any(artifact => Text(artifact["name"]) == plan.ArtifactName && 726if (Field(artifactMetadata, "workflow_run") is JsonObject associatedRun) 791var matches = failedJobs.OfType<JsonObject>().Where(job => Text(job["name"]) == jobName).ToArray();
Workflows\AspireCiWorkflowConventions.cs (2)
19public bool IsAggregationJob(JsonObject job) 31public IReadOnlyList<TestArtifactExpectation> DescribeTestArtifacts(JsonObject job, int runAttempt)
Workflows\IGitHubWorkflowConventions.cs (2)
12bool IsAggregationJob(JsonObject job); 13IReadOnlyList<TestArtifactExpectation> DescribeTestArtifacts(JsonObject job, int runAttempt);
AnalyzeCiFailure.TestHost (4)
tests\AnalyzeCiFailure.Tests\TestServices\GitHubFixtureHandler.cs (4)
40var body = request.Content is null ? null : JsonNode.Parse(await request.Content.ReadAsStringAsync(cancellationToken)) as JsonObject; 205var response = new JsonObject { ["html_url"] = url, [createdKind == "issue" ? "number" : "id"] = JsonNode.Parse(digits.Length == 0 ? "0" : digits) }; 242private async Task<string> WriteBodyAsync(JsonObject body, CancellationToken cancellationToken)
AnalyzeCiFailure.Tests (53)
AnalyzeCiFailureBranchHistoryTests.cs (1)
39var run = await new BranchHistoryReader(github, "microsoft/aspire", branch)
AnalyzeCiFailureCohesionTests.cs (1)
72var json = JsonNode.Parse(TransientJson.Write(outcome))!.AsObject();
AnalyzeCiFailureCollectionTests.cs (2)
654var run = new JsonObject 797var artifact = new JsonObject
AnalyzeCiFailureEvidenceTests.cs (4)
104var source = new JsonObject 152var projection = JsonNode.Parse(await File.ReadAllTextAsync(output))!.AsObject(); 207var occurrence = AnalysisPublisher.CreateOccurrence( 316var projection = new JsonObject
AnalyzeCiFailureFixtures.cs (9)
60return node is JsonObject ? CiFailureJson.ToContract<T>(node) : null; 150var prMetadata = docs.GetValueOrDefault("pr-metadata.json") as JsonObject; 157var history = docs.GetValueOrDefault("candidate-merge-history-status.json") is JsonObject historyNode 164docs.GetValueOrDefault("last-successful-main-run.json") as JsonObject ?? [], 165docs.GetValueOrDefault("triggering-merge-pr.json") as JsonObject ?? [], 255foreach (var job in jobs.OfType<JsonObject>()) 259if (step is JsonObject entry)
AnalyzeCiFailureMigrationTests.cs (3)
59var occurrence = AnalysisPublisher.CreateOccurrence(accepted, Assert.Single(accepted.Causes), JsonValue.Create(value: 123)!, "2026-10-30T16:00:00Z"); 171var occurrence = AnalysisPublisher.CreateOccurrence(accepted, Assert.Single(accepted.Causes), JsonValue.Create(value: 123)!, "2026-10-21T01:00:00Z"); 390JsonObject? history = scenario == "existing-missing" ? null : new JsonObject
AnalyzeCiFailureOccurrenceTests.cs (1)
78JsonObject[] tests = observations
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
AnalyzeCiFailureRenderingTests.cs (2)
64(JsonObject)CiFailureJson.Read(args[0])!, 99((JsonArray)CiFailureJson.Read(args[3])!).OfType<JsonObject>()
AnalyzeCiFailureTextTests.cs (1)
169var document = new JsonObject { ["job_id"] = "123", ["classification"] = "code-issue" };
AnalyzeCiFailureWorkflowAdapterTests.cs (3)
25var job = new JsonObject 56var job = JsonNode.Parse($$""" 91var job = new JsonObject
AnalyzeCiFailureWorkflowTests.cs (8)
1323else if (input["pr"] is System.Text.Json.Nodes.JsonObject pr && (pr["number"] is null || pr["number"]!.GetValue<int>() != 42)) 1377else if (tests[0] is not System.Text.Json.Nodes.JsonObject oldTest) 4296var occurrence = CreateTrustedOccurrence(runScope, trustedPrNumbers, "Tests"); 4303var definition = System.Text.Json.Nodes.JsonNode.Parse( 4305var existing = System.Text.Json.Nodes.JsonNode.Parse( 4307var occurrence = System.Text.Json.Nodes.JsonNode.Parse("""{"run_id":2,"observed_at":"2026-08-31T12:00:00Z"}""")!.AsObject(); 5023var occurrence = CreateTrustedOccurrence("main", "", plainResult.Output.Trim()); 5158var run = await new AnalyzeCiFailure.BranchHistoryReader(github, "microsoft/aspire").FindLastSuccessfulRunAsync("137649006", failedRunCreatedAt, failedRunId);
TestServices\AlternateWorkflowConventions.cs (2)
18public bool IsAggregationJob(JsonObject job) 21public IReadOnlyList<TestArtifactExpectation> DescribeTestArtifacts(JsonObject job, int runAttempt)
TestServices\GitHubFixtureHandler.cs (4)
40var body = request.Content is null ? null : JsonNode.Parse(await request.Content.ReadAsStringAsync(cancellationToken)) as JsonObject; 205var response = new JsonObject { ["html_url"] = url, [createdKind == "issue" ? "number" : "id"] = JsonNode.Parse(digits.Length == 0 ? "0" : digits) }; 242private async Task<string> WriteBodyAsync(JsonObject body, CancellationToken cancellationToken)
aspire (311)
Agents\AgentConfiguration.cs (9)
30JsonObject? configuration = null; 34var original = await edit.ReadObjectForEditAsync(targets.Key, cancellationToken); 35var root = original?.DeepClone().AsObject() ?? new JsonObject(); 70public static JsonObject ParseObject(string json) 78public static JsonObject? ReadObject(string path) 129public async Task<JsonObject?> ReadObjectForEditAsync(string path, CancellationToken cancellationToken) 144public async Task PublishAsync(string path, JsonObject settings, CancellationToken cancellationToken) 201private static JsonObject? ParseFile(string path, byte[]? bytes) 270public JsonObject? Configuration { get; init; }
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\ClaudeCode\ClaudeCodeAgentClient.cs (9)
51JsonObject config, DirectoryInfo workspaceRoot, AgentConfigurationScope scope, 66public async Task<(JsonObject Config, string Path)> ReadMcpConfigAsync( 72JsonObject config, string configFilePath, bool configureServer, AgentConfigurationScope scope) 113JsonObject settings; 135case JsonObject existing: 147JsonObject hooks; 150if (hooksNode is not JsonObject hooksObject) 212if (postToolUse[groupIndex] is not JsonObject group 234if (node is not JsonObject hook)
Agents\Copilot\CopilotAgentClient.cs (4)
65JsonObject config, DirectoryInfo workspaceRoot, AgentConfigurationScope scope, 88public async Task<(JsonObject Config, string Path)> ReadMcpConfigAsync( 94JsonObject config, string configFilePath, bool configureServer, AgentConfigurationScope scope) 128var config = new JsonObject
Agents\IAgentClient.cs (3)
30JsonObject config, DirectoryInfo workspaceRoot, AgentConfigurationScope scope, 38Task<(JsonObject Config, string Path)> ReadMcpConfigAsync( 43JsonObject config, string configFilePath, bool configureServer, AgentConfigurationScope scope);
Agents\McpConfigFileHelper.cs (17)
21public JsonObject ServerConfiguration { get; init; } = new() 26public JsonObject? GlobalServerConfiguration { get; init; } 30/// Reads an existing MCP config file and parses it into a <see cref="JsonObject"/>, or creates a new one if the file doesn't exist. 36/// <returns>The parsed <see cref="JsonObject"/> from the file, or a new empty <see cref="JsonObject"/> if the file doesn't exist.</returns> 41public static async Task<JsonObject> ReadConfigAsync( 65return root as JsonObject 71JsonObject config, 76var servers = GetServerContainer(config, configuration.ServersPropertyName, configFilePath); 93var serverConfiguration = scope is AgentConfigurationScope.Global 102public static JsonObject? GetServerContainer(JsonObject config, string serverContainerKey, string configFilePath) 105if (serverContainer is not null && serverContainer is not JsonObject) 111return serverContainer as JsonObject; 114public static bool UpdateDeprecatedCommand(JsonObject config, string serverContainerKey) 116if (config[serverContainerKey] is not JsonObject servers || servers["aspire"] is not JsonObject aspire)
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);
Commands\InitCommand.cs (13)
288private static bool HasAspireifyRegistration(IAgentClient client, JsonObject configuration, IReadOnlyList<SkillSource> sources) 606JsonObject settings; 636if (settings["appHost"] is not JsonObject appHost) 671var existingProfilesObject = settings["profiles"] as JsonObject; 793private static bool TryReadAppHostProfilePorts(JsonObject profiles, out AppHostProfilePorts ports) 797if (profiles["https"] is not JsonObject https || profiles["http"] is not JsonObject http) 802var httpsEnv = https["environmentVariables"] as JsonObject; 803var httpEnv = http["environmentVariables"] as JsonObject; 875var settings = new JsonObject
Commands\ResourceCommand.cs (4)
279private static (JsonObject Arguments, string? ErrorMessage) CreateCommandArguments(ResourceSnapshotCommandArgument[] argumentInputs, string[] capturedArguments, CommandArgumentParseMode parseMode) 281var arguments = new JsonObject(); 371private static JsonObject CreateUnknownArguments(string[] capturedArguments) 373var arguments = new JsonObject();
Commands\SecretListCommand.cs (3)
82var obj = new JsonObject(); 131var root = new JsonObject(); 134var obj = new JsonObject();
Commands\TemplateManagementCommand.cs (5)
45public JsonObject ToJsonObject() 47JsonObject source = new(); 91JsonObject sources; 115JsonObject result = new(); 134var configuration = source is JsonObject definition
Configuration\ConfigSource.cs (1)
79internal sealed record ConfigSourceSnapshot(ConfigSourceMetadata Metadata, JsonObject Configuration);
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)
JsonSourceGenerationContext.cs (1)
32[JsonSerializable(typeof(JsonObject))]
Mcp\Tools\ExecuteResourceCommandTool.cs (2)
181private static JsonObject CreateCommandArguments(JsonElement commandArgumentsElement) 183var arguments = new JsonObject();
Migrations\MigrationDescriptor.cs (1)
32public JsonObject? Metadata { get; init; }
Migrations\TypeScriptAppHostMigration.cs (5)
200if (JsonNode.Parse(File.ReadAllText(configPath)) is not JsonObject root || 201root["appHost"] is not JsonObject appHost || 248}) is not JsonObject root || 288if (JsonNode.Parse(File.ReadAllText(packageJsonPath)) is not JsonObject root || 289root["scripts"] is not JsonObject scripts)
Npm\SigstoreNpmProvenanceChecker.cs (1)
206if (attestation is not JsonObject attestationObj)
Program.cs (1)
205var settings = JsonSerializer.SerializeToNode(config, JsonSourceGenerationContext.Default.AspireConfigFile)!.AsObject();
Projects\FallbackProjectParser.cs (5)
187var rootObject = new JsonObject(); 190var itemsObject = new JsonObject(); 196var packageObj = new JsonObject(); 207var projectObj = new JsonObject(); 217var propertiesObject = new JsonObject();
Projects\NativeProviderDescriptor.cs (2)
20if (JsonNode.Parse(json) is not JsonObject descriptor || 22descriptor["sdkFiles"] is not JsonObject { Count: <= 128 } files ||
Projects\RepositoryToolUpdater.cs (6)
285var content = JsonNode.Parse(originalContent)?.AsObject() ?? throw new JsonException("Expected a JSON object."); 292if (content[section] is JsonObject dependencies && dependencies[NpmPackageId] is { } version) 298else if (content["tools"] is JsonObject tools) 302if (string.Equals(name, DotNetPackageId, StringComparisons.NuGetPackageId) && tool is JsonObject properties) 324internal sealed record RepositoryToolManifest(FileInfo File, JsonObject Content, string OriginalContent, IReadOnlyList<RepositoryToolReference> References, bool IsNpm, bool IsRoot) 329internal sealed record RepositoryToolReference(JsonObject Properties, string Key, string Version);
Projects\TypeScriptAppHostToolchainResolver.cs (2)
363var packageJson = JsonNode.Parse(File.ReadAllText(packageJsonPath), documentOptions: ConfigurationHelper.ParseOptions) as 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;
src\Shared\ConsoleLogs\SharedAIHelpers.cs (13)
95var dto = GetLogEntryDto(logEntry, promptContext, getResourceName, dashboardBaseUrl); 144var dto = GetTraceDto(trace, promptContext, getResourceName, dashboardBaseUrl); 208public static JsonObject GetSpanDto( 220var attributesObj = new JsonObject(); 255var spanObj = new JsonObject 377public static JsonObject GetTraceDto( 388var spanObj = GetSpanDto(s, context, getResourceName, dashboardBaseUrl: null); 400var traceData = new JsonObject 512private static JsonObject StripNullProperties(JsonObject obj) 709public static JsonObject GetLogEntryDto( 722var attributesObject = new JsonObject(); 730var log = new JsonObject
src\Shared\Json\JsonFlattener.cs (13)
16public static JsonObject FlattenJsonObject(JsonObject source) 18var result = new JsonObject(); 26public static JsonObject UnflattenJsonObject(JsonObject source) 28var result = new JsonObject(); 33var current = result; 38if (!current.TryGetPropertyValue(key, out var existing) || existing is not JsonObject) 40var newObject = new JsonObject(); 56private static void FlattenJsonObjectRecursive(JsonObject source, string prefix, JsonObject result) 66if (kvp.Value is JsonObject nestedObject) 75if (array[i] is JsonObject arrayObject)
src\Shared\Telemetry\InternalMicrosoftDetector.cs (9)
709var deviceConfiguration = TryParseMacPlatformSsoSection(output, "Device Configuration"); 710var loginConfiguration = TryParseMacPlatformSsoSection(output, "Login Configuration"); 711var userConfiguration = TryParseMacPlatformSsoSection(output, "User Configuration"); 778if (kerberosStatusNodeEntry is not JsonObject kerberosStatus) 1661private static JsonObject? TryParseMacPlatformSsoSection(string output, string sectionName) 1709documentOptions: new JsonDocumentOptions { AllowTrailingCommas = true }) as JsonObject; 1875private static bool TryGetBoolean(JsonObject json, string propertyName, out bool value) 1883private static Uri? TryGetAbsoluteUri(JsonObject json, string propertyName) 1902private static string? TryGetString(JsonObject json, string propertyName)
src\Shared\UserSecrets\SecretsStore.cs (4)
102var obj = new JsonObject(); 114internal static void SaveJson(string filePath, JsonObject obj) 207var parsed = JsonNode.Parse(json, documentOptions: new JsonDocumentOptions 218var flat = JsonFlattener.FlattenJsonObject(parsed);
Templating\ConfiguredTemplateSourceService.cs (1)
35var inherited = await configSources.GetTemplateSourcesAsync(cancellationToken);
Templating\TemplateSourceConfiguration.cs (7)
165public static string GetPropertyName(JsonObject settings, string key, StringComparison comparison) => 168public static string ResolveEditKey(JsonObject settings, string key) 176if (parts.Length > 1 && settings[parts[0]] is JsonObject sources) 179if (parts.Length > 2 && sources[parts[1]] is JsonObject source) 188public static string ValidateEditKey(JsonObject settings, string key) 205if (settings[parts[0]] is { } templates && templates is not JsonObject) 220public static void ValidateEditedSource(JsonObject settings, string key)
Templating\TemplateSourceStore.cs (15)
19public async Task<JsonObject> ListAsync(ConfigSource? configSource, CancellationToken cancellationToken) 21var settings = await ReadAsync(GetSettingsFilePath(), cancellationToken); 24var inherited = configSource is null ? new JsonObject() 30public async Task AddAsync(string name, JsonObject source, CancellationToken cancellationToken) 41var settings = await ReadAsync(path, cancellationToken); 42var sources = GetSources(settings); 61var settings = await ReadAsync(path, cancellationToken); 62var sources = GetSources(settings); 87private static JsonObject GetSources(JsonObject settings) 92return value as JsonObject 95var sources = new JsonObject(); 100private static async Task<JsonObject> ReadAsync(string path, CancellationToken cancellationToken) 105var settings = JsonNode.Parse(content, nodeOptions: null, ConfigurationHelper.ParseOptions) 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);
Utils\EnvironmentChecker\AspireVersionCheck.cs (4)
423private static JsonObject BuildCliVersionMetadata(string? currentVersion, string? latestVersion, string? updateCommand, string? updateCheckError, string? identityChannel, string? latestVersionChannel) 425var metadata = new JsonObject(); 460private static JsonObject BuildAppHostVersionMetadata(string relativePath, string? version, string? pinnedChannel) 462var metadata = new JsonObject
Utils\EnvironmentChecker\DeprecatedAgentConfigCheck.cs (8)
56var config = JsonNode.Parse(content)?.AsObject(); 91private static bool HasDeprecatedMcpCommand(JsonObject config, AgentConfigLocation location) 105private static bool HasDeprecatedMcpServersArgs(JsonObject config, string serversKey) 107if (!config.TryGetPropertyValue(serversKey, out var serversNode) || serversNode is not JsonObject servers) 112if (!servers.TryGetPropertyValue("aspire", out var aspireNode) || aspireNode is not JsonObject aspire) 137private static bool HasDeprecatedMcpCommandArray(JsonObject config, string serversKey) 139if (!config.TryGetPropertyValue(serversKey, out var mcpNode) || mcpNode is not JsonObject mcp) 144if (!mcp.TryGetPropertyValue("aspire", out var aspireNode) || aspireNode is not JsonObject aspire)
Utils\EnvironmentChecker\DevCertsCheck.cs (3)
97var metadata = BuildCertificateMetadata(certInfos); 525private static JsonObject BuildCertificateMetadata(IReadOnlyList<DevCertInfo> certInfos) 530var certNode = new JsonObject
Utils\EnvironmentChecker\EnvironmentCheckResult.cs (1)
115public JsonObject? Metadata { get; init; }
Utils\EnvironmentChecker\GoAppHostToolingCheck.cs (2)
283private static JsonObject CreateMetadata(FileInfo appHostFile, Version? version) 285var metadata = new JsonObject
Utils\EnvironmentChecker\OperatingSystemCheck.cs (2)
142private static JsonObject BuildMetadata(OperatingSystemDetails details) 144var metadata = new JsonObject
Utils\EnvironmentChecker\VsCodeExtensionCheck.cs (2)
68var metadata = BuildMetadata(detection); 220private static JsonObject BuildMetadata(VsCodeExtensionDetection detection)
Aspire.Cli.EndToEnd.Tests (63)
ConfigSourceTests.cs (9)
27var original = await context.AssertSourceAppliedAsync("original"); 39var configuration = await context.AssertSourceAppliedAsync("original"); 101var original = await context.AssertSourceAppliedAsync("original"); 112var original = await context.CreateUnboundProjectAsync(); 122var original = await context.CreateUnboundProjectAsync(); 135var original = await context.AssertSourceAppliedAsync("original"); 148var original = await context.AssertSourceAppliedAsync("original"); 159var original = await context.AssertSourceAppliedAsync("original"); 172var original = await context.AssertSourceAppliedAsync("original");
CustomTemplateTests.cs (1)
104var listed = JsonNode.Parse(await File.ReadAllTextAsync(Path.Combine(workspace.WorkspaceRoot.FullName, "sources.json")))!.AsObject();
EmulatedLocalReleaseBuildTests.cs (1)
709var config = JsonNode.Parse(File.ReadAllText(configPath))?.AsObject()
Helpers\CliE2ETestHelpers.cs (1)
1194var config = File.Exists(configPath)
Helpers\ConfigSourceTestContext.cs (15)
68public async Task<JsonObject> CreateUnboundProjectAsync() 76var configuration = await ReadConfigurationAsync(); 134var configuration = await ReadConfigurationAsync(); 188var configuration = await ReadConfigurationAsync(); 227public async Task<JsonObject> AssertSourceAppliedAsync(string version) 229var configuration = await ReadConfigurationAsync(); 300var configuration = await ReadConfigurationAsync(); 355public async Task AssertConfigurationSourceAdoptedAsync(JsonObject original) 357var actual = await AssertSourceAppliedAsync("original"); 364public async Task AssertConfigurationUpdatedAsync(JsonObject original) 366var actual = await ReadConfigurationAsync(); 374public async Task AssertConfigurationUnchangedAsync(JsonObject original) 376var actual = await ReadConfigurationAsync(); 403private async Task<JsonObject> ReadConfigurationAsync() 466private void AssertSourceValues(JsonObject config, string version, string appliedVersion)
Helpers\IntegrationHostLifetimeTestHelper.cs (3)
102var config = JsonNode.Parse(File.ReadAllText(configPath))!.AsObject(); 106var packages = config["packages"]!.AsObject(); 119var manifest = JsonNode.Parse(File.ReadAllText(manifestPath))!.AsObject();
Helpers\TypeScriptAppHostToolchainTestHelpers.cs (1)
37var packageJson = JsonNode.Parse(File.ReadAllText(packageJsonPath))?.AsObject()
ProjectReferenceTests.cs (6)
77var config = JsonNode.Parse(File.ReadAllText(configPath))?.AsObject() 79var packages = config["packages"] as JsonObject ?? new JsonObject(); 314var config = JsonNode.Parse(configJson)?.AsObject() 316var packages = config["packages"] as JsonObject ?? new JsonObject();
SelfUpdateChannelPersistenceTests.cs (3)
57var createdConfig = ReadConfig(configPath); 112var updatedConfig = ReadConfig(configPath); 116private static JsonObject ReadConfig(string path)
SettledNpmReleasesTests.cs (2)
122var packument = new JsonObject 159private static JsonObject CreateVersion(string registryUrl, string version, byte[] tarball) => new()
SingleFileAppHostInitDotnetRunTests.cs (3)
87var runJson = JsonNode.Parse(File.ReadAllText(appHostRunJson))?.AsObject(); 89var httpsProfile = runJson["profiles"]?["https"]?.AsObject(); 93var httpsEnv = httpsProfile["environmentVariables"]?.AsObject();
TypeScriptEmptyAppHostTemplateTests.cs (1)
177var config = JsonNode.Parse(File.ReadAllText(configPath))?.AsObject()
TypeScriptLegacyAppHostTests.cs (2)
135var configJson = JsonNode.Parse(File.ReadAllText(configPath))!.AsObject(); 136var appHost = configJson["appHost"]!.AsObject();
TypeScriptMigrateAppHostTests.cs (3)
123var configJson = JsonNode.Parse(File.ReadAllText(configPath))!.AsObject(); 124var appHost = configJson["appHost"]!.AsObject(); 215var tsconfig = JsonNode.Parse(File.ReadAllText(Path.Combine(projectRoot, "tsconfig.apphost.json")))!.AsObject();
TypeScriptPolyglotTests.cs (12)
353var config = JsonNode.Parse(File.ReadAllText(configPath))!.AsObject(); 448var packageJson = JsonNode.Parse(File.ReadAllText(Path.Combine(projectRoot, "package.json")))!.AsObject(); 449var scripts = packageJson["scripts"]!.AsObject(); 490var rootDependencies = packageJson["dependencies"]?.AsObject(); 491var rootDevDependencies = packageJson["devDependencies"]?.AsObject(); 504var appHostPackageJson = JsonNode.Parse(File.ReadAllText(Path.Combine(appHostDirectory, "package.json")))!.AsObject(); 505var appHostScripts = appHostPackageJson["scripts"]!.AsObject(); 506var appHostDependencies = appHostPackageJson["dependencies"]!.AsObject(); 507var appHostDevDependencies = appHostPackageJson["devDependencies"]!.AsObject(); 520var config = JsonNode.Parse(File.ReadAllText(configPath))!.AsObject(); 521var appHost = config["appHost"]!.AsObject(); 525var packages = packagesNode!.AsObject();
Aspire.Cli.Tests (267)
Agents\AgentConfigurationTests.cs (13)
35var inline = AgentConfiguration.ParseObject(json); 36var file = AgentConfiguration.ReadObject(path); 38var tracked = await edit.ReadObjectForEditAsync(path, CancellationToken.None).DefaultTimeout(); 58var file = AgentConfiguration.ReadObject(path); 60var tracked = await edit.ReadObjectForEditAsync(path, CancellationToken.None).DefaultTimeout(); 180var discovered = AgentConfiguration.ReadObject(path); 181var captured = await edit.ReadObjectForEditAsync(path, 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(); 298var remote = (await remoteEdit.ReadObjectForEditAsync(path, CancellationToken.None))!; 495var settings = new JsonObject
Agents\OpenCodeAgentClientTests.cs (5)
215var original = new JsonObject { ["mcp"] = JsonNode.Parse(mcp) }; 225var configured = JsonNode.Parse(await File.ReadAllTextAsync(path))!.AsObject(); 226var skills = Assert.IsType<JsonObject>(configured["skills"]); 279var sources = array ? Assert.IsType<JsonArray>(skills) : Assert.IsType<JsonObject>(skills)["urls"]!.AsArray();
Agents\SkillSourceTests.cs (3)
218var configurations = new JsonObject(); 244var root = AgentConfiguration.ReadObject(path)!; 429var configurations = new JsonObject();
Agents\TelemetryHookConfiguratorTests.cs (15)
33var root = JsonNode.Parse(await File.ReadAllTextAsync(hookFile).DefaultTimeout())!.AsObject(); 36var entry = root["hooks"]!["postToolUse"]!.AsArray()[0]!.AsObject(); 122var entry = FindAspireHook(postToolUse); 153var existing = new JsonObject 176var root = JsonNode.Parse(await File.ReadAllTextAsync(settingsPath).DefaultTimeout())!.AsObject(); 245var existingHook = new JsonObject 251var settings = new JsonObject 335var root = JsonNode.Parse(await File.ReadAllTextAsync(settingsPath))!.AsObject(); 343=> group is JsonObject obj 350=> hook is JsonObject ho 358=> group is JsonObject obj 360&& hooks.Any(h => h is JsonObject ho 364private static JsonObject FindAspireHook(JsonArray postToolUse) 368if (group is JsonObject obj && obj["hooks"] is JsonArray hooks) 372if (hook is JsonObject ho && HookReferencesTelemetryScript(ho))
Commands\AgentInitCommandTests.cs (2)
770var config = JsonNode.Parse(await File.ReadAllTextAsync(expectedPath))!.AsObject(); 859var config = new JsonObject
Commands\ConfigCommandTests.cs (41)
145var settings = JsonNode.Parse(json)?.AsObject(); 185var settings = JsonNode.Parse(settingsJson)?.AsObject(); 188Assert.True(settings["docs"] is JsonObject); 189var docsObject = settings["docs"]!.AsObject(); 191Assert.True(docsObject["api"] is JsonObject); 217var settings = JsonNode.Parse(await File.ReadAllTextAsync(settingsPath))?.AsObject(); 258var settings = JsonNode.Parse(await File.ReadAllTextAsync(configPath))?.AsObject(); 299var settings = JsonNode.Parse(json)?.AsObject(); 301Assert.True(settings["foo"] is JsonObject); 302var fooObject = settings["foo"]!.AsObject(); 324var settings = JsonNode.Parse(json)?.AsObject(); 327Assert.True(settings["foo"] is JsonObject); 328var fooObject = settings["foo"]!.AsObject(); 329Assert.True(fooObject["bar"] is JsonObject); 330var barObject = fooObject["bar"]!.AsObject(); 356var settings = JsonNode.Parse(json)?.AsObject(); 359Assert.True(settings["foo"] is JsonObject); 360var fooObject = settings["foo"]!.AsObject(); 535var settings = JsonNode.Parse(json)?.AsObject(); 795var settings = JsonNode.Parse(json)?.AsObject(); 800Assert.True(settings["features"] is JsonObject); 801var featuresObject = settings["features"]!.AsObject(); 823var json = JsonNode.Parse(await File.ReadAllTextAsync(configPath))?.AsObject(); 825var features = Assert.IsType<JsonObject>(json["features"]); 875var settings = JsonNode.Parse(json)?.AsObject(); 879Assert.True(settings["features"] is JsonObject); 880var featuresObject = settings["features"]!.AsObject(); 906var settings = JsonNode.Parse(json)?.AsObject(); 910Assert.True(settings["features"] is JsonObject); 911var featuresObject = settings["features"]!.AsObject(); 937var settings = JsonNode.Parse(json)?.AsObject(); 967var settings = JsonNode.Parse(json)?.AsObject(); 970Assert.True(settings["features"] is JsonObject); 971var featuresObject = settings["features"]!.AsObject(); 1000var settings = JsonNode.Parse(json)?.AsObject(); 1003var featuresObject = settings["features"]!.AsObject(); 1026var settings = JsonNode.Parse(json)?.AsObject(); 1029var appHost = settings["appHost"]?.AsObject(); 1056var settings = JsonNode.Parse(json)?.AsObject(); 1060var appHost = settings["appHost"]?.AsObject();
Commands\ConfigSourceCommandTests.cs (2)
440var configuration = JsonNode.Parse(await File.ReadAllTextAsync(path))!.AsObject(); 441var binding = configuration["configSource"]!.AsObject();
Commands\InitCommandTests.cs (30)
310var config = JsonNode.Parse(await File.ReadAllTextAsync(Path.Combine(workspace.WorkspaceRoot.FullName, AspireConfigFile.FileName)))!.AsObject(); 352var config = JsonNode.Parse(File.ReadAllText(Path.Combine(workspace.WorkspaceRoot.FullName, "aspire.config.json")))!.AsObject(); 353var appHost = config["appHost"]!.AsObject(); 397var runJson = JsonNode.Parse(File.ReadAllText(runJsonPath))!.AsObject(); 398var profiles = runJson["profiles"]!.AsObject(); 400var https = profiles["https"]!.AsObject(); 405var httpsEnv = https["environmentVariables"]!.AsObject(); 411var http = profiles["http"]!.AsObject(); 413var httpEnv = http["environmentVariables"]!.AsObject(); 421var aspireConfig = JsonNode.Parse(File.ReadAllText(Path.Combine(workspace.WorkspaceRoot.FullName, "aspire.config.json")))!.AsObject(); 422var aspireProfiles = aspireConfig["profiles"]!.AsObject(); 475var runJson = JsonNode.Parse(File.ReadAllText(Path.Combine(workspace.WorkspaceRoot.FullName, "apphost.run.json")))!.AsObject(); 476var profiles = runJson["profiles"]!.AsObject(); 477var https = profiles["https"]!.AsObject(); 478var http = profiles["http"]!.AsObject(); 528var aspireConfig = JsonNode.Parse(File.ReadAllText(aspireConfigPath))!.AsObject(); 529var preservedProfiles = aspireConfig["profiles"]!.AsObject(); 531var preservedHttps = preservedProfiles["https"]!.AsObject(); 533var preservedEnv = preservedHttps["environmentVariables"]!.AsObject(); 667var config = JsonNode.Parse(File.ReadAllText(Path.Combine(workspace.WorkspaceRoot.FullName, "aspire.config.json")))!.AsObject(); 668var appHost = config["appHost"]!.AsObject(); 1149var existingConfig = new JsonObject 1165var merged = JsonNode.Parse(await File.ReadAllTextAsync(configPath))!.AsObject(); 1632var config = JsonNode.Parse(File.ReadAllText(configPath))!.AsObject(); 1654var existing = new JsonObject { ["channel"] = "pr-99999" }; 1671var config = JsonNode.Parse(await File.ReadAllTextAsync(configPath))!.AsObject(); 1703var config = JsonNode.Parse(File.ReadAllText(configPath))!.AsObject(); 1747var config = JsonNode.Parse(File.ReadAllText(configPath))!.AsObject(); 1862var existing = new JsonObject { ["channel"] = "pr-99999" }; 2670var config = new JsonObject
Commands\NewCommandLocalTemplateTests.InitConfig.cs (1)
88var listed = await store.ListAsync(new ConfigSource
Commands\NewCommandLocalTemplateTests.SourceManagement.cs (7)
234var source = Assert.IsType<JsonObject>(settings["templateSources"]![name]); 355var settings = JsonNode.Parse(await File.ReadAllTextAsync(path))!.AsObject(); 380var settings = new JsonObject 403var edited = JsonNode.Parse(await File.ReadAllTextAsync(path))!["templateSources"]!["company"]!.AsObject(); 413var deleted = JsonNode.Parse(await File.ReadAllTextAsync(path))!["templateSources"]!["company"]!.AsObject(); 422var renamed = JsonNode.Parse(await File.ReadAllTextAsync(path))!["templateSources"]!["company"]!.AsObject();
Commands\ResourceCommandHelperTests.cs (1)
127var arguments = new JsonObject
Commands\ResourceCommandTests.cs (2)
2323var actualObject = Assert.IsType<JsonObject>(actual);
Commands\SecretCommandTests.cs (1)
934var persisted = JsonNode.Parse(await File.ReadAllTextAsync(path))!.AsObject();
Configuration\ConfigSourceServiceTests.cs (8)
70var sources = await service.GetTemplateSourcesAsync(CancellationToken.None); 137var sources = await service.GetTemplateSourcesAsync(CancellationToken.None); 138var repeatedSources = await service.GetTemplateSourcesAsync(CancellationToken.None); 1376var settings = JsonNode.Parse(await File.ReadAllTextAsync(path))!.AsObject(); 1411var configuration = JsonNode.Parse(await File.ReadAllTextAsync(path))!.AsObject(); 1448var configuration = JsonNode.Parse(await File.ReadAllTextAsync(path))!.AsObject(); 1470var configuration = JsonNode.Parse(await File.ReadAllTextAsync(path))!.AsObject(); 1581var tracking = JsonNode.Parse(await File.ReadAllTextAsync(checkPath))!.AsObject();
Configuration\ConfigurationHelperTests.cs (16)
388var normalized = JsonNode.Parse(File.ReadAllText(settingsPath))!.AsObject(); 455var settings = new JsonObject 491var settings = new JsonObject 509var settings = new JsonObject 533var settings = new JsonObject 648var nested = new JsonObject(); 649var settings = new JsonObject 681var settings = JsonNode.Parse(json)!.AsObject(); 686var docs = settings["DOCS"]!.AsObject(); 688var api = docs["API"]!.AsObject(); 698var settings = JsonNode.Parse(""" 721var settings = JsonNode.Parse(""" 754var settings = JsonNode.Parse(""" 791var settings = new JsonObject(); 794var existing = new JsonObject(); 814var properties = docs.Value!.AsObject();
Configuration\ConfigurationServiceTests.cs (1)
192var settings = JsonNode.Parse(await File.ReadAllTextAsync(path))!.AsObject();
DotNet\DotNetRestoreConfigurationTests.cs (2)
35var values = new JsonObject(properties.Select(name => KeyValuePair.Create<string, JsonNode?>(name, JsonValue.Create("")))); 65var values = new JsonObject(properties.Select(name => KeyValuePair.Create<string, JsonNode?>(name, JsonValue.Create(""))));
Mcp\ListStructuredLogsToolTests.cs (5)
309var firstLog = logsArray[0]?.AsObject(); 313var firstLogAttributes = firstLog["attributes"]?.AsObject(); 322var secondLog = logsArray[1]?.AsObject(); 326var secondLogAttributes = secondLog["attributes"]?.AsObject(); 333var thirdLog = logsArray[2]?.AsObject();
Mcp\ListTracesToolTests.cs (5)
234var firstTrace = tracesArray[0]?.AsObject(); 247var serverSpan = spans.FirstOrDefault(s => s?["kind"]?.GetValue<string>() == "Server")?.AsObject(); 253var clientSpan = spans.FirstOrDefault(s => s?["kind"]?.GetValue<string>() == "Client")?.AsObject(); 259var secondTrace = tracesArray[1]?.AsObject(); 271var internalSpan = secondTraceSpans[0]?.AsObject();
Projects\ProjectUpdaterNuGetConfigurationTests.cs (4)
81var json = JsonNode.Parse(output.RootElement.GetRawText())!.AsObject(); 286var json = JsonNode.Parse(settings.RootElement.GetRawText())!.AsObject(); 672var json = JsonNode.Parse(output.RootElement.GetRawText())!.AsObject(); 1754var properties = new JsonObject();
Projects\ProjectUpdaterTests.cs (58)
104var document = new JsonObject() 250var document = new JsonObject(); 361var document = new JsonObject() 476var itemsAndProperties = new JsonObject(); 601var itemsAndProperties = new JsonObject(); 756var itemsAndProperties = new JsonObject(); 879var itemsAndProperties = new JsonObject(); 1033var itemsAndProperties = new JsonObject(); 1153var itemsAndProperties = new JsonObject(); 1314var itemsAndProperties = new JsonObject(); 1432var itemsAndProperties = new JsonObject(); 1535var itemsAndProperties = new JsonObject(); 1661var itemsAndProperties = new JsonObject(); 1755var itemsAndProperties = new JsonObject(); 1829var itemsAndProperties = new JsonObject(); 1925var itemsAndProperties = new JsonObject(); 2108var itemsAndProperties = new JsonObject(); 2273var itemsAndProperties = new JsonObject(); 2390var itemsAndProperties = new JsonObject(); 2510var itemsAndProperties = new JsonObject(); 2623var itemsAndProperties = new JsonObject(); 2991var itemsAndProperties = new JsonObject(); 3073var itemsAndProperties = new JsonObject(); 3169var itemsAndProperties = new JsonObject(); 3173var items = new JsonObject 3260var itemsAndProperties = new JsonObject(); 3262var items = new JsonObject 3336var itemsAndProperties = new JsonObject(); 3417var itemsAndProperties = new JsonObject(); 3506var itemsAndProperties = new JsonObject(); 3585var itemsAndProperties = new JsonObject(); 3665var itemsAndProperties = new JsonObject(); 3818var itemsAndProperties = new JsonObject(); 4204var itemsAndProperties = new JsonObject(); 4312var itemsAndProperties = new JsonObject(); 4393var itemsAndProperties = new JsonObject(); 4475var itemsAndProperties = new JsonObject(); 4520public static JsonObject WithSdkVersion(this JsonObject root, string sdkVersion) 4524JsonObject properties = new JsonObject(); 4534public static JsonObject WithMSBuildOutput(this JsonObject root) 4536JsonObject items = new JsonObject(); 4558public static JsonObject WithPackageReference(this JsonObject root, string packageId, string packageVersion) 4561var items = root["Items"]!.AsObject(); 4564JsonObject newPackageReference = new JsonObject 4574public static JsonObject WithPackageReferenceWithoutVersion(this JsonObject root, string packageId) 4577var items = root["Items"]!.AsObject(); 4580JsonObject newPackageReference = new JsonObject 4590public static JsonObject WithProjectReference(this JsonObject root, string fullPath) 4593var items = root["Items"]!.AsObject(); 4596JsonObject newProjectReference = new JsonObject 4605public static JsonObject WithProperty(this JsonObject root, string propertyName, string propertyValue) 4607JsonObject properties = new JsonObject();
Scaffolding\PackageJsonMergerTests.cs (28)
18private static JsonObject ParseJson(string json) => 24private static JsonObject GetScripts(string mergedJson) => 54var scripts = GetScripts(result); 91var scripts = GetScripts(result); 128var scripts = GetScripts(result); 166var scripts = GetScripts(result); 199var scripts = GetScripts(result); 224var scripts = GetScripts(result); 256var scripts = GetScripts(result); 299var scripts = GetScripts(result); 392var json = ParseJson(result); 467var json = ParseJson(result); 512var first = ParseJson(firstMerge); 513var second = ParseJson(secondMerge); 541var scripts = GetScripts(result); 598var json = ParseJson(result); 599var scripts = json["scripts"]!.AsObject(); 657var scripts = GetScripts(result); 723var scripts = GetScripts(result); 999Assert.True(weirdPkg is JsonObject); 1172var engines = ParseJson(result)["engines"]!.AsObject(); 1199var engines = ParseJson(result)["engines"]!.AsObject(); 1225var engines = ParseJson(result)["engines"]!.AsObject(); 1248var doc = JsonNode.Parse(result)!.AsObject(); 1301var doc = JsonNode.Parse(result)!.AsObject(); 1312var scripts = doc["scripts"]!.AsObject(); 1486var doc = JsonNode.Parse(result)!.AsObject(); 1494var scripts = doc["scripts"]!.AsObject();
Scaffolding\ScaffoldingServiceTests.cs (10)
119var packageJson = JsonNode.Parse("""{ "scripts": { "aspire:start": "npm --prefix aspire-apphost run aspire:start" } }""")!.AsObject(); 129var packageJson = JsonNode.Parse("""{ "scripts": { "aspire:start": "npm --prefix aspire-apphost run aspire:start" } }""")!.AsObject(); 139var packageJson = JsonNode.Parse("""{ "scripts": { "aspire:start": "npm --prefix aspire-apphost run aspire:start" } }""")!.AsObject(); 149var scripts = JsonNode.Parse("""{ "test": "vitest" }""")!.AsObject(); 166var scripts = new JsonObject(); 189var scripts = new JsonObject(); 212var scripts = JsonNode.Parse(""" 351var merged = JsonNode.Parse( 374var merged = JsonNode.Parse( 398var merged = JsonNode.Parse(
Secrets\SecretStoreResolverTests.cs (1)
170var persisted = JsonNode.Parse(await File.ReadAllTextAsync(destinationPath))!.AsObject();
Telemetry\ReportedLogExportTests.cs (1)
73var tags = envelope!["tags"]!.AsObject();
TestServices\TestConfigSourceServices.cs (3)
23var configuration = File.Exists(path) 40public static async Task<(string Commit, string Version, JsonObject Configuration)> AcquireAsync( 98public Func<ConfigSource, CancellationToken, Task<(string Version, JsonObject Configuration)>> ReadConfiguration { get; set; }
TestServices\TestDotNetCliRunner.cs (1)
173var values = new JsonObject(properties.Select(name =>
Utils\DevCertsCheckTests.cs (1)
308var certNode = certificates[0]!.AsObject();
Aspire.Dashboard (22)
Model\GenAI\GenAIItemPartViewModel.cs (4)
77JsonObject obj when obj.Count == 0 => string.Empty, 116JsonObject obj when obj.Count == 0 => string.Empty, 138private static JsonObject ToJsonObject(Dictionary<string, JsonElement> dict) 140var jsonObject = new JsonObject();
Model\GenAI\GenAISchemaHelpers.cs (4)
18internal static ToolDefinitionSchema ParseToolDefinitionSchema(JsonObject schemaObj) 27if (schemaObj["properties"] is JsonObject propsObj) 32if (prop.Value is JsonObject propSchemaObj) 40if (schemaObj["items"] is JsonObject itemsObj)
Model\GenAI\GenAIVisualizerDialogViewModel.cs (2)
97if (item is not JsonObject obj) 110if (obj["parameters"] is JsonObject paramsObj)
Model\TelemetryExportService.cs (1)
808var jsonObject = new JsonObject();
Otlp\Model\OtlpHelpers.cs (2)
222static JsonObject ConvertKeyValues(KeyValueList value) 224var o = new JsonObject();
src\Shared\Telemetry\InternalMicrosoftDetector.cs (9)
709var deviceConfiguration = TryParseMacPlatformSsoSection(output, "Device Configuration"); 710var loginConfiguration = TryParseMacPlatformSsoSection(output, "Login Configuration"); 711var userConfiguration = TryParseMacPlatformSsoSection(output, "User Configuration"); 778if (kerberosStatusNodeEntry is not JsonObject kerberosStatus) 1661private static JsonObject? TryParseMacPlatformSsoSection(string output, string sectionName) 1709documentOptions: new JsonDocumentOptions { AllowTrailingCommas = true }) as JsonObject; 1875private static bool TryGetBoolean(JsonObject json, string propertyName, out bool value) 1883private static Uri? TryGetAbsoluteUri(JsonObject json, string propertyName) 1902private static string? TryGetString(JsonObject json, string propertyName)
Aspire.Dashboard.Tests (10)
Integration\OtlpGrpcServiceTests.cs (1)
166var configJson = new JsonObject
Integration\StartupTests.cs (1)
685var configJson = new JsonObject
Model\DashboardDataSourceTests.cs (4)
248var metadata = JsonNode.Parse(File.ReadAllText(metadataPath))!.AsObject(); 803var metadata = JsonNode.Parse(File.ReadAllText(metadataPath))!.AsObject(); 844var metadata = JsonNode.Parse(File.ReadAllText(metadataPath))!.AsObject(); 888var metadata = JsonNode.Parse(File.ReadAllText(metadataPath))!.AsObject();
Model\GenAISchemaHelpersTests.cs (2)
185var schemaObj = JsonNode.Parse(schemaJson) as JsonObject;
Model\TelemetryExportServiceTests.cs (2)
1436var connectionPropertiesObject = Assert.IsType<JsonObject>(deserialized.Properties[KnownProperties.Resource.ConnectionProperties]);
Aspire.Hosting (187)
ApplicationModel\AppHostLocalStateStore.cs (5)
73var state = LoadState(); 108var state = LoadState(); 146private JsonObject LoadState() 155if (JsonNode.Parse(File.ReadAllText(_statePath)) is not JsonObject root) 175private void WriteState(JsonObject state)
Ats\UserSecretsExports.cs (2)
41var state = JsonNode.Parse(json) as JsonObject
Backchannel\AuxiliaryBackchannelRpcTarget.cs (3)
379private static IReadOnlyDictionary<string, string?> ConvertObjectArgumentValues(JsonObject arguments) 1435private static JsonObject ConvertNameValuePropertyToJsonObject(IEnumerable<KeyValuePair<string, string>> properties) 1437var jsonObject = new JsonObject();
Dashboard\DashboardEventHandlers.cs (1)
940public JsonObject? State { get; set; }
Dcp\JsonPatch.cs (8)
31if (operationNode is not JsonObject operation || 55if (current is JsonObject currentObject && changed is JsonObject changedObject) 105private static JsonObject CreateOperation(string operation, string path, JsonNode? value = null) 107var result = new JsonObject 205case JsonObject jsonObject: 227JsonObject jsonObject when jsonObject.TryGetPropertyValue(segment, out var child) && child is not null => child, 237private static void ApplyToObject(JsonObject target, string operation, string propertyName, JsonNode? value)
Dcp\PersistentPortAllocationStore.cs (8)
56if (value is not JsonObject state) 78if (state["resources"] is not JsonObject resourcesObject) 85if (resource.Value is not JsonObject endpointsObject) 92if (endpoint.Value is not JsonObject endpointObject) 120private static JsonObject WritePortAllocations(Dictionary<PersistentPortAllocationKey, int> allocations) 122var resourcesObject = new JsonObject(); 127if (resourcesObject[allocation.Key.ResourceName] is not JsonObject endpointsObject) 133if (endpointsObject[allocation.Key.EndpointName] is not JsonObject endpointObject)
Devcontainers\DevcontainerSettingsWriter.cs (8)
120var settings = (JsonObject)JsonObject.Parse(settingsContent)!; 122JsonObject? portsAttributes; 130portsAttributes = (JsonObject)portsAttributesNode!; 146let attrs = props.Value as JsonObject 166JsonObject? portAttributes; 174portAttributes = (JsonObject)portAttributeNode!;
DistributedApplicationBuilder.cs (2)
1226var effectiveState = FileDeploymentStateManager.LoadEffectiveState( 1231var flattenedState = JsonFlattener.FlattenJsonObject(effectiveState);
Pipelines\DeploymentStateSection.cs (4)
17public sealed class DeploymentStateSection(string sectionName, JsonObject? data, long version) 33/// The <see cref="JsonObject"/> returned by this property is NOT thread-safe. 36public JsonObject Data { get; } = data ?? []; 38internal JsonObject OriginalData { get; set; } = data?.DeepClone().AsObject() ?? [];
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);
Pipelines\Internal\JsonFlattener.cs (13)
19public static JsonObject FlattenJsonObject(JsonObject source) 21var result = new JsonObject(); 32public static JsonObject UnflattenJsonObject(JsonObject source) 34var result = new JsonObject(); 39var current = result; 44if (!current.TryGetPropertyValue(key, out var existing) || existing is not JsonObject) 46var newObject = new JsonObject(); 62private static void FlattenJsonObjectRecursive(JsonObject source, string prefix, JsonObject result) 72if (kvp.Value is JsonObject nestedObject) 81if (array[i] is JsonObject arrayObject)
Pipelines\Internal\UserSecretsDeploymentStateManager.cs (2)
34JsonObject state, 36JsonObject? originalSectionData,
Publishing\ContainerImageArchiveRewriter.cs (9)
231if (manifestNode is not JsonObject manifest) 276if (ParseJson(contents, entryName) is not JsonObject repositories) 281var rewrittenRepositories = new JsonObject(); 284if (repository.Value is not JsonObject tags) 300var rewrittenTags = new JsonObject(); 337if (ParseJson(contents, entryName) is not JsonObject index) 349if (manifests[descriptorIndex] is not JsonObject descriptor) 359if (annotationsNode is not JsonObject annotations) 557JsonObject annotations,
Publishing\ContainerRuntimeBase.cs (14)
188var root = JsonNode.Parse(output) as JsonObject; 249foreach (var item in verboseManifests.OfType<JsonObject>()) 251if (TryCreateManifest(item["Descriptor"] as JsonObject, operatingSystem, architecture, out var manifest)) 260if (root is not JsonObject manifestObject) 267foreach (var item in manifests.OfType<JsonObject>()) 278var descriptor = manifestObject["Descriptor"] as JsonObject ?? 279manifestObject["descriptor"] as JsonObject ?? 296JsonObject? descriptor, 307var platform = descriptor["platform"] as JsonObject;
src\Shared\Json\JsonFlattener.cs (13)
16public static JsonObject FlattenJsonObject(JsonObject source) 18var result = new JsonObject(); 26public static JsonObject UnflattenJsonObject(JsonObject source) 28var result = new JsonObject(); 33var current = result; 38if (!current.TryGetPropertyValue(key, out var existing) || existing is not JsonObject) 40var newObject = new JsonObject(); 56private static void FlattenJsonObjectRecursive(JsonObject source, string prefix, JsonObject result) 66if (kvp.Value is JsonObject nestedObject) 75if (array[i] is JsonObject arrayObject)
src\Shared\UserSecrets\SecretsStore.cs (4)
102var obj = new JsonObject(); 114internal static void SaveJson(string filePath, JsonObject obj) 207var parsed = JsonNode.Parse(json, documentOptions: new JsonDocumentOptions 218var flat = JsonFlattener.FlattenJsonObject(parsed);
UserSecrets\IUserSecretsManager.cs (1)
67Task SaveStateAsync(JsonObject state, CancellationToken cancellationToken = default);
UserSecrets\NoopUserSecretsManager.cs (1)
44public Task SaveStateAsync(JsonObject state, CancellationToken cancellationToken = default)
UserSecrets\UserSecretsManagerFactory.cs (2)
163public async Task SaveStateAsync(JsonObject state, CancellationToken cancellationToken = default) 168var flattenedState = JsonFlattener.FlattenJsonObject(state);
Aspire.Hosting.Azure (64)
AzureDeploymentOperationDetails.cs (5)
76internal JsonObject ToJsonObject() 78var json = new JsonObject 134internal JsonObject ToJsonObject() 136var json = new JsonObject(); 169internal JsonObject ToJsonObject()
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
AzureProvisioningFailureDetails.cs (17)
453internal JsonObject ToJsonObject() 455var json = new JsonObject 566if (JsonNode.Parse(content) is not JsonObject responseObj) 582private static JsonObject? TryGetErrorObject(JsonObject responseObj) 592if (responseObj["error"] is JsonObject errorObj) 597if (responseObj["properties"] is JsonObject propertiesObj && 598propertiesObj["error"] is JsonObject deploymentErrorObj) 603if (responseObj["properties"] is JsonObject operationPropertiesObj && 604operationPropertiesObj["statusMessage"] is JsonObject statusMessageObj && 605statusMessageObj["error"] is JsonObject statusMessageErrorObj) 613private static ParsedAzureError? TryParseAzureError(JsonObject errorObj, ParsedAzureTargetResource? targetResource) 626if (detail is JsonObject detailObj && 672private static ParsedAzureError? CreateParsedAzureError(JsonObject errorObj, ParsedAzureTargetResource? targetResource) 710private static ParsedAzureTargetResource? TryParseTargetResource(JsonObject responseObj) 712if (responseObj["properties"] is not JsonObject propertiesObj || 713propertiesObj["targetResource"] is not JsonObject targetResourceObj)
AzureProvisioningJsonHelpers.cs (1)
35internal static string ToCommandResultJsonString(JsonObject json)
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\Internal\BaseProvisioningContextProvider.cs (1)
225var azureSection = azureStateSection.Data;
Provisioning\Internal\DefaultArmClientProvider.cs (1)
344data.Properties.Outputs?.ToObjectFromJson<JsonObject>());
Provisioning\Internal\IProvisioningServices.cs (1)
343internal sealed record AzureDeploymentState(string ProvisioningState, JsonObject? Outputs);
Provisioning\Internal\RunModeProvisioningContextProvider.cs (1)
243var data = azureSection.Data;
Provisioning\JsonExtensions.cs (1)
12var jsonObj = obj.AsObject();
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)
LocalDeveloperCertificateProvisioningTests.cs (1)
28var parameters = new JsonObject();
Aspire.Hosting.Azure.Kubernetes (3)
AzureKubernetesEnvironmentResource.AksPipeline.cs (2)
394private static bool HasPersistedAksIdentity(JsonObject deploymentState) 410private static ResourceIdentifier? GetPersistedAksResourceId(JsonObject deploymentState)
AzureKubernetesEnvironmentResource.cs (1)
202private static bool HasPersistedHelmReleaseState(JsonObject deploymentState)
Aspire.Hosting.Azure.Kubernetes.Tests (4)
AzureKubernetesInfrastructureTests.cs (1)
1909var azureState = new JsonObject { ["SubscriptionId"] = subscriptionId };
tests\Shared\InMemoryDeploymentStateManager.cs (3)
14private readonly Dictionary<string, JsonObject> _sections = new(); 19public void SetSection(string name, JsonObject data) 27if (_sections.TryGetValue(sectionName, out var data))
Aspire.Hosting.Azure.Sandboxes (18)
AzureSandboxContainerDeployment.cs (14)
273var pendingLegacyDeploymentCleanup = CreatePendingLegacyDeploymentCleanup( 494if (portStates.FirstOrDefault() is JsonObject firstPort && firstPort["Url"]?.GetValue<string>() is { } publicUrl) 1370if (GetPendingLegacyDeploymentCleanup(stateSection) is JsonObject pendingLegacyDeploymentCleanup) 1400.Where(pair => pair.Value is JsonObject) 1441if (GetPendingLegacyDeploymentCleanup(stateSection) is JsonObject pendingLegacyDeploymentCleanup) 1961internal static JsonObject? CreatePendingLegacyDeploymentCleanup( 1966var pendingDeploymentCleanup = GetPendingLegacyDeploymentCleanup(stateSection); 1979private static JsonObject? GetPendingLegacyDeploymentCleanup(DeploymentStateSection stateSection) => 1980stateSection.Data["PendingLegacyDeploymentCleanup"]?.DeepClone() as JsonObject; 1984JsonObject? pendingDeploymentCleanup) 2157foreach (var port in ports.OfType<JsonObject>()) 2202foreach (var port in ports.OfType<JsonObject>())
AzureSandboxEndpointPropertyValueProvider.cs (4)
135JsonObject? fallbackPort = null; 136foreach (var port in ports.OfType<JsonObject>()) 152private static bool TryGetUrl(JsonObject port, [NotNullWhen(true)] out string? url)
Aspire.Hosting.Azure.Tests (110)
AzureBicepProvisionerTests.cs (8)
37var parameters = new JsonObject(); 933var parameters = new JsonObject(); 969var parameters = new JsonObject(); 1020var parameters = new JsonObject(); 1666var outputs = JsonNode.Parse(section.Data[BicepUtilities.DeploymentStateOutputsKey]!.GetValue<string>())!.AsObject(); 1909var parameters = new JsonObject(); 1912var scope = new JsonObject(); 1924private static JsonObject CreateDeploymentOutputs(string blobEndpoint)
AzureDeployerTests.cs (1)
1939var cachedState = new JsonObject
AzureEnvironmentResourceExtensionsTests.cs (48)
663var resultData = AssertCommandJsonData(result); 1104var data = AssertCommandJsonData(result); 1184var data = AssertCommandJsonData(result); 1193var azureContext = Assert.IsType<JsonObject>(data["azureContext"]); 1199var deployment = Assert.IsType<JsonObject>(data["deployment"]); 1209var outputs = Assert.IsType<JsonObject>(deployment["outputs"]); 1212var scope = Assert.IsType<JsonObject>(deployment["scope"]); 1215var live = Assert.IsType<JsonObject>(data["live"]); 1267var data = AssertCommandJsonData(result); 1268var live = Assert.IsType<JsonObject>(data["live"]); 1329var json = details.ToJsonObject(); 1537var data = AssertCommandJsonData(result); 1538var deployment = Assert.IsType<JsonObject>(data["deployment"]); 1542var live = Assert.IsType<JsonObject>(data["live"]); 1600var data = AssertCommandJsonData(result); 1601var live = Assert.IsType<JsonObject>(data["live"]); 1661var data = AssertCommandJsonData(result); 1662var live = Assert.IsType<JsonObject>(data["live"]); 2153var resultData = AssertCommandJsonData(result); 2244var resultData = AssertCommandJsonData(result); 3196var data = AssertCommandJsonData(result); 3203var azureContext = Assert.IsType<JsonObject>(data["azureContext"]); 3810var data = AssertCommandJsonData(result); 3817var azureContext = Assert.IsType<JsonObject>(data["azureContext"]); 3877var data = AssertCommandJsonData(result); 4368var data = AssertCommandJsonData(result); 4371var diagnostic = Assert.IsType<JsonObject>(Assert.Single(diagnostics)); 4575var data = AssertCommandJsonData(result); 4579var diagnostic = Assert.IsType<JsonObject>(Assert.Single(diagnostics)); 5379private static JsonObject AssertCommandJsonData(ExecuteCommandResult result) 5384return Assert.IsType<JsonObject>(JsonNode.Parse(data.Value)); 5719private readonly Dictionary<string, JsonObject> _sections = new(StringComparer.Ordinal); 5731JsonObject data; 5734_sections.TryGetValue(sectionName, out var existingData);
AzureSandboxesTests.cs (1)
951var directCleanupState = AzureSandboxContainerDeployment.CreatePendingLegacyDeploymentCleanup(
BicepUtilitiesTests.cs (42)
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(); 255var parameters = new JsonObject(); 311var parameters = new JsonObject(); 338var parameters0 = new JsonObject(); 342var parameters1 = new JsonObject(); 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 460var parameters1 = new JsonObject 465var parameters2 = new JsonObject 485var parameters = new JsonObject 490var scope1 = new JsonObject { ["resourceGroup"] = "rg1" }; 491var scope2 = new JsonObject { ["resourceGroup"] = "rg2" }; 513var parameters1 = new JsonObject 518var parameters2 = new JsonObject 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(); 689var parameters = new JsonObject 713var legacyParameters = new JsonObject(); 726var currentParameters = new JsonObject(); 727var currentScope = new JsonObject(); 750var parameters = new JsonObject
JsonExtensionsTests.cs (3)
14var rootJson = new JsonObject(); 30var rootJson = new JsonObject(); 44var rootJson = new JsonObject();
ProvisioningTestHelpers.cs (4)
489private JsonObject? CreateDeploymentOutputs(string deploymentId) 1048private readonly JsonObject _state = []; 1054var sectionData = _state.TryGetPropertyValue(sectionName, out var node) && node is JsonObject obj
tests\Shared\InMemoryDeploymentStateManager.cs (3)
14private readonly Dictionary<string, JsonObject> _sections = new(); 19public void SetSection(string name, JsonObject data) 27if (_sections.TryGetValue(sectionName, out var data))
Aspire.Hosting.Azure.WebPubSub (2)
AzureWebPubSubExtensions.cs (2)
220var hubs = new JsonObject(); 246var config = new JsonObject { ["WebPubSub"] = new JsonObject { ["Hubs"] = hubs } };
Aspire.Hosting.Blazor (2)
GatewayConfigurationBuilder.cs (2)
222var environment = new JsonObject(); 253var config = new JsonObject
Aspire.Hosting.Browsers.Tests (1)
BrowserLogsBuilderExtensionsTests.cs (1)
1977public Task SaveStateAsync(JsonObject state, CancellationToken cancellationToken = default) => Task.CompletedTask;
Aspire.Hosting.CodeGeneration.Go (15)
AtsGoCodeGenerator.cs (3)
1261AtsTypeCategory.Dto when value is JsonObject obj && dtoTypesById.TryGetValue(typeRef.TypeId, out var dtoInfo) 1265AtsTypeCategory.Dict when value is JsonObject obj 1290JsonObject value,
GoApiExportWriter.cs (12)
22public static JsonObject Write(GoApiModel model) 74private static JsonObject WriteModule(GoApiModule module) 82var json = new JsonObject { ["name"] = module.Name }; 88private static JsonObject WriteItem(GoApiItem item) 90var json = new JsonObject 120private static JsonObject WriteMember(GoApiMember member) 122var json = new JsonObject 166var optionsJson = new JsonObject { ["typeName"] = options.TypeName }; 184var json = new JsonObject 230private static void AddIfPresent(JsonObject json, string name, string? value) 238private static void AddIfTrue(JsonObject json, string name, bool value) 246private static void AddIfPresent(JsonObject json, string name, IReadOnlyList<string> values)
Aspire.Hosting.CodeGeneration.Go.Tests (1)
GoApiExportTests.cs (1)
388JsonObject json => json.SelectMany(property => Strings(property.Value)),
Aspire.Hosting.CodeGeneration.Java (3)
AtsJavaCodeGenerator.cs (3)
881AtsTypeCategory.Dto when value is JsonObject obj && dtoTypesById.TryGetValue(typeRef.TypeId, out var dtoInfo) 887AtsTypeCategory.Dict when value is JsonObject obj 894JsonObject value,
Aspire.Hosting.CodeGeneration.Java.Tests (1)
AtsJavaCodeGeneratorTests.cs (1)
884case JsonObject obj:
Aspire.Hosting.CodeGeneration.Python (3)
AtsPythonCodeGenerator.cs (3)
1016AtsTypeCategory.Dto when value is JsonObject obj && dtoTypesById.TryGetValue(typeRef.TypeId, out var dtoInfo) 1020AtsTypeCategory.Dict when value is JsonObject obj 1035JsonObject value,
Aspire.Hosting.CodeGeneration.TypeScript (21)
TypeScriptApiExportWriter.cs (10)
21public static JsonObject Write(TypeScriptApiModel model) 72private static JsonObject WriteModule(TypeScriptApiModule module) 80var json = new JsonObject { ["name"] = module.Name }; 86private static JsonObject WriteItem(TypeScriptApiItem item) 88var json = new JsonObject 121private static JsonObject WriteMember(TypeScriptApiMember member) 123var json = new JsonObject 150var parameterJson = new JsonObject 181private static void AddIfPresent(JsonObject json, string name, string? value) 189private static void AddIfPresent(JsonObject json, string name, IReadOnlyList<string> values)
TypeScriptApiProjector.cs (3)
773AtsTypeCategory.Dto when value is JsonObject obj && _dtoTypesById.TryGetValue(typeRef.TypeId, out var dtoInfo) 777AtsTypeCategory.Dict when value is JsonObject obj 783private string RenderTypeScriptDtoValue(JsonObject value, AtsDtoTypeInfo dtoInfo)
TypeScriptLanguageSupport.cs (8)
128var packageJson = new JsonObject(); 146var engines = EnsureObject(packageJson, "engines"); 149var scripts = EnsureObject(packageJson, "scripts"); 190private static void EnsureDependency(JsonObject packageJson, string sectionName, string packageName, string version) 192var section = EnsureObject(packageJson, sectionName); 207private static JsonObject EnsureObject(JsonObject parent, string propertyName) 209if (parent[propertyName] is JsonObject obj)
Aspire.Hosting.CodeGeneration.TypeScript.Tests (19)
AtsTypeScriptCodeGeneratorTests.cs (1)
52var packageJson = System.Text.Json.Nodes.JsonNode.Parse(content)!.AsObject();
TypeScriptLanguageSupportTests.cs (18)
32var packageJson = ParseJson(files["package.json"]); 33var scripts = packageJson["scripts"]!.AsObject(); 34var devDependencies = packageJson["devDependencies"]!.AsObject(); 53var engines = packageJson["engines"]!.AsObject(); 62var tsConfig = ParseJson(files["tsconfig.apphost.json"]); 98var packageJson = ParseJson(files["package.json"]); 99var scripts = packageJson["scripts"]!.AsObject(); 100var dependencies = packageJson["dependencies"]!.AsObject(); 101var devDependencies = packageJson["devDependencies"]!.AsObject(); 128var engines = packageJson["engines"]!.AsObject(); 145var packageJson = ParseJson(files["package.json"]); 178var packageJson = ParseJson(files["package.json"]); 179var dependencies = packageJson["dependencies"]!.AsObject(); 180var devDependencies = packageJson["devDependencies"]!.AsObject(); 234var appHostRunJson = ParseJson(files["apphost.run.json"]); 235var httpsProfile = appHostRunJson["profiles"]!["https"]!.AsObject(); 237var environmentVariables = httpsProfile["environmentVariables"]!.AsObject(); 356private static JsonObject ParseJson(string content) => JsonNode.Parse(content)!.AsObject();
Aspire.Hosting.Docker.Tests (3)
tests\Shared\InMemoryDeploymentStateManager.cs (3)
14private readonly Dictionary<string, JsonObject> _sections = new(); 19public void SetSection(string name, JsonObject data) 27if (_sections.TryGetValue(sectionName, out var data))
Aspire.Hosting.Kubernetes (2)
KubernetesEnvironmentResource.cs (2)
2123var metadataNode = new System.Text.Json.Nodes.JsonObject 2143var minimal = new System.Text.Json.Nodes.JsonObject
Aspire.Hosting.Kubernetes.Tests (3)
tests\Shared\InMemoryDeploymentStateManager.cs (3)
14private readonly Dictionary<string, JsonObject> _sections = new(); 19public void SetSection(string name, JsonObject data) 27if (_sections.TryGetValue(sectionName, out var data))
Aspire.Hosting.Native.Client (4)
Authoring\NativeApplication.cs (1)
234var model = System.Text.Json.Nodes.JsonNode.Parse(await revision.ExportPublishModelAsync(token).ConfigureAwait(false))!.AsObject();
Authoring\NativePipeline.cs (1)
112var graph = new JsonObject
Authoring\Publishing.cs (2)
16JsonObject Model, string OutputPath, string ApplicationDirectory, string EnvironmentName, CancellationToken CancellationToken) 90var model = JsonNode.Parse(await composition.ExportPublishModelAsync(cancellationToken).ConfigureAwait(false))!.AsObject();
Aspire.Hosting.Native.CodeGeneration (4)
NativeProviderProjection.cs (3)
36var manifest = new JsonObject { ["protocolVersion"] = 2, ["capabilities"] = new JsonArray() }; 182JsonObject Parameter(string name, Type type) => new() { ["name"] = name, ["type"] = TypeRef(type) }; 183JsonObject TypeRef(Type type) => new() { ["typeId"] = TypeId(type), ["category"] = IsHandle(type) ? "Handle" : "Primitive" };
Program.cs (1)
212var runtimeSpec = JsonSerializer.SerializeToNode(languageSupport.GetRuntimeSpec(),
Aspire.Hosting.Native.Core.Tests (55)
ApplicationRevisionTests.cs (4)
366private static JsonObject RestartArguments(JsonNode writer, long revision) => 381private static Task<JsonObject> Commit(WorkspaceRpcTestContext context, JsonNode revision) => 390private static JsonObject CompleteConfiguration(WorkspaceRpcTestContext context, long revision, string status) => 395private static string Error(JsonObject response) =>
DcpWorkloadCleanupTests.cs (2)
74var first = await context.Author.InvokeAsync("retireApplicationWorkspace", Arguments(("context", context.Workspace))); 301private static string Error(JsonObject response) =>
NativeCliControlTests.cs (3)
24var sdk = Result(client.Call("generateCode", new JsonArray("TypeScript", null))).AsObject(); 79var request = new JsonObject 92private static string Error(JsonObject response) => response["error"]!["data"]!["code"]!.GetValue<string>();
NativeComposeCSharpTests.cs (4)
38var snapshot = new JsonObject { ["compose"] = first.Compose, ["inputs"] = first.Inputs }; 127var request = new JsonObject 150var typescript = JsonNode.Parse(await stdout)!.AsObject(); 531var model = JsonNode.Parse(await composition.ExportPublishModelAsync())!.AsObject();
NativeLanguageCatalogTests.cs (1)
23var spec = catalog.RuntimeSpec("example/custom-runtime");
NativeNamedPipeTests.cs (1)
26var unauthenticated = await second.CallAsync("getApplicationServer", null, timeout.Token);
NativeProviderClientTests.cs (4)
59var discovery = JsonNode.Parse((await provider.ReadAsync(cancellationToken))!)!.AsObject(); 70var rejection = JsonNode.Parse((await provider.ReadAsync(cancellationToken))!)!.AsObject(); 130var request = JsonNode.Parse((await provider.ReadAsync(deadline.Token))!)!.AsObject(); 220var handle = JsonNode.Parse(result.GetRawText())!.AsObject();
NativeProviderLifecycleTests.cs (3)
232var manifest = JsonNode.Parse(definition.Metadata.GetRawText())!.AsObject(); 234var phase = methods[1]!.AsObject(); 245var duplicate = phase.DeepClone().AsObject();
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) =>
NativeSocketIsolationTests.cs (5)
69var response = await client.CallAsync("Fail", null, TestContext.Current.CancellationToken); 70var error = response["error"]!.AsObject(); 146var response = await failing.CallAsync("invokeCapability", new JsonArray("Aspire.Hosting.Native.Api/startContainer", 152var error = response["result"]!["$error"]!.AsObject(); 194var response = await next.CallAsync("GetCapabilitiesAsync", null, timeout.Token);
RuntimeRpcTests.cs (1)
174private static string Error(JsonObject response) =>
TestServices\LifecycleProviderTestIntegration.cs (4)
28static JsonObject Type(string id, string category = "Handle") => new() { ["typeId"] = id, ["category"] = category }; 29static JsonObject Parameter(string name, JsonObject type) => new() { ["name"] = name, ["type"] = type }; 62var manifest = new JsonObject { ["protocolVersion"] = 2, ["capabilities"] = methods };
TestServices\NativeSocketTestHost.cs (2)
97public async Task<JsonObject> CallAsync(string method, JsonNode? parameters, CancellationToken cancellationToken) 106var request = new JsonObject
TestServices\RpcTestClient.cs (9)
47public JsonObject Call(string method, JsonNode? parameters) => CallAsync(method, parameters).GetAwaiter().GetResult(); 49public async Task<JsonObject> CallAsync(string method, JsonNode? parameters) 51var request = new JsonObject 65public JsonObject Invoke(string capability, JsonObject arguments) => 68public Task<JsonObject> InvokeAsync(string capability, JsonObject arguments) => 84public static JsonObject Arguments(params (string Name, JsonNode? Value)[] values) => 87public static JsonNode Result(JsonObject response) => response["result"]?.DeepClone()
TestServices\RuntimeRpcTestContext.cs (1)
53public JsonObject Publish(string state, bool healthy, params string[] urls) =>
TestServices\WorkspaceRpcTestContext.cs (3)
57public JsonObject PublishHealthy() => Integration.Invoke("publishObservation", 65public static void EnsureSuccess(JsonObject response) 67if (response["error"] is not null || response["result"] is JsonObject result && result.ContainsKey("$error"))
WorkloadDefinitionTests.cs (4)
51var launch = Launch(); 68var response = await context.Integration.InvokeAsync("startContainerWorkload", Arguments( 107private static JsonObject Launch() => new() 119private static JsonObject Endpoint(string name, string scheme, int port) => new()
Aspire.Hosting.Native.Server (79)
Api\ParameterApi.cs (2)
44var configuration = JsonNode.Parse(options) as JsonObject
Api\PublishingApi.cs (4)
19JsonObject Expression(SymbolicValue value) => value.Project<JsonObject>( 35var environment = new JsonObject(); 37var configuration = new JsonObject(resource.Configuration.Select(entry =>
artifacts\obj\Aspire.Hosting.Native.Server\Debug\native-ats\NativeDispatch.g.cs (1)
12public static async Task<JsonNode?> InvokeAsync(NativeApplicationServer server, NativeHandles handles, NativeRpcConnection connection, NativeRpcConnection callbackConnection, string capability, JsonObject arguments)
Rpc\NativeHandles.cs (3)
26public JsonObject Add(object value, string typeId) 47if (value is not JsonObject reference) 66public object ReadReference(JsonObject reference, string? expectedTypeId = null)
Rpc\NativeLanguageCatalog.cs (7)
16private readonly Func<string, JsonObject> _readSdk; 19internal NativeLanguageCatalog(NativeLanguageRegistration[] languages, Func<string, JsonObject> readSdk) 52var files = ReadSdk(assembly, prefix); 73public JsonObject RuntimeSpec(string language) 84public JsonObject GeneratedSdk(string language) 100private static JsonObject ReadSdk(Assembly assembly, string prefix) 102var files = new JsonObject();
Rpc\NativeProviderContractProjection.cs (3)
143string? TargetTypeId, string? TargetParameterName, string? LifecyclePhase, JsonObject Metadata); 145internal sealed record NativeProviderHandle(string Id, JsonObject Wire, JsonObject? Lifetime);
Rpc\NativeProviderLifecycle.cs (2)
66var scope = connection.AddLifecycleScope(new ResourceLifecycleScope(authority)); 70var arguments = new JsonObject
Rpc\NativeProviderMetadata.cs (13)
14NativeProviderMetadataType ReturnType, string? TargetTypeId, string? TargetParameterName, string? LifecyclePhase, JsonObject Wire); 20public static NativeProviderCoreContract ReadCoreContract(JsonObject contract) 35if (manifest is not JsonObject envelope || envelope["protocolVersion"] is not JsonValue version || 44if (capabilities[index] is not JsonObject metadata || metadata["id"] is not JsonValue || 46metadata["returnType"] is not JsonObject returnType) 60if (parameter is not JsonObject argument || argument["type"] is not JsonObject type) 73argument["callbackReturnType"] is not JsonObject callbackReturn) 80if (callbackParameters[index] is not JsonObject projectedParameter || projectedParameter["type"] is not JsonObject projectedType) 90private static NativeProviderMetadataType ReadType(JsonObject type) => 99private static string? OptionalString(JsonObject metadata, string name) => 102private static bool ReadFlag(JsonObject metadata, string name)
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
Rpc\NativeProviderValueProtocol.cs (4)
28var handle = value as JsonObject ?? throw RpcFault.InvalidHandle("The provider did not return a typed handle."); 36if (!core && handle["$lifetime"] is not JsonObject) 41return new(id, handle, handle["$lifetime"] as JsonObject);
Rpc\NativeRpcConnection.cs (12)
20private static readonly JsonObject s_contract = LoadContract(); 41internal static JsonObject CoreContract => s_contract.DeepClone().AsObject(); 50internal JsonObject AddLifecycleScope(ResourceLifecycleScope scope) 69internal JsonObject AddReference(object value, string typeId) 106internal object ReadReference(JsonObject handle, string? typeId = null) 115internal bool IsReferenceAlive(JsonObject handle) 167internal JsonObject PublishCoreHandle(object value, string typeId) 188var handle = PublishCoreHandle(context, typeId); 198var arguments = new JsonObject { ["p0"] = handle }; 211internal async Task<JsonNode?> InvokeCoreAsync(string capability, JsonObject arguments, NativeRpcConnection callbackConnection) 539private static JsonObject LoadContract() 544return JsonNode.Parse(stream) as JsonObject
Rpc\NativeRpcConnection.Dispatch.cs (2)
82if (parameters is not JsonArray { Count: 2 } arguments || arguments[1] is not JsonObject capabilityArguments) 139if (_providers is null || parameters is not JsonArray { Count: 2 } callback || callback[1] is not JsonObject callbackArguments)
Rpc\NativeRpcProtocol.cs (1)
161JsonValueKind.Object => JsonObject.Create(element.Clone()),
Rpc\RpcArguments.cs (3)
13public static void Validate(JsonObject arguments, string[] names) 44if (value is JsonObject reference && typeIds.Contains(String(reference["$type"]), StringComparer.Ordinal)) 59value is JsonObject ? value.Deserialize(typeInfo)
Aspire.Hosting.Radius (4)
Publishing\RadiusDeploymentPipelineStep.cs (4)
73if (JsonNode.Parse(json) is not JsonObject root || 74root["controlPlane"] is not JsonObject controlPlane || 675var parametersNode = new JsonObject(); 688var document = new JsonObject
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\AtsError.cs (4)
43public JsonObject ToJsonObject() 45var obj = new JsonObject 94public JsonObject ToJsonObject() 96var obj = new JsonObject();
Ats\AtsMarshaller.cs (5)
258private object? DeserializeDto(JsonObject jsonObj, Type targetType, UnmarshalContext context) 647if (node is JsonObject jsonObj) 730JsonObject obj when obj.ContainsKey("$handle") => "handle", 731JsonObject => "object", 1011public void ApplyDtoProperties(JsonObject source, object target, Type targetType)
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)
Ats\HandleRegistry.cs (3)
138public JsonObject Marshal(object obj, string typeId) 197if (node is JsonObject obj && obj.TryGetPropertyValue("$handle", out var handleNode)) 213return node is JsonObject obj && obj.ContainsKey("$handle");
Ats\PolyglotCapabilityInvocationException.cs (4)
130JsonObject? args, 154JsonObject? args, 180JsonObject? args, 251private static string TryGetTargetContext(JsonObject? args, HandleRegistry handles, string? targetParameterName)
Ats\ReferenceExpressionRef.cs (3)
71if (node is not JsonObject obj || !obj.TryGetPropertyValue("$expr", out var exprNode)) 76if (exprNode is not JsonObject exprObj) 138return node is JsonObject obj && obj.ContainsKey("$expr");
Diagnostics\RemoteHostProfilingTelemetry.cs (3)
157public ActivityScope StartJsonRpcInvokeCapability(string capabilityId, JsonObject? args) 443public void SetCapabilityInvocation(string capabilityId, JsonObject? args) 513private static string[] SanitizeArgumentNames(JsonObject? args)
RemoteAppHostService.cs (2)
125public async Task<JsonNode?> InvokeCapabilityAsync(string capabilityId, JsonObject? args, CancellationToken cancellationToken) 224public async Task<JsonNode?> InvokeGuestCallbackAsync(string callbackId, JsonObject? args, CancellationToken cancellationToken)
Aspire.Hosting.RemoteHost.Tests (206)
AtsCapabilityScannerTests.cs (2)
809var valueObject = Assert.IsType<JsonObject>(exportedValue.Value);
AtsMarshallerTests.cs (57)
203var result = Assert.IsType<JsonObject>(marshaller.MarshalToJson(value, typeRef)); 401var json = new JsonObject 442var json = new JsonObject { ["$handle"] = handleId }; 454var json = new JsonObject { ["$handle"] = "aspire/Unknown:999" }; 490var json = new JsonObject { ["key1"] = 1, ["key2"] = 2 }; 608Assert.IsType<JsonObject>(result); 609var jsonObj = (JsonObject)result; 627Assert.IsType<JsonObject>(result); 628var jsonObj = (JsonObject)result; 646Assert.IsType<JsonObject>(result); 647var jsonObj = (JsonObject)result; 768var json = new JsonObject { ["a"] = 1, ["b"] = 2 }; 781var json = new JsonObject { ["value"] = 42 }; 794var json = new JsonObject { ["name"] = "test", ["count"] = 5 }; 808var json = new JsonObject 842Assert.IsType<JsonObject>(result); 843var jsonObj = (JsonObject)result; 852var json = new JsonObject 871var json = new JsonObject 896var json = Assert.IsType<JsonObject>(result); 906var json = new JsonObject { ["required"] = double.MaxValue }; 990var obj = Assert.IsType<JsonObject>(result); 1006var obj = Assert.IsType<JsonObject>(result); 1008var childObj = Assert.IsType<JsonObject>(obj["child"]); 1026var obj = Assert.IsType<JsonObject>(result); 1042var obj = Assert.IsType<JsonObject>(result); 1044var childObj = Assert.IsType<JsonObject>(obj["child"]); 1054var source = new JsonObject { ["name"] = "updated", ["count"] = 42 }; 1067var source = new JsonObject { ["name"] = "updated" }; 1084var source = new JsonObject { ["count"] = JsonNode.Parse(countJson) }; 1098var source = new JsonObject { ["count"] = JsonNode.Parse(countJson) }; 1109var source = new JsonObject 1126var source = new JsonObject { ["display_name"] = "updated", ["val"] = 99 }; 1140var source = new JsonObject { ["displayName"] = "should-not-apply" }; 1152var source = new JsonObject { ["name"] = "updated", ["secret"] = "should-be-ignored" }; 1165var source = new JsonObject { ["name"] = "updated", ["computed"] = "should-be-ignored" }; 1179var source = new JsonObject { ["count"] = "not-a-number" }; 1192var source = new JsonObject 1342Assert.IsType<JsonObject>(result); 1343var jsonObj = (JsonObject)result; 1428var json = new JsonObject 1469var json = new JsonObject 1511var json = new JsonObject 1550var json = new JsonObject
CallbackProxyTests.cs (12)
206var args = invoker.Invocations[0].Args as JsonObject; 223var args = invoker.Invocations[0].Args as JsonObject; 249var args = Assert.IsAssignableFrom<JsonObject>(invoker.Invocations[0].Args); 250var handle = Assert.IsAssignableFrom<JsonObject>(args["p0"]); 280var args = invoker.Invocations[0].Args as JsonObject; 301var args = invoker.Invocations[0].Args as JsonObject;
CapabilityDispatcherTests.cs (106)
191var args = new JsonObject { ["builder"] = new JsonObject { ["$handle"] = handleId } }; 243var args = new JsonObject 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 } }; 627var handleRef = result.AsObject(); 639var nestedArgs = new JsonObject { ["context"] = new JsonObject { ["$handle"] = nestedHandleId } }; 697var args = new JsonObject 718var args = new JsonObject 737var args = new JsonObject 756var args = new JsonObject 789var args = new JsonObject 807var args = new JsonObject 828var args = new JsonObject 848var args = new JsonObject 864var args = new JsonObject { ["value"] = "value-task" }; 905var args = new JsonObject 928var args = new JsonObject 949var args = new JsonObject 957var callbackArgs = invoker.Invocations[0].Args as JsonObject; 972var args = new JsonObject 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 1317var args = new JsonObject { ["value"] = nameof(TestDispatchEnum.ValueB) }; 1329var args = new JsonObject { ["value"] = "/usr/local/lib/redis/modules/redisearch.so" }; 1341var args = new JsonObject 1367var args = new JsonObject 1382var args = new JsonObject 1400var args = new JsonObject 1428var resultObj = result as JsonObject; 1441var listHandle = (listResult as JsonObject)?["$handle"]?.GetValue<string>(); 1445var args = new JsonObject 1464var listHandle = (listResult as JsonObject)?["$handle"]?.GetValue<string>(); 1467var args = new JsonObject 1487var listHandle = (listResult as JsonObject)?["$handle"]?.GetValue<string>(); 1491var removeArgs = new JsonObject 1502var lengthArgs = new JsonObject 1520var listHandle = (listResult as JsonObject)?["$handle"]?.GetValue<string>(); 1523var args = new JsonObject 1542var listHandle = (listResult as JsonObject)?["$handle"]?.GetValue<string>(); 1546var clearArgs = new JsonObject 1553var lengthArgs = new JsonObject 1574var resultObj = result as JsonObject; 1587var dictHandle = (dictResult as JsonObject)?["$handle"]?.GetValue<string>(); 1591var args = new JsonObject 1610var dictHandle = (dictResult as JsonObject)?["$handle"]?.GetValue<string>(); 1613var args = new JsonObject 1632var dictHandle = (dictResult as JsonObject)?["$handle"]?.GetValue<string>(); 1635var args = new JsonObject 1655var dictHandle = (dictResult as JsonObject)?["$handle"]?.GetValue<string>(); 1659var removeArgs = new JsonObject 1670var countArgs = new JsonObject 1688var dictHandle = (dictResult as JsonObject)?["$handle"]?.GetValue<string>(); 1692var hasArgs = new JsonObject 1703var hasArgs2 = new JsonObject 1722var dictHandle = (dictResult as JsonObject)?["$handle"]?.GetValue<string>(); 1725var args = new JsonObject 1747var dictHandle = (dictResult as JsonObject)?["$handle"]?.GetValue<string>(); 1750var args = new JsonObject 1771var dictHandle = (dictResult as JsonObject)?["$handle"]?.GetValue<string>(); 1774var args = new JsonObject 1791var dictHandle = (dictResult as JsonObject)?["$handle"]?.GetValue<string>(); 1794var args = new JsonObject 1811var args = new JsonObject 1828var args = new JsonObject 1845var args = new JsonObject 1862var args = new JsonObject 1888var args = new JsonObject 1907var args = new JsonObject 1925var args = new JsonObject 1943var args = new JsonObject(); 1965var args = new JsonObject { ["context"] = new JsonObject { ["$handle"] = handleId } }; 1983var args = new JsonObject 2003var args = new JsonObject 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 2100var args = new JsonObject 2122var args = new JsonObject 2144var args = new JsonObject 2165var args = new JsonObject 2191var args = new JsonObject 2219var args = new JsonObject 2239var args = new JsonObject 2266var args = new JsonObject 2294var args = new JsonObject 2380var args = new JsonObject
ExternalCapabilityRegistryTests.cs (7)
103var payload = JsonNode.Parse(CreateCapabilities("test.external/value").GetRawText())!.AsObject(); 148var payload = JsonNode.Parse(CreateCapabilities("test.external/valid", "test.external/invalid").GetRawText())!.AsObject(); 149var invalidCapability = payload["capabilities"]![1]!.AsObject(); 246var payload = JsonNode.Parse(CreateCapabilities("test.external/cancel").GetRawText())!.AsObject(); 554var payload = JsonNode.Parse(CreateCapabilities("test.external/value").GetRawText())!.AsObject(); 674var firstArgs = new JsonObject { ["name"] = "first", ["configure"] = "guest_callback" }; 675var secondArgs = new JsonObject { ["name"] = "second", ["configure"] = "guest_callback" };
HandleRegistryTests.cs (8)
167var json = registry.Marshal(obj, "aspire/TestObject"); 243var json = new JsonObject { ["$handle"] = "42" }; 272var json = new JsonObject { ["name"] = "test", ["value"] = 42 }; 282var json = new JsonObject { ["$handle"] = 42 }; 291var json = new JsonObject 307var json = new JsonObject { ["$handle"] = "1" }; 329var json = new JsonObject { ["name"] = "test" }; 338var json = new JsonObject { ["$handle"] = 42 };
KubernetesManifestTests.cs (2)
40var serviceHandle = handles.Marshal(service, "Aspire.Hosting.Kubernetes/Aspire.Hosting.Kubernetes.KubernetesResource"); 113var handle = handles.Marshal(new ContainerResource("invalid"), "Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerResource");
ReferenceExpressionRefTests.cs (7)
17var json = new JsonObject 38var json = new JsonObject 65var json = new JsonObject 91var json = new JsonObject 104var json = new JsonObject { ["format"] = "test" }; 255var json = new JsonObject 270((JsonObject)json["$expr"]!)["valueProviders"] = providersArray;
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)
Backchannel\AuxiliaryBackchannelRpcTargetTests.cs (2)
1379var nameValueObject = Assert.IsAssignableFrom<JsonObject>(snapshot.Properties["object"]);
Dcp\AppHostLocalStateStoreTests.cs (3)
67var resources = JsonNode.Parse(File.ReadAllText(stateFile))?["portAllocations"]?["resources"]?.AsObject(); 94var state = JsonNode.Parse(File.ReadAllText(stateFile))!.AsObject(); 122var state = JsonNode.Parse(File.ReadAllText(stateFile))!.AsObject();
DistributedApplicationBuilderTests.cs (1)
716var state = System.Text.Json.Nodes.JsonNode.Parse("""
JsonFlattenerTests.cs (16)
16var userSecrets = new JsonObject 34var result = JsonFlattener.FlattenJsonObject(userSecrets); 50var userSecrets = new JsonObject 58var result = JsonFlattener.FlattenJsonObject(userSecrets); 71var userSecrets = new JsonObject(); 74var result = JsonFlattener.FlattenJsonObject(userSecrets); 84var userSecrets = new JsonObject 99var result = JsonFlattener.FlattenJsonObject(userSecrets); 110var userSecrets = new JsonObject 124var result = JsonFlattener.FlattenJsonObject(userSecrets); 139var userSecrets = new JsonObject 147var result = JsonFlattener.FlattenJsonObject(userSecrets); 168var userSecrets = new JsonObject 187var result = JsonFlattener.FlattenJsonObject(userSecrets); 203var userSecrets = new JsonObject 210var result = JsonFlattener.FlattenJsonObject(userSecrets);
ManifestExpressionTests.cs (1)
73var variables = manifest["resources"]!["consumer"]!["env"]!.AsObject();
Orchestrator\ParameterProcessorTests.cs (5)
2729private readonly JsonObject _unflattenedState = []; 2730private JsonObject? _flattenedState; 2733public JsonObject State => _flattenedState ?? []; 2743var sectionData = _unflattenedState.TryGetPropertyValue(sectionName, out var sectionNode) && sectionNode is JsonObject obj
Publishing\ContainerImageArchiveRewriterTests.cs (1)
453var metadata = new JsonObject();
Publishing\DeploymentStateManagerTests.cs (8)
224var state = new JsonObject 718var features = Assert.IsType<JsonObject>(restartedSection.Data["Features"]); 1024var asyncEffectiveState = await FileDeploymentStateManager.LoadEffectiveStateAsync( 1027var syncEffectiveState = FileDeploymentStateManager.LoadEffectiveState( 1048var asyncEffectiveState = await FileDeploymentStateManager.LoadEffectiveStateAsync( 1051var syncEffectiveState = FileDeploymentStateManager.LoadEffectiveState( 1205var effectiveState = FileDeploymentStateManager.LoadEffectiveState(canonicalPath, legacyPath);
Aspire.Hosting.TestUtilities (1)
Utils\MockUserSecretsManager.cs (1)
49public Task SaveStateAsync(JsonObject state, CancellationToken cancellationToken = default)
Aspire.Hosting.Yarp (5)
YarpJsonConfigGeneratorBuilder.cs (5)
83var jsonObject = new JsonObject(); 94private JsonObject AddRoutes() 96var routesNode = new JsonObject(); 108private JsonObject AddClusters() 110var routesNode = new JsonObject();
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)
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\JwtSerializerContext.GetJsonTypeInfo.g.cs (1)
54if (type == typeof(global::System.Text.Json.Nodes.JsonObject))
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\JwtSerializerContext.JsonObject.g.cs (8)
13private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::System.Text.Json.Nodes.JsonObject>? _JsonObject; 19public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::System.Text.Json.Nodes.JsonObject> JsonObject 22get => _JsonObject ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::System.Text.Json.Nodes.JsonObject>)Options.GetTypeInfo(typeof(global::System.Text.Json.Nodes.JsonObject)); 25private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::System.Text.Json.Nodes.JsonObject> Create_JsonObject(global::System.Text.Json.JsonSerializerOptions options) 27if (!TryGetTypeInfoForRuntimeCustomConverter<global::System.Text.Json.Nodes.JsonObject>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::System.Text.Json.Nodes.JsonObject> jsonTypeInfo)) 29jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateValueInfo<global::System.Text.Json.Nodes.JsonObject>(options, global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.JsonObjectConverter);
Helpers\JwtAuthenticationSchemeSettings.cs (8)
18var config = File.Exists(filePath) 22var settingsObject = new JsonObject 28if (config[AuthenticationKey] is JsonObject authentication) 30if (authentication[SchemesKey] is JsonObject schemes) 63static JsonObject ReadConfiguration(string filePath) 73var config = JsonSerializer.Deserialize(reader, JwtSerializerContext.Default.JsonObject); 76if (config[AuthenticationKey] is JsonObject authentication && 77authentication[SchemesKey] is JsonObject schemes)
Helpers\JwtSerializerOptions.cs (1)
24[JsonSerializable(typeof(JsonObject))]
Helpers\SigningKeysHandler.cs (1)
65JsonObject secrets = null;
GenerateTemplateManifest (6)
ComponentManifest.cs (3)
14private readonly SortedDictionary<string, JsonObject> _registrations = new(StringComparer.Ordinal); 89foreach (var registration in _registrations.Values) 93var manifest = new JsonObject
TemplateRestorePlan.cs (3)
73var config = JsonNode.Parse(File.ReadAllText(configPath))!.AsObject(); 92internal static IEnumerable<Dictionary<string, string?>> GetConfigurations(JsonObject config, string content) 94var symbols = config["symbols"]?.AsObject() ?? [];
Infrastructure.Tests (106)
Pipelines\NixCliPackageTests.cs (11)
53var manifest = await ReadJsonObjectAsync(outputPath); 54var systems = GetRequiredObject(manifest, "systems"); 59var entry = GetRequiredObject(systems, system); 110var manifest = await ReadJsonObjectAsync(outputPath); 111var systems = GetRequiredObject(manifest, "systems"); 115var entry = GetRequiredObject(systems, system); 142private static async Task<JsonObject> ReadJsonObjectAsync(string relativePath) 185private static JsonObject GetRequiredObject(JsonObject obj, string propertyName) 188return Assert.IsType<JsonObject>(value); 191private static string GetRequiredString(JsonObject obj, string propertyName)
Pipelines\NpmCliPackageTests.cs (9)
130var packageJson = ReadJsonObject(Path.Combine(package.PointerPackageRoot, "package.json")); 146var packageMap = ReadJsonObject(Path.Combine(package.PointerPackageRoot, "bin", "aspire-package-map.json")); 203var packageJson = ReadJsonObject(Path.Combine(package.RidPackageRoot, "package.json")); 261var packageMap = new JsonObject(); 347private static JsonObject ReadJsonObject(string path) 354private static JsonObject GetObject(JsonObject jsonObject, string propertyName) 360private static string GetString(JsonObject jsonObject, string propertyName) 372private static Dictionary<string, string> GetStringMap(JsonObject jsonObject)
TemplateManifest\TemplateManifestCacheTests.cs (1)
58var manifests = new JsonObject
TemplateManifest\TemplateManifestNpmTests.cs (1)
43var dependencies = lockfile["packages"]![""]![group]!.AsObject();
TemplateManifest\TemplateRestorePlanTests.cs (1)
238var config = JsonNode.Parse("""
WorkflowScripts\AnalyzeCiFailureReportTemplatesTests.cs (1)
71JsonObject? overrides = null)
WorkflowScripts\AutoSecWorkflowTests.cs (82)
100var request = CreateCollectionScenario(); 121var request = CreateCollectionScenario(); 124var contents = request["contents"]!.AsObject(); 167var request = CreateCollectionScenario(); 204var scenario = CreateApprovalScenario(); 224var scenario = CreateApprovalScenario(); 251var scenario = CreateApprovalScenario(); 281var scenario = CreateApprovalScenario(); 302var scenario = CreateApprovalScenario(); 336var scenario = CreateApprovalScenario(); 376var scenario = CreateApprovalScenario(); 377var valid = new JsonObject { ["status"] = "ahead", ["merge_base_commit"] = new JsonObject { ["sha"] = new string('b', 40) } }; 378var comparison = valid.DeepClone().AsObject(); 432var scenario = CreateApprovalScenario(); 491var scenario = CreateApprovalScenario(); 492var pr = scenario["pr"]!.AsObject(); 887var workspaceFiles = new JsonObject 891var request = new JsonObject 1043var request = new JsonObject 1122var output = PublicOutputFixture("create_pull_request"); 1169var output = PublicOutputFixture("create_pull_request"); 1193var output = PublicOutputFixture("create_pull_request"); 1287JsonObject item = push 1473var output = PublicOutputFixture("create_pull_request"); 1495var output = PublicOutputFixture("create_pull_request"); 1536var output = PublicOutputFixture("push_to_pull_request_branch"); 1600var output = PublicOutputFixture("push_to_pull_request_branch"); 1657var files = layout is "installed-copies" or "introduced" 1669var heads = new JsonObject(); 1685var output = PublicOutputFixture("push_to_pull_request_branch"); 1843var output = PublicOutputFixture("create_pull_request"); 1948var output = PublicOutputFixture("create_pull_request"); 1996var baseline = new JsonObject { ["lockfileVersion"] = version, ["requires"] = true }; 2015var output = PublicOutputFixture("create_pull_request"); 2108var output = PublicOutputFixture("push_to_pull_request_branch"); 2200var output = PublicOutputFixture("push_to_pull_request_branch"); 2304var output = PublicOutputFixture("push_to_pull_request_branch"); 2359var output = PublicOutputFixture("push_to_pull_request_branch"); 2428var output = PublicOutputFixture("push_to_pull_request_branch"); 2471var output = PublicOutputFixture("push_to_pull_request_branch"); 2510var output = PublicOutputFixture("push_to_pull_request_branch"); 2570var output = PublicOutputFixture("create_pull_request"); 2719var output = PublicOutputFixture("create_pull_request"); 2899var output = PublicOutputFixture("create_pull_request"); 3004var output = PublicOutputFixture("create_pull_request"); 3030var request = new JsonObject 3056var expected = PublicOutputFixture(type); 3057var input = expected.DeepClone().AsObject(); 3083var expected = PublicOutputFixture(type); 3091var input = expected.DeepClone().AsObject(); 3128var input = PublicOutputFixture(type); 3146private static JsonObject PublicOutputFixture(string type) => type switch 3886var scenario = CreateApprovalScenario(); 3902var scenario = CreateApprovalScenario(); 3926var scenario = CreateApprovalScenario(); 3951var scenario = CreateApprovalScenario(); 3968var scenario = CreateApprovalScenario(); 3969var pr = scenario["pr"]!.AsObject(); 3996var scenario = CreateApprovalScenario(); 3998var overrides = new JsonObject(); 4024var scenario = CreateApprovalScenario(); 4163var headContents = new JsonObject 4170var baseContents = new JsonObject 4197var baseContents = new JsonObject 4258var responses = new JsonObject 4284static JsonObject NuGetLookup(string name, string config, JsonObject responses) => new() 4303var leaf = new JsonObject { ["published"] = published }; 4426var closed = new JsonObject 4440var scenario = new JsonObject 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 }); 4633private static JsonObject CreatePushGateScenario(JsonObject prOverrides, JsonObject? item = null) 4635var pr = new JsonObject 4657private static JsonObject Response(JsonNode body) => new() { ["status"] = 200, ["body"] = body }; 4670private static JsonObject ServiceIndex(string flatContainer) => Response(new JsonObject 4675private static JsonObject CreateCollectionScenario() => new() 4740private static JsonObject CreateApprovalScenario() => new() 4781private async Task<JsonNode> RunHarnessAsync(JsonObject request)
Microsoft.AspNetCore.JsonPatch.SystemTextJson (13)
Adapters\AdapterFactory.cs (1)
33JsonObject => new JsonObjectAdapter(),
Internal\JsonObjectAdapter.cs (12)
20var obj = (JsonObject)target; 35var obj = (JsonObject)target; 55var obj = (JsonObject)target; 74var obj = (JsonObject)target; 96var obj = (JsonObject)target; 127var obj = (JsonObject)target;
Microsoft.AspNetCore.OpenApi (10)
Extensions\JsonNodeSchemaExtensions.cs (2)
444var mappings = new JsonObject(); 570else if (schema is JsonObject schemaObject)
Schemas\OpenApiJsonSchema.Helpers.cs (1)
157var obj = new JsonObject();
Services\Schemas\OpenApiSchemaService.cs (7)
159private static JsonObject CreateSchemaForJsonPatch() 161var addReplaceTest = new JsonObject() 181var moveCopy = new JsonObject() 204var remove = new JsonObject() 589if (node is JsonObject jsonObject) 617var newObject = new JsonObject(); 730if (currentNode is JsonObject currentObject)
Microsoft.Extensions.AI (4)
ChatCompletion\ChatClientStructuredOutputExtensions.cs (2)
169}, AIJsonUtilities.DefaultOptions.GetTypeInfo(typeof(JsonObject))); 225JsonValueKind.Object => JsonObject.Create(element),
Realtime\LoggingRealtimeClientSession.cs (2)
189var obj = new JsonObject 212var obj = new JsonObject
Microsoft.Extensions.AI.Abstractions (29)
Utilities\AIJsonUtilities.cs (1)
174case JsonObject obj:
Utilities\AIJsonUtilities.Defaults.cs (1)
73[JsonSerializable(typeof(JsonObject))]
Utilities\AIJsonUtilities.Schema.Create.cs (23)
90JsonObject parameterSchemas = new(); 240JsonObject? schemaObj = null; 285if (schema is JsonObject objSchema) 324JsonObject obj = ConvertSchemaToObject(ref schema); 404static JsonObject ConvertSchemaToObject(ref JsonNode schema) 406JsonObject obj; 411return (JsonObject)schema; 454JsonObject obj = ConvertSchemaToObject(ref schema); 467JsonObject obj = ConvertSchemaToObject(ref schema); 481JsonObject obj = ConvertSchemaToObject(ref schema); 495JsonObject obj = ConvertSchemaToObject(ref schema); 564schema is JsonObject requiredSchemaObj && 607JsonObject obj = ConvertSchemaToObject(ref schema); 631JsonObject obj = ConvertSchemaToObject(ref schema); 644JsonObject obj = ConvertSchemaToObject(ref schema); 647if (notNode is null or JsonObject) 649JsonObject notObj = 650notNode as JsonObject ?? 651(JsonObject)(obj[NotPropertyName] = new JsonObject()); 666JsonObject obj = ConvertSchemaToObject(ref schema); 711static bool TryGetSchemaType(JsonObject schema, [NotNullWhen(true)] out string? schemaType, out bool isNullable) 777private static bool TypeIsIntegerWithStringNumberHandling(AIJsonSchemaCreateContext ctx, JsonObject schema, [NotNullWhen(true)] out string? numericType, out bool isNullable) 821private static void InsertAtStart(this JsonObject jsonObject, string key, JsonNode value)
Utilities\AIJsonUtilities.Schema.Transform.cs (4)
64JsonObject schemaObj = (JsonObject)schema; 65JsonObject? properties = null; 68if (schemaObj.TryGetPropertyValue(PropertiesPropertyName, out JsonNode? props) && props is JsonObject propsObj)
Microsoft.Extensions.AI.Abstractions.Tests (8)
Contents\FunctionCallContentTests.cs (1)
97var jsonObj = json!.AsObject();
test\Shared\JsonSchemaExporter\TestTypes.cs (2)
105yield return new TestData<JsonObject>(new() { ["x"] = 42 }, """{"type":["object","null"]}"""); 1249[JsonSerializable(typeof(JsonObject))]
Utilities\AIJsonUtilitiesTests.cs (5)
1829var schemaObj = Assert.IsType<JsonObject>(schema); 1844var schemaObj = Assert.IsType<JsonObject>(schema); 1850Assert.Equal(((JsonArray)schemaObj["required"]!).Count, ((JsonObject)props!).Count);
Microsoft.Extensions.AI.Evaluation.Safety (9)
ContentSafetyServicePayloadUtilities.cs (9)
148var payload = 194IEnumerable<JsonObject> userTextListItems = 200var item = new JsonObject(); 230var payload = 274IEnumerable<JsonObject> GetMessages(Dictionary<string, ChatMessage> turn, int turnIndex) 280IEnumerable<JsonObject> contents = GetContents(question); 291IEnumerable<JsonObject> contents = GetContents(answer); 314IEnumerable<JsonObject> GetContents(ChatMessage message) 356var payload =
Microsoft.Extensions.AI.OpenAI (2)
OpenAIClientExtensions.cs (1)
59if (node is JsonObject schemaObj)
OpenAIRealtimeClientSession.cs (1)
367JsonObject obj => obj.ToJsonString(),
Microsoft.ML.AutoML (1)
SweepableEstimator\Converter\SweepableEstimatorConverter.cs (1)
29var jObject = JsonObject.Parse("{}");
Microsoft.ML.AutoML.SourceGenerator (1)
SearchSpaceGenerator.cs (1)
93else if (searchSpaceNode is JsonObject searchSpaceObject && searchSpaceObject.ContainsKey("min"))
Microsoft.NET.Build.Containers (16)
ImageConfig.cs (14)
15private readonly JsonObject _config; 50_config = config as JsonObject ?? throw new ArgumentException($"{nameof(config)} should be a JSON object.", nameof(config)); 51if (_config["config"] is not JsonObject) 90var newConfig = new JsonObject(); 151var configContainer = new JsonObject() 171private JsonObject CreateHistory(HistoryEntry h) 173var history = new JsonObject(); 246if (_config["config"]?["ExposedPorts"] is JsonObject portsJson) 252&& property.Value is JsonObject propertyValue 265if (_config["config"]?["Labels"] is JsonObject labelsJson) 300private JsonObject CreatePortMap() 304JsonObject container = new(); 323private JsonObject CreateLabelMap() 325JsonObject container = new();
Tasks\CreateImageIndex.cs (2)
145var configJson = JsonNode.Parse(config) as JsonObject;
Microsoft.NET.Build.Tasks (12)
GenerateRuntimeConfigurationFiles.cs (12)
295JsonObject runtimeOptionsFromProject = (JsonObject)JsonNode.Parse( 312JsonObject configProperties = GetConfigProperties(runtimeOptions); 320private static JsonObject GetConfigProperties(RuntimeOptions runtimeOptions) 323|| configProperties is not JsonObject) 329return (JsonObject)configProperties; 363JsonObject configProperties = GetConfigProperties(devConfig.RuntimeOptions); 416JsonObject json = new() 435private static JsonObject SerializeRuntimeOptions(RuntimeOptions runtimeOptions) 438JsonObject json = new(); 503private static JsonObject SerializeFramework(RuntimeConfigFramework framework) 505JsonObject json = new();
Microsoft.NETCore.Platforms (1)
UpdateRuntimeIdentifierGraph.cs (1)
32JsonObject runtimes = json!["runtimes"]!.AsObject();
Microsoft.TemplateEngine.Cli (23)
Alias\AliasRegistry.cs (5)
139JsonObject parsed = _environmentSettings.Host.FileSystem.ReadObject(_aliasesFilePath); 149JsonObject root = new(); 150JsonObject commandAliases = new(); 170private IReadOnlyDictionary<string, IReadOnlyList<string>> ToStringListDictionary(JsonObject token, StringComparer? comparer = null, string? propertyName = null) 190if (element is not JsonObject jObj)
HostSpecificDataLoader.cs (2)
48JsonObject? jObject = JsonNode.Parse(hostData, nodeOptions: null, s_jsonDocumentOptions)?.AsObject(); 69JsonObject? jsonData;
HostSpecificTemplateData.cs (5)
18internal HostSpecificTemplateData(JsonObject? jObject) 37if (symbolsNode is JsonObject symbols) 41if (symbolInfo.Value is not JsonObject symbol) 177internal static HostSpecificTemplateData Default { get; } = new HostSpecificTemplateData((JsonObject?)null); 190private static JsonNode? GetPropertyCaseInsensitive(JsonObject obj, string key)
JExtensions.cs (8)
36if (token is not JsonObject obj) 123if (token is not JsonObject obj) 162if (token is not JsonObject currentJObj) 170if (element is not JsonObject nested) 183if (token is not JsonObject obj || key == null) 217internal static JsonObject ReadObject(this IPhysicalFileSystem fileSystem, string path) 222return (JsonObject?)JsonNode.Parse(json, null, DocOptions) 267private static JsonNode? GetPropertyCaseInsensitive(JsonObject obj, string key)
TemplateSearch\CliHostSearchCacheData.cs (3)
16JsonObject? cacheObject = obj as JsonObject; 40cliData[data.Key] = new HostSpecificTemplateData(data.Value as JsonObject);
Microsoft.TemplateEngine.Edge (59)
BuiltInManagedProvider\GlobalSettings.cs (1)
83var jObject = _environmentSettings.Host.FileSystem.ReadObject(_globalSettingsFile);
Constraints\ConstraintsExtensions.cs (2)
52public static IEnumerable<JsonObject> ParseArrayOfConstraintJObjects(this string? args) 59if (value is not JsonObject jObj)
Constraints\HostConstraint.cs (1)
74foreach (JsonObject jObj in args.ParseArrayOfConstraintJObjects())
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\SettingsStore.cs (4)
14internal SettingsStore(JsonObject? obj) 23if (componentGuidToAssemblyQualifiedNameToken is JsonObject componentGuidToAssemblyQualifiedNameObject) 51if (componentTypeToGuidListToken is JsonObject componentTypeToGuidListObject) 92JsonObject parsed;
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)
Settings\TemplateInfo.cs (2)
71internal TemplateInfo(IScanTemplateInfo template, ILocalizationLocator? localizationInfo, (string Path, JsonObject? Content)? hostConfig) 243public static TemplateInfo FromJObject(JsonObject entry)
Settings\TemplateInfoReader.cs (10)
18internal static TemplateInfo FromJObject(JsonObject entry) 56JsonObject? baselineJObject = entry.Get<JsonObject>(nameof(ITemplateInfo.BaselineInfo)); 83if (item is JsonObject jObj) 94JsonObject? tagsObject = entry.Get<JsonObject>(nameof(TagsCollection)); 259/// Parses <see cref="ITemplateParameter"/> from <see cref="JsonObject"/>. 262private static ITemplateParameter ParameterFromJObject(JsonObject jObject) 285JsonObject? cdToken = jObject.Get<JsonObject>(nameof(ITemplateParameter.Choices));
Microsoft.TemplateEngine.Orchestrator.RunnableProjects (103)
ConfigModel\BaseReplaceSymbol.cs (1)
23private protected BaseReplaceSymbol(JsonObject jObject, string name) : base(name)
ConfigModel\BaseValueSymbol.cs (2)
18private protected BaseValueSymbol(string name, JsonObject jObject, string? defaultOverride, bool symbolConditionsSupported = false) : base(jObject, name) 23if (!jObject.TryGetValue(nameof(Forms), out JsonNode? formsToken) || formsToken is not JsonObject formsObject)
ConfigModel\BindSymbol.cs (1)
26internal BindSymbol(string name, JsonObject jObject) : base(jObject, name)
ConfigModel\ComputedSymbol.cs (1)
26internal ComputedSymbol(string name, JsonObject jObject) : base(name)
ConfigModel\CustomFileGlobModel.cs (2)
40internal static CustomFileGlobModel FromJObject(JsonObject globData, string globName) 48if (operationConfig is JsonObject obj)
ConfigModel\CustomOperationModel.cs (2)
25internal static CustomOperationModel FromJObject(JsonObject jObject) 31Configuration = jObject.Get<JsonObject>(nameof(Configuration))?.ToJsonString(),
ConfigModel\DerivedSymbol.cs (1)
32internal DerivedSymbol(string name, JsonObject jObject, string? defaultOverride)
ConfigModel\ExtendedFileSource.cs (5)
57internal static ExtendedFileSource FromJObject(JsonObject jObject) 66Rename = jObject.Get<JsonObject>(nameof(Rename))?.ToStringDictionary().ToDictionary(x => x.Key, x => x.Value) ?? RenameDefaults, 72foreach (JsonObject entry in jObject.Items<JsonObject>(nameof(src.Modifiers))) 80Rename = entry.Get<JsonObject>(nameof(Rename))?.ToStringDictionary().ToDictionary(x => x.Key, x => x.Value) ?? RenameDefaults,
ConfigModel\GeneratedSymbol.cs (1)
32internal GeneratedSymbol(string name, JsonObject jObject) : base(jObject, name)
ConfigModel\ParameterSymbol.cs (4)
29internal ParameterSymbol(string name, JsonObject jObject, string? defaultOverride) 42foreach (JsonObject choiceObject in jObject.Items<JsonObject>(nameof(Choices))) 191private static TemplateParameterPrecedence GetPrecedence(bool isRequired, JsonObject jObject)
ConfigModel\ReplacementContext.cs (2)
31internal static IReadOnlyList<ReplacementContext> FromJObject(JsonObject jObject) 40if (entry is not JsonObject)
ConfigModel\SymbolModelConverter.cs (1)
14internal static BaseSymbol? GetModelForObject(string name, JsonObject jObject, ILogger? logger, string? defaultOverride)
ConfigModel\SymbolValueFormsModel.cs (1)
33internal static SymbolValueFormsModel FromJObject(JsonObject configJson)
ConfigModel\TemplateConfigModel.cs (13)
47private TemplateConfigModel(JsonObject source, ILogger? logger, string? baselineName = null) 80foreach (JsonObject item in source.Items<JsonObject>(nameof(Sources))) 111if (prop.Value is not JsonObject obj) 161GlobalCustomOperations = CustomFileGlobModel.FromJObject((JsonObject)globalCustomConfigData, string.Empty); 173CustomFileGlobModel globModel = CustomFileGlobModel.FromJObject((JsonObject)globData, globName); 182if (prop.Value is not JsonObject obj) 434JsonObject source = JExtensions.ParseJsonObject(json); 438internal static TemplateConfigModel FromJObject(JsonObject source, ILogger? logger = null, string? baselineName = null) 523private static Dictionary<string, IValueForm> SetupValueFormMapForTemplate(JsonObject? source = null) 546if (form.Value is JsonObject o) 560if (property.Value is not JsonObject obj) 565IReadOnlyDictionary<string, string>? defaultOverrides = obj.Get<JsonObject>(nameof(Utils.BaselineInfo.DefaultOverrides))?.ToStringDictionary() ?? new Dictionary<string, string>();
DirectoryBasedTemplate.cs (4)
160private static JsonObject MergeAdditionalConfiguration(JsonObject primarySource, IFileSystemInfo primarySourceConfig) 169JsonObject combinedSource = primarySource.DeepCloneObject(); 184JsonObject partialConfigJson = partialConfigFile.ReadJObjectFromIFile();
LocalizationModelDeserializer.cs (1)
29System.Text.Json.Nodes.JsonObject srcObject = file.ReadJObjectFromIFile();
Macros\JoinMacroConfig.cs (1)
36if (entry is not JsonObject jObj)
Macros\RegexMacroConfig.cs (1)
38if (entry is not JsonObject jObj)
Macros\SwitchMacroConfig.cs (1)
37if (entry is not JsonObject jObj)
OperationConfig\BalancedNestingConfig.cs (3)
21JsonObject rawConfiguration = JExtensions.ParseJsonObject(configuration); 32internal static JsonObject CreateConfiguration(string startToken, string realEndToken, string pseudoEndToken, string id, string resetFlag) 34JsonObject config = new JsonObject
OperationConfig\ConditionalBlockCommentConfig.cs (1)
14internal static List<IOperationProvider> ConfigureFromJObject(JsonObject rawConfiguration)
OperationConfig\ConditionalConfig.cs (1)
22JsonObject rawConfiguration = JExtensions.ParseJsonObject(configuration);
OperationConfig\ConditionalCustomConfig.cs (1)
13internal static List<IOperationProvider> ConfigureFromJObject(JsonObject rawConfiguration)
OperationConfig\ConditionalKeywords.cs (1)
37internal static ConditionalKeywords FromJObject(JsonObject rawConfiguration)
OperationConfig\ConditionalLineCommentConfig.cs (1)
14internal static List<IOperationProvider> ConfigureFromJObject(JsonObject rawConfiguration)
OperationConfig\ConditionalOperationOptions.cs (1)
31internal static ConditionalOperationOptions FromJObject(JsonObject rawConfiguration)
OperationConfig\FlagsConfig.cs (1)
28JsonObject rawConfiguration = JExtensions.ParseJsonObject(configuration);
OperationConfig\IncludeConfig.cs (1)
22JsonObject rawConfiguration = JExtensions.ParseJsonObject(configuration);
OperationConfig\RegionConfig.cs (1)
21JsonObject rawConfiguration = JExtensions.ParseJsonObject(configuration);
OperationConfig\ReplacementConfig.cs (2)
23JsonObject rawConfiguration = JExtensions.ParseJsonObject(configuration); 36if (entry is not JsonObject)
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)
ValueFormRegistry.cs (1)
39internal static IValueForm GetForm(string name, JsonObject? obj)
ValueForms\ActionableValueFormFactory.cs (1)
15public override IValueForm FromJObject(string name, JsonObject? configuration = null)
ValueForms\BaseValueFormFactory.cs (1)
27public abstract IValueForm FromJObject(string name, JsonObject? configuration = null);
ValueForms\ChainValueFormFactory.cs (1)
30protected override IReadOnlyList<string> ReadConfiguration(JsonObject jObject)
ValueForms\ConfigurableValueFormFactory.cs (2)
15public override IValueForm FromJObject(string name, JsonObject? configuration) 37protected abstract T ReadConfiguration(JsonObject jObject);
ValueForms\DependentValueFormFactory.cs (2)
15public override IValueForm FromJObject(string name, JsonObject? configuration) 37protected abstract T ReadConfiguration(JsonObject jObject);
ValueForms\IValueForm.cs (1)
26/// See <see cref="TemplateConfigModel.SetupValueFormMapForTemplate(System.Text.Json.Nodes.JsonObject?)"/> for more details.
ValueForms\IValueFormFactory.cs (1)
23IValueForm FromJObject(string name, JsonObject? configuration = null);
ValueForms\ReplacementValueFormFactory.cs (1)
37protected override ReplacementValueFormSettings ReadConfiguration(JsonObject jObject)
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\BlobStorageTemplateInfo.cs (16)
148public static BlobStorageTemplateInfo FromJObject(JsonObject entry) 178JsonObject? baselineJObject = entry.Get<JsonObject>(nameof(ITemplateInfo.BaselineInfo)); 216if (item is JsonObject jObj) 224JsonObject? tagsObject = entry.Get<JsonObject>(nameof(TagsCollection)); 235tagsObject = entry.Get<JsonObject>("tags"); 253else if (item.Value is JsonObject tagObj) 255JsonObject? choicesObject = tagObj.Get<JsonObject>("ChoicesAndDescriptions"); 281JsonObject? cacheParametersObject = entry.Get<JsonObject>("cacheParameters"); 287if (item.Value is not JsonObject paramObj) 350internal BlobTemplateParameter(JsonObject jObject) 364JsonObject? cdToken = jObject.Get<JsonObject>(nameof(Choices));
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)
TemplateDiscoveryMetadata\TemplateDiscoveryMetadata.cs (1)
41internal JsonObject ToJObject()
TemplateSearchCache\TemplatePackageSearchData.Json.cs (2)
17internal TemplatePackageSearchData(JsonObject jObject, ILogger logger, IReadOnlyDictionary<string, Func<object, object>>? additionalDataReaders = null) 46if (template is JsonObject templateObj)
TemplateSearchCache\TemplateSearchCache.Json.cs (6)
18JsonObject cacheObject, 59if (templatePackage is not JsonObject templatePackageObj) 74JsonObject cacheObject, 82if (dataNode is not JsonObject dataObject) 106internal JsonObject ToJObject() 111private static bool TryReadVersion(ILogger logger, JsonObject cacheObject, out string? version)
TemplateSearchCache\TemplateSearchData.Json.cs (1)
17internal TemplateSearchData(JsonObject jObject, ILogger logger, IReadOnlyDictionary<string, Func<object, object>>? additionalDataReaders = null)
MSBuild (5)
JsonOutputFormatter.cs (4)
60JsonObject jsonItem = new(); 90JsonObject targetResultsNode = new(); 94JsonObject targetResults = new(); 99JsonObject jsonItem = new();
XMake.cs (1)
4838var jsonNode = new JsonObject();
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)))),
DockerComposeBuilderExtensions.cs (1)
124var json = options.ToJson();
DockerComposeEnvironment.cs (15)
29private readonly ConditionalWeakTable<JsonObject, Lazy<Task<DockerComposePlan>>> _plans = new(); 116var service = plan.Compose["services"]![entry.Service]!.AsObject(); 117var native = Objects(context.Model["resources"]).SingleOrDefault(resource => Text(resource, "name") == entry.Resource); 120var options = Options(native); 136var service = node!.AsObject(); 138if (service["healthcheck"] is JsonObject healthcheck) 142if (service["depends_on"] is JsonObject dependencies) 146var producer = plan.Compose["services"]![dependency]?.AsObject() ?? 155foreach (var mount in service["volumes"] is null ? [] : Objects(service["volumes"])) 180foreach (var service in plan.Compose["services"]!.AsObject().Select(pair => pair.Value!.AsObject())) 182if (service["build"] is JsonObject build && 246var state = QueryState(plan, await InvokeAsync([.. prefix, "ps", "--all", "--format", "json"], "Compose status").ConfigureAwait(false)); 300private static JsonObject QueryState(DockerComposePlan plan, string output) 302JsonObject[] rows; 326var row = matches[0];
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)
Plugins\Logging\AssemblyLogMessage.cs (1)
41var message = new JsonObject
Plugins\Logging\CommunicationLogMessage.cs (1)
27var message = new JsonObject
Plugins\Logging\EnvironmentVariablesLogMessage.cs (1)
34var message = new JsonObject();
Plugins\Logging\MachineLogMessage.cs (1)
21var message = new JsonObject
Plugins\Logging\PluginInstanceLogMessage.cs (1)
30var message = new JsonObject
Plugins\Logging\PluginLogMessage.cs (2)
19protected string ToString(string type, JsonObject message) 31var outerMessage = new JsonObject
Plugins\Logging\ProcessLogMessage.cs (1)
30var message = new JsonObject
Plugins\Logging\StopwatchLogMessage.cs (1)
21var message = new JsonObject
Plugins\Logging\TaskLogMessage.cs (1)
30var message = new JsonObject
Plugins\Logging\ThreadPoolLogMessage.cs (1)
26var message = new JsonObject
sdk-tasks (7)
GetRuntimePackRids.cs (1)
22var runtimeJsonRoot = JsonNode.Parse(runtimeJsonContents)!.AsObject();
PublishMutationUtilities.cs (3)
20var targets = deps["targets"].AsObject(); 42var targetObj = target.Value.AsObject(); 53var libraries = deps["libraries"].AsObject();
RemoveAssetFromDepsPackages.cs (1)
55var sectionObj = section.AsObject();
UpdateRuntimeConfig.cs (2)
46var config = JsonNode.Parse(text)!.AsObject(); 66var framework = item.AsObject();
SelectTests (2)
Program.cs (2)
589var selection = new JsonObject(); 627var root = new JsonObject
Shared.Tests (2)
JsonSchemaExporter\TestTypes.cs (2)
105yield return new TestData<JsonObject>(new() { ["x"] = 42 }, """{"type":["object","null"]}"""); 1249[JsonSerializable(typeof(JsonObject))]
System.Text.Json (81)
System\Text\Json\Nodes\JsonArray.cs (2)
102case JsonObject: 395if (Value is JsonObject jsonObject)
System\Text\Json\Nodes\JsonNode.cs (17)
76/// Casts to the derived <see cref="JsonObject"/> type. 79/// A <see cref="JsonObject"/>. 82/// The node is not a <see cref="JsonObject"/>. 84public JsonObject AsObject() 86JsonObject? jObject = this as JsonObject; 90ThrowHelper.ThrowInvalidOperationException_NodeWrongType(nameof(JsonObject)); 120/// A parent can either be a <see cref="JsonObject"/> or a <see cref="JsonArray"/>. 210/// The current <see cref="JsonNode"/> is not a <see cref="JsonArray"/> or <see cref="JsonObject"/>. 220ThrowHelper.ThrowInvalidOperationException_NodeWrongType(nameof(JsonArray), nameof(JsonObject)); 225ThrowHelper.ThrowInvalidOperationException_NodeWrongType(nameof(JsonArray), nameof(JsonObject)); 236/// The current <see cref="JsonNode"/> is not a <see cref="JsonObject"/>. 269/// The current parent is not a <see cref="JsonObject"/>. 273JsonObject? parentObject = _parent as JsonObject; 277ThrowHelper.ThrowInvalidOperationException_NodeParentWrongType(nameof(JsonObject)); 335case JsonObject jsonObject:
System\Text\Json\Nodes\JsonNodeOptions.cs (1)
12/// Specifies whether property names on <see cref="JsonObject"/> are case insensitive.
System\Text\Json\Nodes\JsonObject.cs (13)
14/// It's safe to perform multiple concurrent read operations on a <see cref="JsonObject"/>, 26/// Initializes a new instance of the <see cref="JsonObject"/> class that is empty. 32/// Initializes a new instance of the <see cref="JsonObject"/> class that contains the specified <paramref name="properties"/>. 51/// Initializes a new instance of the <see cref="JsonObject"/> class that contains properties from the specified <see cref="JsonElement"/>. 54/// The new instance of the <see cref="JsonObject"/> class that contains properties from the specified <see cref="JsonElement"/>. 58/// <returns>A <see cref="JsonObject"/>.</returns> 59public static JsonObject? Create(JsonElement element, JsonNodeOptions? options = null) 94var jObject = new JsonObject(Options) 139/// <see langword="true"/> if the <see cref="JsonObject"/> contains an element with the specified property name; otherwise, <see langword="false"/>. 214case JsonObject jsonObject: 319private readonly JsonObject _node; 321public DebugView(JsonObject node) 372if (Value is JsonObject jsonObject)
System\Text\Json\Nodes\JsonObject.IDictionary.cs (28)
16/// Adds an element with the provided property name and value to the <see cref="JsonObject"/>. 24/// An element with the same property name already exists in the <see cref="JsonObject"/>. 35/// Adds an element with the provided name and value to the <see cref="JsonObject"/>, if a property named <paramref name="propertyName"/> doesn't already exist. 46/// Adds an element with the provided name and value to the <see cref="JsonObject"/>, if a property named <paramref name="propertyName"/> doesn't already exist. 50/// <param name="index">The index of the added or existing <paramref name="propertyName"/>. This is always a valid index into the <see cref="JsonObject"/>.</param> 68/// Adds the specified property to the <see cref="JsonObject"/>. 71/// The KeyValuePair structure representing the property name and value to add to the <see cref="JsonObject"/>. 74/// An element with the same property name already exists in the <see cref="JsonObject"/>. 82/// Removes all elements from the <see cref="JsonObject"/>. 103/// Determines whether the <see cref="JsonObject"/> contains an element with the specified property name. 105/// <param name="propertyName">The property name to locate in the <see cref="JsonObject"/>.</param> 107/// <see langword="true"/> if the <see cref="JsonObject"/> contains an element with the specified property name; otherwise, <see langword="false"/>. 120/// Gets the number of elements contained in <see cref="JsonObject"/>. 125/// Removes the element with the specified property name from the <see cref="JsonObject"/>. 148/// Determines whether the <see cref="JsonObject"/> contains a specific property name and <see cref="JsonNode"/> reference. 150/// <param name="item">The element to locate in the <see cref="JsonObject"/>.</param> 152/// <see langword="true"/> if the <see cref="JsonObject"/> contains an element with the property name; otherwise, <see langword="false"/>. 158/// Copies the elements of the <see cref="JsonObject"/> to an array of type KeyValuePair starting at the specified array index. 161/// The one-dimensional Array that is the destination of the elements copied from <see cref="JsonObject"/>. 178/// Returns an enumerator that iterates through the <see cref="JsonObject"/>. 181/// An enumerator that iterates through the <see cref="JsonObject"/>. 186/// Removes a key and value from the <see cref="JsonObject"/>. 189/// The KeyValuePair structure representing the property name and value to remove from the <see cref="JsonObject"/>. 197/// Gets a collection containing the property names in the <see cref="JsonObject"/>. 202/// Gets a collection containing the property values in the <see cref="JsonObject"/>. 215/// <see langword="true"/> if the <see cref="JsonObject"/> contains an element with the specified property name; otherwise, <see langword="false"/>. 233/// Returns an enumerator that iterates through the <see cref="JsonObject"/>. 236/// An enumerator that iterates through the <see cref="JsonObject"/>.
System\Text\Json\Nodes\JsonObject.IList.cs (1)
65/// <exception cref="ArgumentException">An element with the same key already exists in the <see cref="JsonObject"/>.</exception>
System\Text\Json\Schema\JsonSchema.cs (2)
149var objSchema = new JsonObject(); 183var properties = new JsonObject();
System\Text\Json\Serialization\Attributes\JsonExtensionDataAttribute.cs (1)
7/// When placed on a property or field of type <see cref="System.Text.Json.Nodes.JsonObject"/>,
System\Text\Json\Serialization\Converters\Node\JsonNodeConverterFactory.cs (1)
23if (typeof(JsonObject) == typeToConvert)
System\Text\Json\Serialization\Converters\Node\JsonObjectConverter.cs (10)
11internal sealed class JsonObjectConverter : JsonConverter<JsonObject?> 28Debug.Assert(obj is JsonObject); 29JsonObject jObject = (JsonObject)obj; 44internal override void WriteExtensionDataValue(Utf8JsonWriter writer, JsonObject? value, JsonSerializerOptions options) 50public override void Write(Utf8JsonWriter writer, JsonObject? value, JsonSerializerOptions options) 61public override JsonObject? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) 76internal static JsonObject ReadAsJsonElement(ref Utf8JsonReader reader, JsonNodeOptions options) 82internal static JsonObject ReadAsJsonNode(ref Utf8JsonReader reader, JsonNodeOptions options) 86JsonObject jObject = new JsonObject(options);
System\Text\Json\Serialization\JsonConverterOfT.cs (1)
462Debug.Assert(Type == typeof(Nodes.JsonObject));
System\Text\Json\Serialization\JsonSerializer.Read.HandleMetadata.cs (1)
460if (jsonNode is JsonObject jsonObject)
System\Text\Json\Serialization\Metadata\JsonMetadataServices.Converters.cs (2)
135/// Returns a <see cref="JsonConverter{T}"/> instance that converts <see cref="JsonObject"/> values. 138public static JsonConverter<JsonObject?> JsonObjectConverter => field ??= new JsonObjectConverter();
System\Text\Json\Serialization\Metadata\JsonPropertyInfo.cs (1)
874Debug.Assert(propValue is Nodes.JsonObject);
TestProject.AppHost (3)
TestProgram.cs (3)
177var root = new JsonObject(); 180var projectJson = new JsonObject(); 194var endpointJsonObject = new JsonObject