721 writes to
aspire (76)
Agents\ClaudeCode\ClaudeCodeAgentEnvironmentScanner.cs (2)
209config["mcpServers"] = new JsonObject(); 215servers[AspireServerName] = new JsonObject
Agents\CopilotCli\CopilotCliAgentEnvironmentScanner.cs (2)
209config["mcpServers"] = new JsonObject(); 215servers[AspireServerName] = new JsonObject
Agents\DeprecatedMcpCommandScanner.cs (2)
227aspire["args"] = new JsonArray("agent", "mcp"); 241aspire["command"] = new JsonArray("aspire", "agent", "mcp");
Agents\Hooks\TelemetryHookConfigurator.cs (2)
220settings["hooks"] = hooks; 236hooks[ClaudePostToolUseKey] = postToolUse;
Agents\OpenCode\OpenCodeAgentEnvironmentScanner.cs (3)
194config["$schema"] = "https://opencode.ai/config.json"; 200config["mcp"] = new JsonObject(); 206mcp[AspireServerName] = new JsonObject
Agents\VsCode\VsCodeAgentEnvironmentScanner.cs (2)
254config["servers"] = new JsonObject(); 260servers[AspireServerName] = new JsonObject
Commands\InitCommand.cs (5)
562settings["appHost"] = appHost; 566appHost["path"] = appHostPath; 571appHost["language"] = language; 581settings["channel"] = channel; 616settings["profiles"] = new JsonObject
Commands\ResourceCommand.cs (5)
336arguments[argument.Name] = parseResult.GetValue(boolOption).ToString().ToLowerInvariant(); 341arguments[argument.Name] = value?.ToString(CultureInfo.InvariantCulture); 345arguments[argument.Name] = parseResult.GetValue(stringOption); 354arguments[unmatchedToken] = null; 375arguments[token] = null;
Commands\SecretListCommand.cs (1)
58obj[key] = value;
Configuration\ConfigurationService.cs (2)
238currentObject[part] = new JsonObject(); 246currentObject[finalKey] = value;
Mcp\Tools\ExecuteResourceCommandTool.cs (1)
178arguments[property.Name] = property.Value.ValueKind switch
Migrations\TypeScriptAppHostMigration.cs (3)
217appHost["path"] = string.Concat( 268root["include"] = rewritten; 303scripts[script.Key] = (JsonNode?)JsonValue.Create(rewritten);
Projects\FallbackProjectParser.cs (10)
131packageObj["Identity"] = JsonValue.Create(pkg.Identity); 132packageObj["Version"] = JsonValue.Create(pkg.Version); 135itemsObject["PackageReference"] = packageRefArray; 142projectObj["Identity"] = JsonValue.Create(proj.Identity); 143projectObj["FullPath"] = JsonValue.Create(proj.FullPath); 146itemsObject["ProjectReference"] = projectRefArray; 148rootObject["Items"] = itemsObject; 152propertiesObject["AspireHostingSDKVersion"] = JsonValue.Create(aspireHostingSdkVersion); 153rootObject["Properties"] = propertiesObject; 156rootObject["Fallback"] = JsonValue.Create(true);
Scaffolding\PackageJsonMerger.cs (12)
128existing[key] = sourceValue.DeepClone(); 162existingScripts[name] ??= command; 167existingScripts[$"{AspirePrefix}{name}"] = command; 172existingScripts[name] = command; 206scripts[unprefixed] = $"{normalizedToolchainCommand} run {prefixed}"; 245existingDeps[packageName] = desiredVersion; 253existingDeps[packageName] = desiredVersion; 276existingDeps[packageName] = desiredVersion; 308existingEngines[key] = value.DeepClone(); 312existingEngines[key] = value.DeepClone(); 335target[key] = sourceValue.DeepClone(); 360parent[propertyName] = obj;
Scaffolding\ScaffoldingService.cs (3)
380parent[propertyName] = obj; 413scripts[scriptName] = delegateScript; 661existing[key] = scaffoldValue?.DeepClone();
src\Shared\ConsoleLogs\SharedAIHelpers.cs (5)
226attributesObj[attr.Key!] = context.AddValue(attrValue, id => $@"Duplicate of attribute ""{id.Key}"" for span {OtlpHelpers.ToShortenedId(id.SpanId)}", (SpanId: spanId, attr.Key)); 274spanObj["dashboardUrl"] = DashboardUrls.CombineUrl(dashboardBaseUrl, DashboardUrls.TraceDetailUrl(traceId, spanId: spanId)); 412traceData["dashboardUrl"] = DashboardUrls.CombineUrl(dashboardBaseUrl, DashboardUrls.TraceDetailUrl(traceId)); 726attributesObject[attr.Key!] = context.AddValue(attrValue, id => $@"Duplicate of attribute ""{id.Key}"" for log entry {id.LogId}", (LogId: logId, attr.Key)); 745log["dashboardUrl"] = DashboardUrls.CombineUrl(dashboardBaseUrl, DashboardUrls.StructuredLogsUrl(logEntryId: logId));
src\Shared\Json\JsonFlattener.cs (4)
41current[key] = newObject; 50current[keys[^1]] = kvp.Value?.DeepClone(); 81result[arrayKey] = array[i]?.DeepClone(); 87result[key] = kvp.Value?.DeepClone();
src\Shared\UserSecrets\SecretsStore.cs (1)
82obj[key] = value;
Utils\ConfigurationHelper.cs (2)
341currentObject[part] = new JsonObject(); 372currentObject[finalKey] = value;
Utils\EnvironmentChecker\AspireVersionCheck.cs (8)
429metadata["currentVersion"] = currentVersion; 434metadata["latestVersion"] = latestVersion; 439metadata["updateCommand"] = updateCommand; 444metadata["updateCheckError"] = updateCheckError; 449metadata["identityChannel"] = identityChannel; 454metadata["latestVersionChannel"] = latestVersionChannel; 469metadata["version"] = version; 474metadata["pinnedChannel"] = pinnedChannel;
Utils\EnvironmentChecker\OperatingSystemCheck.cs (1)
153metadata["description"] = details.Description;
Aspire.Cli.EndToEnd.Tests (9)
Helpers\CliE2ETestHelpers.cs (2)
1118config["channel"] = "local"; 1119config["sdk"] = new JsonObject
Helpers\TypeScriptAppHostToolchainTestHelpers.cs (1)
40packageJson["packageManager"] = GetPackageManager(toolchain);
ProjectReferenceTests.cs (2)
119packages["MyIntegration"] = "./MyIntegration/MyIntegration.csproj"; 120config["packages"] = packages;
TypeScriptEmptyAppHostTemplateTests.cs (1)
180config["packages"] = new JsonObject
TypeScriptLegacyAppHostTests.cs (1)
138appHost["path"] = "apphost.ts";
TypeScriptMigrateAppHostTests.cs (1)
125appHost["path"] = "apphost.ts";
TypeScriptPolyglotTests.cs (1)
360scripts["aspire:start"] = "custom-apphost-start";
Aspire.Cli.Tests (2)
Projects\ProjectUpdaterTests.cs (2)
2733itemsAndProperties["Items"] = items; 2821itemsAndProperties["Items"] = items;
Aspire.Dashboard (3)
Model\GenAI\GenAIItemPartViewModel.cs (1)
144jsonObject[kvp.Key] = JsonNode.Parse(kvp.Value.GetRawText());
Model\TelemetryExportService.cs (1)
808jsonObject[field.Key] = ConvertPropertyValueToJsonNode(field.Value);
Otlp\Model\OtlpHelpers.cs (1)
200o[item.Key] = ConvertAnyValue(item.Value);
Aspire.Hosting (21)
Backchannel\AuxiliaryBackchannelRpcTarget.cs (1)
1416jsonObject[property.Key] = property.Value;
Dashboard\DashboardEventHandlers.cs (2)
259frameworkObj["version"] = netCoreVersion; 262frameworkObj["version"] = aspNetCoreVersion;
Dcp\JsonPatch.cs (3)
115result["value"] = value?.DeepClone(); 242target[propertyName] = value?.DeepClone(); 255target[propertyName] = value?.DeepClone();
Devcontainers\DevcontainerSettingsWriter.cs (3)
177portAttributes["label"] = label; 178portAttributes["protocol"] = protocol; 179portAttributes["onAutoForward"] = openBrowser ? "openBrowser" : "silent";
Pipelines\DeploymentStateSection.cs (1)
58Data[RootValueKey] = JsonValue.Create(value);
Pipelines\Internal\DeploymentStateManagerBase.cs (2)
342current[segment] = nextObj; 353current[segments[^1]] = value;
Pipelines\Internal\FileDeploymentStateManager.cs (4)
448target[name] = sourceValue?.DeepClone(); 576result[propertyName] = updatedProperty.Value; 675current[segment] = nextObject; 687current[segments[^1]] = value;
Pipelines\Internal\JsonFlattener.cs (4)
47current[key] = newObject; 56current[keys[^1]] = kvp.Value?.DeepClone(); 87result[arrayKey] = array[i]?.DeepClone(); 93result[key] = kvp.Value?.DeepClone();
UserSecrets\UserSecretsManagerFactory.cs (1)
211contents[secret.Key] = secret.Value;
Aspire.Hosting.Azure (89)
AzureDeploymentOperationDetails.cs (12)
85json["operationId"] = OperationId; 90json["provisioningOperation"] = ProvisioningOperation; 95json["provisioningState"] = ProvisioningState; 100json["timestamp"] = timestamp; 105json["duration"] = duration.ToString(); 110json["statusCode"] = StatusCode; 115json["serviceRequestId"] = ServiceRequestId; 120json["targetResource"] = targetResource.ToJsonObject(); 125json["error"] = failureDetails.ToJsonObject(); 140json["id"] = Id; 145json["resourceType"] = ResourceType; 150json["resourceName"] = ResourceName;
AzureProvisioningController.cs (46)
2431json["resourceCount"] = GetProvisionableAzureResources(model).Count; 2434json["warning"] = "Local Azure provisioning state was reset without deleting live Azure resources. Existing Azure resources may be orphaned if a later reprovision uses a different Azure context."; 2435json["recommendedActions"] = AzureProvisioningFailureDetails.CreateRecommendedActionsJsonArray( 2457json["deletedResourceCount"] = result.ResourceIds.Count; 2458json["deletedResourceIds"] = deletedResourceIds; 2470json["resourceCount"] = targetResources.Count; 2471json["location"] = effectiveLocation; 2472json["effectiveLocation"] = effectiveLocation; 2486json["resourceCount"] = targetResources.Count; 2487json["location"] = effectiveLocation; 2488json["effectiveLocation"] = effectiveLocation; 2497json["deployment"] = deployment; 2498json["live"] = await CreateLiveResourceInfoAsync( 2535json["provisioningState"] = provisioningState; 2544json["deploymentPortalUrl"] = AzurePortalUrls.GetDeploymentUrl(deploymentResourceId); 2562json["reason"] = "missing-resource-id"; 2563json["source"] = "aspire"; 2564json["code"] = "missing-resource-id"; 2565json["message"] = "Live Azure resource existence cannot be checked because cached deployment state does not contain a resource ID. This can happen after state is forgotten, deleted, or before provisioning completes."; 2566json["recommendedActions"] = AzureProvisioningFailureDetails.CreateRecommendedActionsJsonArray( 2573json["reason"] = "invalid-subscription-id"; 2582json["checked"] = true; 2584json["exists"] = exists; 2588json["reason"] = AzureProvisioningFailureDetails.MissingLiveResourceReason; 2589json["source"] = "azure"; 2590json["code"] = AzureProvisioningFailureDetails.MissingLiveResourceReason; 2591json["message"] = "Cached deployment state points at an Azure resource ID, but the resource was not found in Azure. This can happen when resources are deleted outside Aspire or a resource group deletion is still in progress."; 2592json["recommendedActions"] = AzureProvisioningFailureDetails.CreateRecommendedActionsJsonArray( 2601json["reason"] = "credential-unavailable"; 2602json["message"] = ex.Message; 2610json["reason"] = "request-failed"; 2611json["source"] = "azure"; 2612json["status"] = ex.Status; 2613json["provider"] = failure.Provider; 2614json["httpStatus"] = failure.HttpStatus; 2615json["errorCode"] = failure.ErrorCode; 2616json["message"] = failure.ErrorMessage; 2617json["operation"] = failure.Operation; 2618json["requestId"] = failure.RequestId; 2619json["correlationId"] = failure.CorrelationId; 2622json["recommendedActions"] = AzureProvisioningFailureDetails.CreateRecommendedActionsJsonArray(failure.RecommendedActions); 2695json["resourceName"] = resourceName; 2753section.Data[LocationOverrideKey] = normalizedLocation; 2777section.Data[LocationOverrideKey] = location; 2850section.Data[BicepProvisioner.DeploymentStateProvisioningStateKey] = BicepProvisioner.DeploymentStateProvisioningStateCanceled; 3594section.Data[LocationOverrideKey] = locationOverride;
AzureProvisioningFailureDetails.cs (11)
464json["errorCode"] = ErrorCode; 469json["resourceType"] = ResourceType; 474json["resourceName"] = ResourceName; 479json["targetResourceId"] = TargetResourceId; 484json["currentLocation"] = CurrentLocation; 495json["supportedLocations"] = supportedLocations; 500json["httpStatus"] = httpStatus; 505json["operation"] = Operation; 510json["requestId"] = RequestId; 515json["correlationId"] = CorrelationId; 520json["recommendedActions"] = CreateRecommendedActionsJsonArray(RecommendedActions);
Provisioning\BicepUtilities.cs (4)
55parameters[parameter.Key] = new JsonObject() 85scope["resourceGroup"] = null; 96scope["tenant"] = "current"; 226scope[propertyName] = value switch
Provisioning\Internal\BaseProvisioningContextProvider.cs (7)
128azureStateSection.Data["ResourceGroup"] = resourceGroupName; 219azureSection["Location"] = _options.Location; 220azureSection["SubscriptionId"] = _options.SubscriptionId; 221azureSection["ResourceGroup"] = resourceGroupName; 225azureSection["TenantId"] = tenantId; 234azureSection["Tenant"] = tenantDomain; 243azureSection["AllowResourceGroupCreation"] = _options.AllowResourceGroupCreation.Value;
Provisioning\Provisioners\BicepProvisioner.cs (9)
441stateSection.Data[DeploymentStateProvisioningStateKey] = provisioningState; 460stateSection.Data[AzureProvisioningController.LocationOverrideKey] = locationOverride; 1333stateSection.Data[AzureProvisioningController.LocationOverrideKey] = locationOverride; 1336stateSection.Data[BicepUtilities.DeploymentStateIdKey] = deploymentId.ToString(); 1337stateSection.Data[BicepUtilities.DeploymentStateParametersKey] = parameters.ToJsonString(); 1341stateSection.Data[BicepUtilities.DeploymentStateOutputsKey] = outputObj.ToJsonString(); 1346stateSection.Data[BicepUtilities.DeploymentStateScopeKey] = scope.ToJsonString(); 1349stateSection.Data[BicepUtilities.DeploymentStateChecksumKey] = checksum; 1353stateSection.Data[DeploymentStateProvisioningStateKey] = provisioningState;
Aspire.Hosting.Azure.Kubernetes.Tests (1)
AzureKubernetesInfrastructureTests.cs (1)
850azureState["ResourceGroup"] = resourceGroup;
Aspire.Hosting.Azure.Sandboxes (25)
AzureSandboxContainerDeployment.cs (25)
259stateSection.Data["OwnerId"] = ownerId; 381stateSection.Data["OwnerId"] = ownerId; 384stateSection.Data["SandboxId"] = sandboxId; 385stateSection.Data["DiskImageId"] = diskImageId; 386stateSection.Data["SubscriptionId"] = dataPlaneScope.SubscriptionId; 387stateSection.Data["ResourceGroup"] = dataPlaneScope.ResourceGroupName; 388stateSection.Data["Location"] = dataPlaneScope.Region; 389stateSection.Data["SandboxGroup"] = dataPlaneScope.SandboxGroupName; 390stateSection.Data["ResourceName"] = resource.Name; 391stateSection.Data["SourceResourceName"] = targetResource.Name; 392stateSection.Data["DeployId"] = deployId; 393stateSection.Data["Ports"] = portStates; 394stateSection.Data["EndpointSecurityFingerprint"] = endpointSecurityFingerprint; 395stateSection.Data["HasRuntimeEnvironmentConfiguration"] = resolvedEnvironmentVariables.Values.Count > 0; 396stateSection.Data["HasRuntimeCommandConfiguration"] = hasModeledCommandConfiguration; 397stateSection.Data["PendingSecurityCleanup"] = securityConfigurationChanged; 461stateSection.Data["PendingSecurityCleanup"] = false; 1877stateSection.Data["PendingOwnerCleanupIds"] = new JsonArray( 1915stateSection.Data["PendingLegacyDeploymentCleanup"] = pendingDeploymentCleanup.DeepClone(); 2019stateSection.Data["SubscriptionId"] ??= scope.SubscriptionId; 2020stateSection.Data["ResourceGroup"] ??= scope.ResourceGroupName; 2021stateSection.Data["Location"] ??= scope.Region; 2022stateSection.Data["SandboxGroup"] ??= scope.SandboxGroupName; 2023stateSection.Data["ResourceName"] ??= resource.Name; 2024stateSection.Data["SourceResourceName"] ??= resource.TargetResource.Name;
Aspire.Hosting.Azure.Tests (180)
AzureBicepProvisionerTests.cs (31)
837section.Data[AzureProvisioningController.LocationOverrideKey] = "westus3"; 871section.Data["Id"] = "/subscriptions/12345678-1234-1234-1234-123456789012/resourceGroups/test-rg/providers/Microsoft.Resources/deployments/storage2"; 872section.Data["Parameters"] = parameters.ToJsonString(); 873section.Data["Outputs"] = """{"name":{"value":"storage2"}}"""; 874section.Data["CheckSum"] = checksum; 875section.Data[BicepProvisioner.DeploymentStateProvisioningStateKey] = BicepProvisioner.DeploymentStateProvisioningStateRunning; 907azureSection.Data["SubscriptionId"] = "12345678-1234-1234-1234-123456789012"; 908azureSection.Data["ResourceGroup"] = "test-rg"; 909azureSection.Data["TenantId"] = "87654321-4321-4321-4321-210987654321"; 910azureSection.Data["Tenant"] = "microsoft.onmicrosoft.com"; 911azureSection.Data["Location"] = "westus2"; 915section.Data["Id"] = "/subscriptions/12345678-1234-1234-1234-123456789012/resourceGroups/test-rg/providers/Microsoft.Resources/deployments/storage2"; 916section.Data["Parameters"] = parameters.ToJsonString(); 917section.Data["Outputs"] = """{"name":{"value":"storage2"}}"""; 918section.Data["CheckSum"] = checksum; 958azureSection.Data["SubscriptionId"] = "12345678-1234-1234-1234-123456789012"; 959azureSection.Data["ResourceGroup"] = "environment-rg"; 960azureSection.Data["TenantId"] = "87654321-4321-4321-4321-210987654321"; 961azureSection.Data["Tenant"] = "microsoft.onmicrosoft.com"; 962azureSection.Data["Location"] = "westus2"; 966section.Data["Id"] = "/subscriptions/12345678-1234-1234-1234-123456789012/resourceGroups/scoped-rg/providers/Microsoft.Resources/deployments/storage2"; 967section.Data["Parameters"] = parameters.ToJsonString(); 968section.Data["Outputs"] = """{"name":{"value":"storage2"}}"""; 969section.Data["CheckSum"] = checksum; 1000section.Data[AzureProvisioningController.LocationOverrideKey] = "westus3"; 1034section.Data[AzureProvisioningController.LocationOverrideKey] = "westus3"; 1849section.Data[BicepUtilities.DeploymentStateIdKey] = deploymentId; 1850section.Data[BicepUtilities.DeploymentStateParametersKey] = parameters.ToJsonString(); 1851section.Data[BicepUtilities.DeploymentStateScopeKey] = scope.ToJsonString(); 1852section.Data[BicepUtilities.DeploymentStateChecksumKey] = BicepUtilities.GetChecksum(resource, parameters, scope); 1853section.Data[BicepProvisioner.DeploymentStateProvisioningStateKey] = BicepProvisioner.DeploymentStateProvisioningStateRunning;
AzureEnvironmentResourceExtensionsTests.cs (127)
319azureSection.Data["SubscriptionId"] = "sub"; 320azureSection.Data["Location"] = "westus2"; 324storageSection.Data["Id"] = "/subscriptions/sub/resourceGroups/rg/providers/Microsoft.Resources/deployments/storage"; 325storageSection.Data["CheckSum"] = "checksum"; 590storageSection.Data["Outputs"] = """ 626storageSection.Data["Outputs"] = """{"id":{"value":"/subscriptions/12345678-1234-1234-1234-123456789012/resourceGroups/rg/providers/Microsoft.Storage/storageAccounts/storage"}}"""; 790azureSection.Data["SubscriptionId"] = subscriptionId; 791azureSection.Data["Location"] = "westus2"; 792azureSection.Data["ResourceGroup"] = resourceGroup; 793azureSection.Data["TenantId"] = tenantId; 797storageSection.Data["Id"] = deploymentId; 798storageSection.Data["Parameters"] = """ 805storageSection.Data["Outputs"] = $$""" 817storageSection.Data["Scope"] = $$""" 822storageSection.Data["CheckSum"] = "checksum"; 823storageSection.Data[BicepProvisioner.DeploymentStateProvisioningStateKey] = BicepProvisioner.DeploymentStateProvisioningStateRunning; 824storageSection.Data[AzureProvisioningController.LocationOverrideKey] = "westus3"; 902storageSection.Data["Outputs"] = $$""" 1177storageSection.Data["Outputs"] = """{"blobEndpoint":{"value":"https://storage.blob.core.windows.net/"}}"""; 1235storageSection.Data["Outputs"] = $$""" 1296storageSection.Data["Outputs"] = $$""" 1358storageSection.Data["Id"] = deploymentId; 1359storageSection.Data[BicepProvisioner.DeploymentStateProvisioningStateKey] = BicepProvisioner.DeploymentStateProvisioningStateRunning; 1486storageSection.Data[BicepUtilities.DeploymentStateIdKey] = deploymentId; 1487storageSection.Data[BicepProvisioner.DeploymentStateProvisioningStateKey] = BicepProvisioner.DeploymentStateProvisioningStateRunning; 1662storageSection.Data["Id"] = "/subscriptions/12345678-1234-1234-1234-123456789012/resourceGroups/test-rg/providers/Microsoft.Resources/deployments/storage"; 1663storageSection.Data[BicepProvisioner.DeploymentStateProvisioningStateKey] = BicepProvisioner.DeploymentStateProvisioningStateSucceeded; 1700storageSection.Data["Id"] = deploymentId; 1701storageSection.Data[BicepProvisioner.DeploymentStateProvisioningStateKey] = BicepProvisioner.DeploymentStateProvisioningStateSucceeded; 1767storageSection.Data["Id"] = deploymentId; 1768storageSection.Data["Outputs"] = new JsonObject 1776storageSection.Data[AzureProvisioningController.LocationOverrideKey] = "westus3"; 1777storageSection.Data[BicepProvisioner.DeploymentStateProvisioningStateKey] = BicepProvisioner.DeploymentStateProvisioningStateRunning; 1781storage2Section.Data["Id"] = "storage2-deployment"; 1870keyVaultSection.Data["Id"] = deploymentId; 1871keyVaultSection.Data["Outputs"] = new JsonObject 1879keyVaultSection.Data[BicepProvisioner.DeploymentStateProvisioningStateKey] = BicepProvisioner.DeploymentStateProvisioningStateRunning; 1942storageSection.Data["Outputs"] = $$""" 2021storageSection.Data["Outputs"] = $$""" 2088storageSection.Data["Id"] = "storage-deployment"; 2092storage2Section.Data["Id"] = "storage2-deployment"; 2166storageSection.Data["Id"] = "storage-deployment"; 2170storage2Section.Data["Id"] = "storage2-deployment"; 2938azureSection.Data["SubscriptionId"] = "12345678-1234-1234-1234-123456789012"; 2939azureSection.Data["Location"] = "eastus"; 2940azureSection.Data["ResourceGroup"] = "test-rg"; 2944storageSection.Data[AzureProvisioningController.LocationOverrideKey] = "westus3"; 3010storageSection.Data["Outputs"] = new JsonObject 3077storageSection.Data["Outputs"] = """{"id":{"value":"/subscriptions/12345678-1234-1234-1234-123456789012/resourceGroups/test-rg/providers/Microsoft.Storage/storageAccounts/storage26wmkwq4f4li52"}}"""; 3136storageSection.Data["Parameters"] = """ 3144storageSection.Data["Outputs"] = $$""" 3202storageSection.Data["LocationOverride"] = "westus2"; 3203storageSection.Data["Outputs"] = """{"id":{"value":"/subscriptions/12345678-1234-1234-1234-123456789012/resourceGroups/test-rg/providers/Microsoft.Storage/storageAccounts/storage26wmkwq4f4li52"}}"""; 3266storageSection.Data["Outputs"] = """{"id":{"value":"/subscriptions/12345678-1234-1234-1234-123456789012/resourceGroups/test-rg/providers/Microsoft.Storage/storageAccounts/storage26wmkwq4f4li52"}}"""; 3331storageSection.Data["Outputs"] = new JsonObject 3384azureSection.Data["SubscriptionId"] = "12345678-1234-1234-1234-123456789012"; 3385azureSection.Data["Location"] = "westus2"; 3386azureSection.Data["ResourceGroup"] = "test-rg"; 3387azureSection.Data["TenantId"] = "87654321-4321-4321-4321-210987654321"; 3391storageSection.Data["Id"] = "storage-deployment"; 3395storage2Section.Data["Id"] = "storage2-deployment"; 3509azureSection.Data["SubscriptionId"] = "12345678-1234-1234-1234-123456789012"; 3510azureSection.Data["Location"] = "westus2"; 3511azureSection.Data["ResourceGroup"] = "test-rg"; 3512azureSection.Data["TenantId"] = "87654321-4321-4321-4321-210987654321"; 3558azureSection.Data["SubscriptionId"] = "12345678-1234-1234-1234-123456789012"; 3559azureSection.Data["Location"] = "westus2"; 3560azureSection.Data["ResourceGroup"] = "test-rg"; 3604azureSection.Data["SubscriptionId"] = "12345678-1234-1234-1234-123456789012"; 3605azureSection.Data["Location"] = "westus2"; 3606azureSection.Data["ResourceGroup"] = "test-rg"; 3610storageSection.Data["Parameters"] = """{"location":{"value":"westus2"}}"""; 3664azureSection.Data["SubscriptionId"] = "12345678-1234-1234-1234-123456789012"; 3665azureSection.Data["Location"] = "westus2"; 3666azureSection.Data["ResourceGroup"] = "test-rg"; 3670storage2Section.Data[AzureProvisioningController.LocationOverrideKey] = "West US 3"; 3705azureSection.Data["SubscriptionId"] = "12345678-1234-1234-1234-123456789012"; 3706azureSection.Data["Location"] = "westus2"; 3707azureSection.Data["ResourceGroup"] = "test-rg"; 3711storage2Section.Data["Parameters"] = """ 3750azureSection.Data["SubscriptionId"] = "12345678-1234-1234-1234-123456789012"; 3751azureSection.Data["Location"] = "westus2"; 3752azureSection.Data["ResourceGroup"] = "test-rg"; 3810storageSection.Data["Id"] = "storage-deployment"; 3811storageSection.Data[AzureProvisioningController.LocationOverrideKey] = "westus3"; 3912keyVaultSection.Data[AzureProvisioningController.LocationOverrideKey] = "ukwest"; 3992keyVaultSection.Data[AzureProvisioningController.LocationOverrideKey] = "ukwest"; 4316azureSection.Data["SubscriptionId"] = "12345678-1234-1234-1234-123456789012"; 4317azureSection.Data["Location"] = "westus2"; 4318azureSection.Data["ResourceGroup"] = "test-rg"; 4319azureSection.Data["TenantId"] = "87654321-4321-4321-4321-210987654321"; 4320azureSection.Data["Tenant"] = "testdomain.onmicrosoft.com"; 4324storageSection.Data["Outputs"] = """{"id":{"value":"/subscriptions/12345678-1234-1234-1234-123456789012/resourceGroups/test-rg/providers/Microsoft.Storage/storageAccounts/storage"}}"""; 4365azureSection.Data["SubscriptionId"] = "12345678-1234-1234-1234-123456789012"; 4366azureSection.Data["Location"] = "westus2"; 4367azureSection.Data["ResourceGroup"] = "test-rg"; 4371storageSection.Data["Outputs"] = $$""" 4413azureSection.Data["SubscriptionId"] = "12345678-1234-1234-1234-123456789012"; 4414azureSection.Data["Location"] = "westus2"; 4415azureSection.Data["ResourceGroup"] = "test-rg"; 4419storageSection.Data["Outputs"] = $$""" 4429storage2Section.Data["Outputs"] = $$""" 4473azureSection.Data["SubscriptionId"] = "12345678-1234-1234-1234-123456789012"; 4474azureSection.Data["Location"] = "westus2"; 4475azureSection.Data["ResourceGroup"] = "test-rg"; 4479storageSection.Data["Outputs"] = """{"blobEndpoint":{"value":"https://storage.blob.core.windows.net/"}}"""; 4512azureSection.Data["SubscriptionId"] = "12345678-1234-1234-1234-123456789012"; 4513azureSection.Data["Location"] = "westus2"; 4514azureSection.Data["ResourceGroup"] = "test-rg"; 4515azureSection.Data["TenantId"] = "87654321-4321-4321-4321-210987654321"; 4519storageSection.Data["Id"] = "storage-deployment"; 4571storageSection.Data["Id"] = "storage-deployment"; 4612azureSection.Data["SubscriptionId"] = "12345678-1234-1234-1234-123456789012"; 4613azureSection.Data["Location"] = "westus2"; 4614azureSection.Data["ResourceGroup"] = "missing-rg"; 4618storageSection.Data["Id"] = "storage-deployment"; 4660azureSection.Data["SubscriptionId"] = "12345678-1234-1234-1234-123456789012"; 4661azureSection.Data["Location"] = "westus2"; 4662azureSection.Data["ResourceGroup"] = "test-rg"; 4666storageSection.Data["Id"] = "storage-deployment"; 4797storageSection.Data[BicepUtilities.DeploymentStateIdKey] = deploymentId; 4798storageSection.Data[BicepProvisioner.DeploymentStateProvisioningStateKey] = BicepProvisioner.DeploymentStateProvisioningStateRunning; 5566azureSection.Data["SubscriptionId"] = options.SubscriptionId; 5567azureSection.Data["Location"] = options.Location; 5568azureSection.Data["ResourceGroup"] = options.ResourceGroup; 5572azureSection.Data["TenantId"] = options.TenantId; 5699section.Data[BicepProvisioner.DeploymentStateProvisioningStateKey] = BicepProvisioner.DeploymentStateProvisioningStateCanceled;
AzureEventHubsExtensionsTests.cs (1)
404document["Custom"] = JsonValue.Create(42);
AzureSandboxesTests.cs (14)
888previousState.Data["EndpointSecurityFingerprint"] = fingerprint; 896previousState.Data["EndpointSecurityFingerprint"] = "legacy-endpoint-only-fingerprint"; 898previousState.Data["EndpointSecurityFingerprint"] = fingerprint; 899previousState.Data["PendingSecurityCleanup"] = true; 901previousState.Data["PendingSecurityCleanup"] = false; 913previousState.Data["HasRuntimeEnvironmentConfiguration"] = true; 915previousState.Data["HasRuntimeEnvironmentConfiguration"] = false; 921previousState.Data["HasRuntimeCommandConfiguration"] = true; 923previousState.Data["HasRuntimeCommandConfiguration"] = false; 1067azureState.Data["SubscriptionId"] = "sub"; 1068azureState.Data["ResourceGroup"] = "rg"; 1069azureState.Data["Location"] = "westus3"; 2445state.Data["Ports"] = new JsonArray 2655state.Data["Ports"] = new JsonArray(new JsonObject
AzureServiceBusExtensionsTests.cs (1)
516document["Custom"] = JsonValue.Create(42);
ProvisioningContextProviderTests.cs (4)
137azureSection.Data["SubscriptionId"] = "12345678-1234-1234-1234-123456789012"; 138azureSection.Data["Location"] = "westus3"; 139azureSection.Data["ResourceGroup"] = "rehydrated-rg"; 140azureSection.Data["AllowResourceGroupCreation"] = "true";
ProvisioningContextTests.cs (1)
203azureSection.Data["SubscriptionId"] = "test-id";
ProvisioningTestHelpers.cs (1)
1056_state[section.SectionName] = section.Data;
Aspire.Hosting.Blazor (5)
GatewayConfigurationBuilder.cs (5)
228environment[$"services__{svc.ServiceName}__https__0"] = $"{OriginToken}{pathBase}/{svc.ApiPrefix}/{svc.ServiceName}"; 233environment[$"services__{svc.ServiceName}__http__0"] = $"{OriginToken}{pathBase}/{svc.ApiPrefix}/{svc.ServiceName}"; 239environment["OTEL_SERVICE_NAME"] = resourceName; 244environment["OTEL_EXPORTER_OTLP_ENDPOINT"] = $"{pathBase}/{otlpPrefix}"; 245environment["OTEL_EXPORTER_OTLP_PROTOCOL"] = "http/protobuf";
Aspire.Hosting.CodeGeneration.TypeScript (24)
TypeScriptApiExportWriter.cs (6)
82json["items"] = items; 111json["members"] = members; 134json["deprecated"] = member.DeprecationMessage; 153json["parameters"] = parameters; 177json[name] = value; 194json[name] = array;
TypeScriptLanguageSupport.cs (18)
135packageJson["name"] = packageName; 136packageJson["version"] = "1.0.0"; 137packageJson["private"] = true; 138packageJson["type"] = "module"; 146engines["node"] = "^20.19.0 || ^22.13.0 || >=24"; 149scripts["aspire:lint"] = "eslint apphost.mts"; 150scripts["aspire:start"] = "aspire run"; 151scripts["aspire:build"] = $"tsc -p {AppHostTsConfigFileName}"; 152scripts["aspire:dev"] = $"tsc --watch -p {AppHostTsConfigFileName}"; 156scripts["lint"] = "npm run aspire:lint"; 157scripts["predev"] = "npm run aspire:lint"; 158scripts["dev"] = "npm run aspire:start"; 159scripts["prebuild"] = "npm run aspire:lint"; 160scripts["build"] = "npm run aspire:build"; 161scripts["watch"] = "npm run aspire:dev"; 196section[packageName] = version; 202section[packageName] = version; 214parent[propertyName] = obj;
Aspire.Hosting.Docker (3)
DockerComposeEnvironmentResource.cs (3)
427stateSection.Data["OutputPath"] = outputPath; 428stateSection.Data["ProjectName"] = composeContext.ProjectName; 429stateSection.Data["ComposeFilePath"] = composeContext.ComposeFilePath;
Aspire.Hosting.Kubernetes (7)
Deployment\HelmDeploymentEngine.cs (2)
486stateSection.Data["ReleaseName"] = releaseName; 487stateSection.Data["Namespace"] = @namespace;
KubernetesEnvironmentResource.cs (3)
2052metadataNode["annotations"] = System.Text.Json.Nodes.JsonNode.Parse(annotations.GetRawText()); 2057metadataNode["labels"] = System.Text.Json.Nodes.JsonNode.Parse(labels.GetRawText()); 2071minimal["spec"] = System.Text.Json.Nodes.JsonNode.Parse(spec.GetRawText());
KubernetesHelmChartExtensions.cs (2)
378stateSection.Data["ReleaseName"] = releaseName; 379stateSection.Data["Namespace"] = @namespace;
Aspire.Hosting.Radius (1)
Publishing\RadiusDeploymentPipelineStep.cs (1)
272parametersNode[identifier] = new JsonObject { ["value"] = value };
Aspire.Hosting.RemoteHost (7)
Ats\AtsCallbackProxyFactory.cs (2)
302args[$"p{ctParamIndex}"] = tokenId; 304args["$cancellationToken"] = tokenId;
Ats\AtsError.cs (5)
53obj["capability"] = Capability; 58obj["details"] = Details.ToJsonObject(); 100obj["parameter"] = Parameter; 105obj["expected"] = Expected; 110obj["actual"] = Actual;
Aspire.Hosting.Tests (62)
Orchestrator\ParameterProcessorTests.cs (1)
1680_unflattenedState[section.SectionName] = section.Data.DeepClone().AsObject();
Publishing\DeploymentStateManagerTests.cs (61)
44section1.Data["key1"] = "value1"; 60section.Data["NullValue"] = null; 79section1.Data["key1"] = "value1"; 89section2.Data["key2"] = "value2"; 108parametersSection.Data["param1"] = "value1"; 109azureSection.Data["resource1"] = "azure-value1"; 137section.Data[$"key{sectionIndex}"] = $"value{sectionIndex}"; 160section1.Data["key1"] = "value1"; 181section1.Data["key1"] = "value1"; 194section2.Data["key2"] = "value2"; 253section.Data["key1"] = "value1"; 270section.Data["nestedKey"] = "nestedValue"; 288section1.Data["key1"] = "value1"; 289section2.Data["key2"] = "value2"; 324section1.Data["key1"] = "value1"; 333section2.Data["key2"] = "value2"; 365topLevel.Data["topKey"] = "topValue"; 366nested.Data["nestedKey"] = "nestedValue"; 385section.Data["key"] = "value"; 476legacySection.Data["legacy"] = true; 483migratedSection.Data["current"] = true; 513legacySection.Data["Value"] = "legacy"; 517migratedSection.Data["Claimed"] = true; 529sameManagerLegacySection.Data["Value"] = "legacy"; 552section.Data["Value"] = "committed"; 569legacySection.Data["Value"] = "legacy"; 678initialSection.Data["Leaf"] = "initial"; 685staleObjectSection.Data["Leaf"] = "updated"; 713firstSection.Data["Features"] = new JsonObject { ["A"] = true }; 714secondSection.Data["Features"] = new JsonObject { ["B"] = true }; 740firstLegacySection.Data["SandboxId"] = "first-sandbox"; 743secondLegacySection.Data["SandboxId"] = "second-sandbox"; 751firstSection.Data["Migrated"] = true; 797legacyAzureSection.Data["SubscriptionId"] = "legacy-subscription"; 798legacyAzureSection.Data["Sandboxes"] = new JsonObject 807azureSection.Data["SubscriptionId"] = "current-subscription"; 833legacyAzureSection.Data["SubscriptionId"] = "legacy-subscription"; 834legacyAzureSection.Data["Sandboxes"] = new JsonObject 844newSandboxSection.Data["SandboxId"] = "new-sandbox"; 874legacySandboxesSection.Data["first"] = new JsonObject 879legacySandboxesSection.Data["second"] = new JsonObject 889newChildSection.Data["SandboxId"] = "new-sandbox"; 918firstLegacySection.Data["SandboxId"] = "first-sandbox"; 921secondLegacySection.Data["SandboxId"] = "second-sandbox"; 928firstSection.Data["Updated"] = true; 929secondSection.Data["Updated"] = true; 954legacyAzureSection.Data["SubscriptionId"] = "legacy-subscription"; 955legacyAzureSection.Data["Location"] = "legacy-location"; 962firstAzureSection.Data["SubscriptionId"] = "current-subscription"; 963secondAzureSection.Data["Location"] = "current-location"; 986legacySection.Data["SubscriptionId"] = "sub"; 1016currentSection.Data["SubscriptionId"] = "current-sub"; 1047currentSection.Data["SubscriptionId"] = "current-sub"; 1064restartedSection.Data["Location"] = "westus"; 1077section.Data["SubscriptionId"] = "sub"; 1097legacySection.Data["SandboxId"] = "sandbox"; 1118firstLegacySection.Data["SandboxId"] = "first-sandbox"; 1121secondLegacySection.Data["SandboxId"] = "second-sandbox"; 1130azureSection.Data["SubscriptionId"] = "current-subscription"; 1153firstLegacySection.Data["SandboxId"] = "first"; 1156secondLegacySection.Data["SandboxId"] = "second";
Aspire.Hosting.Yarp (5)
YarpJsonConfigGeneratorBuilder.cs (5)
84var jsonProxyConfig = jsonObject["ReverseProxy"] = new JsonObject(); 85jsonProxyConfig["Clusters"] = AddClusters(); 86jsonProxyConfig["Routes"] = AddRoutes(); 102routesNode[route.RouteId] = node; 116routesNode[cluster.ClusterId] = node;
ConfigurationSchemaGenerator (21)
ConfigSchemaEmitter.cs (21)
63categoryNode["$ref"] = "#/definitions/logLevelThreshold"; 67parent["definitions"] = new JsonObject 120currentNode["type"] = "object"; 126currentNode[propertiesName] = propertiesNode; 241currentNode["type"] = "object"; 247currentNode["properties"] = propertiesNode; 318currentNode["type"] = typeName; 320currentNode[containerName] = containerNode; 445propertyNode["description"] = description; 459propertyNode["default"] = true; 463propertyNode["default"] = false; 591propertyNode["type"] = "string"; 592propertyNode["pattern"] = TimeSpanRegex; 608propertyNode["enum"] = enumNode; 612propertyNode["type"] = "string"; 613propertyNode["format"] = "uri"; 620propertyNode["type"] = new JsonArray { "number", "string" }; 624propertyNode["type"] = "string"; 625propertyNode["format"] = "uuid"; 630propertyNode["oneOf"] = new JsonArray 649propertyNode["type"] = GetParsableTypeName(parsable);
dotnet (2)
Telemetry\TelemetryDiskLogger.cs (1)
62root["activities"] = activitiesArray;
ToolPackage\ToolPackageDownloaderBase.cs (1)
393runtimeOptions["rollForward"] = "Major";
dotnet-aot (1)
src\sdk\src\Cli\dotnet\Telemetry\TelemetryDiskLogger.cs (1)
62root["activities"] = activitiesArray;
dotnet-user-jwts (2)
Helpers\JwtAuthenticationSchemeSettings.cs (2)
34schemes[SchemeName] = settingsObject; 46config[AuthenticationKey] = new JsonObject
Infrastructure.Tests (1)
Pipelines\NpmCliPackageTests.cs (1)
598packageMap[rid.Rid] = $"{PackageName}-{rid.Rid}";
Microsoft.AspNetCore.JsonPatch.SystemTextJson (1)
Internal\JsonObjectAdapter.cs (1)
22obj[segment] = value != null ? JsonSerializer.SerializeToNode(value, serializerOptions) : GetJsonNull();
Microsoft.AspNetCore.OpenApi (60)
Extensions\JsonNodeSchemaExtensions.cs (51)
90schema[OpenApiSchemaKeywords.FormatKeyword] = "byte"; 125schema[rangeAttribute.MinimumIsExclusive ? OpenApiSchemaKeywords.ExclusiveMinimum : OpenApiSchemaKeywords.MinimumKeyword] = minValue; 129schema[rangeAttribute.MaximumIsExclusive ? OpenApiSchemaKeywords.ExclusiveMaximum : OpenApiSchemaKeywords.MaximumKeyword] = maxValue; 134schema[OpenApiSchemaKeywords.PatternKeyword] = regularExpressionAttribute.Pattern; 140schema[key] = maxLengthAttribute.Length; 146schema[key] = minLengthAttribute.Length; 152schema[$"min{targetKeySuffix}"] = lengthAttribute.MinimumLength; 153schema[$"max{targetKeySuffix}"] = lengthAttribute.MaximumLength; 157schema[OpenApiSchemaKeywords.FormatKeyword] = "uri"; 161schema[OpenApiSchemaKeywords.MinLengthKeyword] = stringLengthAttribute.MinimumLength; 162schema[OpenApiSchemaKeywords.MaxLengthKeyword] = stringLengthAttribute.MaximumLength; 186schema[schemaAttribute] = null; 190schema[schemaAttribute] = JsonSerializer.SerializeToNode(defaultValue, jsonTypeInfo); 213schema[OpenApiSchemaKeywords.FormatKeyword] = format; 230schema[OpenApiSchemaKeywords.MinimumKeyword] = minRouteConstraint.Min; 234schema[OpenApiSchemaKeywords.MaximumKeyword] = maxRouteConstraint.Max; 238schema[OpenApiSchemaKeywords.MinLengthKeyword] = minLengthRouteConstraint.MinLength; 242schema[OpenApiSchemaKeywords.MaxLengthKeyword] = maxLengthRouteConstraint.MaxLength; 246schema[OpenApiSchemaKeywords.MinimumKeyword] = rangeRouteConstraint.Min; 247schema[OpenApiSchemaKeywords.MaximumKeyword] = rangeRouteConstraint.Max; 251schema[OpenApiSchemaKeywords.TypeKeyword] = JsonSchemaType.String.ToString(); 252schema[OpenApiSchemaKeywords.FormatKeyword] = null; 253schema[OpenApiSchemaKeywords.PatternKeyword] = regexRouteConstraint.Constraint.ToString(); 257schema[OpenApiSchemaKeywords.MinLengthKeyword] = lengthRouteConstraint.MinLength; 258schema[OpenApiSchemaKeywords.MaxLengthKeyword] = lengthRouteConstraint.MaxLength; 262schema[OpenApiSchemaKeywords.TypeKeyword] = JsonSchemaType.Number.ToString(); 263schema[OpenApiSchemaKeywords.FormatKeyword] = constraint is FloatRouteConstraint ? "float" : "double"; 267schema[OpenApiSchemaKeywords.TypeKeyword] = JsonSchemaType.Integer.ToString(); 268schema[OpenApiSchemaKeywords.FormatKeyword] = constraint is LongRouteConstraint ? "int64" : "int32"; 272schema[OpenApiSchemaKeywords.TypeKeyword] = JsonSchemaType.String.ToString(); 273schema[OpenApiSchemaKeywords.FormatKeyword] = constraint is GuidRouteConstraint ? "uuid" : null; 277schema[OpenApiSchemaKeywords.TypeKeyword] = JsonSchemaType.Boolean.ToString(); 278schema[OpenApiSchemaKeywords.FormatKeyword] = null; 282schema[OpenApiSchemaKeywords.TypeKeyword] = JsonSchemaType.String.ToString(); 283schema[OpenApiSchemaKeywords.FormatKeyword] = null; 287schema[OpenApiSchemaKeywords.TypeKeyword] = JsonSchemaType.String.ToString(); 288schema[OpenApiSchemaKeywords.FormatKeyword] = "date-time"; 369schema[OpenApiSchemaKeywords.EnumKeyword] = enumArray; 390schema[defaultKey] = (JsonNode)memberName; 403schema[OpenApiSchemaKeywords.TypeKeyword] = (schemaTypes & ~JsonSchemaType.Null).ToString(); 455mappings[$"{discriminator}"] = $"{baseSchemaReferenceId}{createSchemaReferenceId(jsonDerivedType)}"; 458schema[OpenApiSchemaKeywords.DiscriminatorKeyword] = polymorphismOptions.TypeDiscriminatorPropertyName; 459schema[OpenApiSchemaKeywords.DiscriminatorMappingKeyword] = mappings; 462schema[OpenApiSchemaKeywords.DiscriminatorDefaultMappingKeyword] = baseSchemaReferenceId; 477schema[OpenApiConstants.SchemaId] = schemaReferenceId; 491schema[OpenApiConstants.SchemaIsUnion] = true; 497schema[OpenApiConstants.SchemaId] = "Base"; 561schema[OpenApiSchemaKeywords.TypeKeyword] = (schemaTypes | JsonSchemaType.Null).ToString(); 568schema[OpenApiSchemaKeywords.TypeKeyword] = nonNullableSchemaTypes.ToString(); 580schema[OpenApiConstants.NullableProperty] = true; 603schema[OpenApiSchemaKeywords.TypeKeyword] = typeArray[0]?.GetValue<string>();
Schemas\OpenApiJsonSchema.Helpers.cs (1)
168obj[key] = ReadJsonNode(ref reader);
Services\Schemas\OpenApiSchemaService.cs (8)
113schema[OpenApiSchemaKeywords.DescriptionKeyword] = typeDescriptionAttribute.Description; 117schema[OpenApiSchemaKeywords.DeprecatedKeyword] = true; 135schema[OpenApiSchemaKeywords.DescriptionKeyword] = descriptionAttribute.Description; 139schema[OpenApiSchemaKeywords.DeprecatedKeyword] = true; 146schema[OpenApiConstants.RefDescriptionAnnotation] = descriptionAttribute.Description; 150schema[OpenApiConstants.RefDeprecatedAnnotation] = true; 623newObject[property.Key] = processedValue?.DeepClone(); 627newObject[property.Key] = null;
Microsoft.Extensions.AI (6)
Realtime\LoggingRealtimeClientSession.cs (6)
196obj["content"] = s; 200obj["content"] = AsJson(message.RawRepresentation); 204obj["messageId"] = message.MessageId; 219obj["content"] = s; 223obj["content"] = AsJson(message.RawRepresentation); 227obj["messageId"] = message.MessageId;
Microsoft.Extensions.AI.Abstractions (30)
Utilities\AIJsonUtilities.Schema.Create.cs (21)
152schema[SchemaPropertyName] = SchemaKeywordUri; 157schema[TitlePropertyName] = title; 162schema[DescriptionPropertyName] = description; 165schema[TypePropertyName] = "object"; // Method schemas always hardcode the type as "object". 166schema[PropertiesPropertyName] = parameterSchemas; 170schema[RequiredPropertyName] = requiredProperties; 301objSchema[RefPropertyName] = (JsonNode)refUri; 328obj[TypePropertyName] = new JsonArray { (JsonNode)numericType, (JsonNode)"null" }; 332obj[TypePropertyName] = (JsonNode)numericType; 349objSchema[TypePropertyName] = new JsonArray { (JsonNode)typeValue, (JsonNode)"null" }; 370objSchema[TypePropertyName] = new JsonArray { (JsonNode)typeValue, (JsonNode)"null" }; 458obj[MinLengthStringPropertyName] ??= stringLengthAttribute.MinimumLength; 461obj[MaxLengthStringPropertyName] ??= stringLengthAttribute.MaximumLength; 470obj[MinLengthStringPropertyName] ??= minLengthAttribute.Length; 474obj[MinLengthCollectionPropertyName] ??= minLengthAttribute.Length; 484obj[MaxLengthStringPropertyName] ??= maxLengthAttribute.Length; 488obj[MaxLengthCollectionPropertyName] ??= maxLengthAttribute.Length; 543obj[MinRangePropertyName] ??= minNode; 557obj[MaxRangePropertyName] ??= maxNode; 576requiredArray ??= (JsonArray)(requiredSchemaObj[RequiredPropertyName] = new JsonArray()); 833jsonObject[entry.Key] = entry.Value;
Utilities\AIJsonUtilities.Schema.Transform.cs (9)
75properties[prop.Key] = TransformSchemaCore(prop.Value, transformOptions, path); 85schemaObj[ItemsPropertyName] = TransformSchemaCore(itemsSchema, transformOptions, path); 93schemaObj[AdditionalPropertiesPropertyName] = TransformSchemaCore(additionalProps, transformOptions, path); 100schemaObj[NotPropertyName] = TransformSchemaCore(notSchema, transformOptions, path); 130schemaObj[AdditionalPropertiesPropertyName] = (JsonNode)false; 141schemaObj[RequiredPropertyName] = requiredProps; 172schemaObj["type"] = (JsonNode)foundType; 173schemaObj["nullable"] = (JsonNode)true; 185schemaObj[DescriptionPropertyName] = description;
Microsoft.Extensions.AI.Evaluation.Quality (1)
AIToolExtensions.cs (1)
34functionJsonNode["functionReturnValueSchema"] =
Microsoft.Extensions.AI.Evaluation.Safety (6)
ContentSafetyServicePayloadUtilities.cs (6)
157payload["MetricList"] = new JsonArray([.. metricNames]); 204item[questionPropertyName] = question.Text; 209item[answerPropertyName] = answer.Text; 214item[contextPropertyName] = normalizedPerTurnContext[index]; 239payload["MetricList"] = new JsonArray([.. metricNames]); 371payload["MetricList"] = new JsonArray([.. metricNames]);
Microsoft.Extensions.AI.OpenAI (1)
OpenAIClientExtensions.cs (1)
92schemaObj["description"] = schemaObj["description"] is { } descriptionNode && descriptionNode.GetValueKind() == JsonValueKind.String ?
Microsoft.ML.AutoML (9)
SweepableEstimator\Converter\MultiModelPipelineConverter.cs (2)
27jsonObject["schema"] = value.Schema.ToString(); 28jsonObject["estimators"] = JsonValue.Create(value.Estimators);
SweepableEstimator\Converter\SweepableEstimatorConverter.cs (2)
30jObject["estimatorType"] = JsonValue.Create(value.EstimatorType); 31jObject["parameter"] = JsonValue.Create(value.Parameter);
SweepableEstimator\Converter\SweepableEstimatorPipelineConverter.cs (2)
30jNode["parameter"] = JsonValue.Create(parameter); 31jNode["estimators"] = JsonValue.Create(estimators);
SweepableEstimator\Converter\SweepablePipelineConverter.cs (3)
28jsonObject["schema"] = value.Schema.ToString(); 29jsonObject["currentSchema"] = value.CurrentParameter["_SCHEMA_"].AsType<string>(); 30jsonObject["estimators"] = JsonValue.Create(value.Estimators);
Microsoft.NET.Build.Containers (13)
ImageConfig.cs (13)
94newConfig["ExposedPorts"] = CreatePortMap(); 98newConfig["Labels"] = CreateLabelMap(); 102newConfig["Env"] = CreateEnvironmentVariablesMapping(); 107newConfig["WorkingDir"] = _newWorkingDirectory; 112newConfig["Entrypoint"] = ToJsonArray(_newEntrypoint); 117newConfig["Cmd"] = ToJsonArray(_newCmd); 122newConfig["User"] = _user; 134newConfig[propertyName] = JsonNode.Parse(propertyValue.ToJsonString()); 177history["author"] = h.author; 181history["comment"] = h.comment; 185history["created"] = RFC3339Format(date); 189history["created_by"] = h.created_by; 193history["empty_layer"] = h.empty_layer;
Microsoft.NET.Build.Tasks (12)
GenerateRuntimeConfigurationFiles.cs (12)
316configProperties[hostConfigurationOption.ItemSpec] = GetConfigPropertyValue(hostConfigurationOption); 364configProperties["System.Reflection.Metadata.MetadataUpdater.IsSupported"] = true; 365configProperties["System.StartupHookProvider.IsSupported"] = true; 442json["tfm"] = runtimeOptions.Tfm; 447json["rollForward"] = runtimeOptions.RollForward; 452json["framework"] = SerializeFramework(runtimeOptions.Framework); 457json["frameworks"] = SerializeFrameworks(runtimeOptions.Frameworks); 462json["includedFrameworks"] = SerializeFrameworks(runtimeOptions.IncludedFrameworks); 475json["additionalProbingPaths"] = probingPaths; 483json[rawOption.Key] = rawOption.Value?.DeepClone(); 509json["name"] = framework.Name; 514json["version"] = framework.Version;
Microsoft.TemplateEngine.Cli (5)
Alias\AliasRegistry.cs (2)
158commandAliases[kvp.Key] = arr; 160root["CommandAliases"] = commandAliases;
PostActionProcessors\AddJsonPropertyPostActionProcessor.cs (3)
200parentProperty[newJsonPropertyName] = JsonNode.Parse(newJsonPropertyValue); 204parentProperty[newJsonPropertyName] = newJsonPropertyValue; 231node[property] = childNode = new JsonObject();
Microsoft.TemplateEngine.Edge (1)
src\sdk\src\TemplateEngine\Shared\JExtensions.cs (1)
643target[property.Key] = property.Value != null
Microsoft.TemplateEngine.Orchestrator.RunnableProjects (1)
src\sdk\src\TemplateEngine\Shared\JExtensions.cs (1)
643target[property.Key] = property.Value != null
Microsoft.TemplateEngine.Utils (1)
src\sdk\src\TemplateEngine\Shared\JExtensions.cs (1)
643target[property.Key] = property.Value != null
Microsoft.TemplateSearch.Common (1)
src\sdk\src\TemplateEngine\Shared\JExtensions.cs (1)
643target[property.Key] = property.Value != null
MSBuild (13)
JsonOutputFormatter.cs (12)
39propertiesNode[property] = getProperty(property); 42_topLevelNode["Properties"] = propertiesNode; 61jsonItem["Identity"] = item.GetMetadataValue("Identity"); 69jsonItem[metadatumName] = TryGetMetadataValue(item, metadatumName); 75itemsNode[itemName] = itemArray; 78_topLevelNode["Items"] = itemsNode; 95targetResults["Result"] = targetResult.ResultCode.ToString(); 100jsonItem["Identity"] = item.GetMetadata("Identity"); 108jsonItem[metadatumName] = TryGetMetadata(item, metadatumName); 114targetResults["Items"] = outputArray; 115targetResultsNode[targetName] = targetResults; 118_topLevelNode["TargetResults"] = targetResultsNode;
XMake.cs (1)
4727jsonNode[featureName] = Features.CheckFeatureAvailability(featureName).ToString();
NuGet.Protocol (7)
Plugins\Logging\AssemblyLogMessage.cs (2)
49message["file version"] = _fileVersion; 54message["informational version"] = _informationalVersion;
Plugins\Logging\EnvironmentVariablesLogMessage.cs (3)
38message["handshake timeout in seconds"] = _handshakeTimeout.Value; 43message["idle timeout in seconds"] = _idleTimeout.Value; 48message["request timeout in seconds"] = _requestTimeout.Value;
Plugins\Logging\PluginInstanceLogMessage.cs (1)
38message["process ID"] = _processId.Value;
Plugins\Logging\TaskLogMessage.cs (1)
40message["current task ID"] = _currentTaskId.Value;
sdk-tasks (2)
UpdateRuntimeConfig.cs (2)
61framework["version"] = MicrosoftNetCoreAppVersion; 65framework["version"] = MicrosoftAspNetCoreAppVersion;
SelectTests (1)
Program.cs (1)
592selection[name] = value;
System.Text.Json (1)
System\Text\Json\Serialization\Converters\Node\JsonObjectConverter.cs (1)
36jObject[propertyName] = jNodeValue;
TestProject.AppHost (2)
TestProgram.cs (2)
178root[project.Name] = projectJson; 181projectJson["Endpoints"] = endpointsJsonArray;
1129 references to
aspire (55)
Agents\ClaudeCode\ClaudeCodeAgentEnvironmentScanner.cs (2)
207if (!config.ContainsKey("mcpServers") || config["mcpServers"] is not JsonObject) 212var servers = config["mcpServers"]!.AsObject();
Agents\CopilotCli\CopilotCliAgentEnvironmentScanner.cs (2)
207if (!config.ContainsKey("mcpServers") || config["mcpServers"] is not JsonObject) 212var servers = config["mcpServers"]!.AsObject();
Agents\OpenCode\OpenCodeAgentEnvironmentScanner.cs (2)
198if (!config.ContainsKey("mcp") || config["mcp"] is not JsonObject) 203var mcp = config["mcp"]!.AsObject();
Agents\VsCode\VsCodeAgentEnvironmentScanner.cs (2)
252if (!config.ContainsKey("servers") || config["servers"] is not JsonObject) 257var servers = config["servers"]!.AsObject();
Commands\InitCommand.cs (14)
559if (settings["appHost"] is not JsonObject appHost) 569if (language is not null && appHost["language"] is null) 579if (!string.IsNullOrEmpty(channel) && settings["channel"] is null) 594var existingProfilesObject = settings["profiles"] as JsonObject; 719if (profiles["https"] is not JsonObject https || profiles["http"] is not JsonObject http) 724var httpsEnv = https["environmentVariables"] as JsonObject; 725var httpEnv = http["environmentVariables"] as JsonObject; 731if (!TryParseHostPort(https["applicationUrl"]?.GetValue<string>(), "https", out var dashboardHttps) 732|| !TryParseHostPort(http["applicationUrl"]?.GetValue<string>(), "http", out var dashboardHttp) 733|| !TryParseHostPort(httpsEnv[KnownConfigNames.DashboardOtlpGrpcEndpointUrl]?.GetValue<string>(), "https", out var otlpHttps) 734|| !TryParseHostPort(httpEnv[KnownConfigNames.DashboardOtlpGrpcEndpointUrl]?.GetValue<string>(), "http", out var otlpHttp) 735|| !TryParseHostPort(httpsEnv[KnownConfigNames.ResourceServiceEndpointUrl]?.GetValue<string>(), "https", out var resourceServiceHttps) 736|| !TryParseHostPort(httpEnv[KnownConfigNames.ResourceServiceEndpointUrl]?.GetValue<string>(), "http", out var resourceServiceHttp))
Configuration\ConfigurationService.cs (5)
236if (!currentObject.ContainsKey(part) || currentObject[part] is not JsonObject) 241currentObject = currentObject[part]!.AsObject(); 266if (settings.ContainsKey(partialKey) && settings[partialKey] is not JsonObject) 298if (!currentObject.ContainsKey(part) || currentObject[part] is not JsonObject) 303currentObject = currentObject[part]!.AsObject();
Migrations\TypeScriptAppHostMigration.cs (4)
201root["appHost"] is not JsonObject appHost || 202appHost["path"] is not JsonValue pathValue || 248root["include"] is not JsonArray include) 288root["scripts"] is not JsonObject scripts)
Npm\SigstoreNpmProvenanceChecker.cs (2)
210var predicateTypeNode = attestationObj["predicateType"]; 231var bundleNode = attestationObj["bundle"];
Scaffolding\PackageJsonMerger.cs (13)
97var scaffoldScripts = scaffold[ScriptsKey]?.AsObject(); 123var targetValue = existing[key]; 164else if (existingScripts[name] is not null) 204if (scripts[unprefixed] is null) 219var scaffoldDeps = scaffold[sectionName]?.AsObject(); 234var existingVersionNode = existingDeps[packageName]; 261if (existing[sectionName] is not JsonObject existingDeps) 266var existingVersionNode = existingDeps[packageName]; 290var scaffoldEngines = scaffold[EnginesKey]?.AsObject(); 310else if (existingEngines[key] is null) 331var targetValue = target[key]; 347if (parent[propertyName] is JsonObject obj) 352if (parent[propertyName] is not null)
Scaffolding\ScaffoldingService.cs (4)
374if (parent[propertyName] is JsonObject obj) 399if (scripts[scriptName] is JsonValue existingScriptValue && 406if (scripts[scriptName] is not null) 659if (existing[key] is not { } existingValue)
Utils\ConfigurationHelper.cs (5)
339if (!currentObject.ContainsKey(part) || currentObject[part] is null) 343else if (currentObject[part] is JsonObject) 345currentObject = currentObject[part]!.AsObject(); 356currentObject = currentObject[part]!.AsObject(); 367if (currentObject.ContainsKey(finalKey) && currentObject[finalKey] is not null)
Aspire.Cli.EndToEnd.Tests (43)
CSharpInitTests.cs (2)
65var appHostNode = config["appHost"]; 71var language = appHostNode["language"]?.GetValue<string>();
ProjectReferenceTests.cs (1)
118var packages = config["packages"] as JsonObject ?? new JsonObject();
SelfUpdateChannelPersistenceTests.cs (1)
89Assert.Equal("staging", updatedConfig["channel"]?.GetValue<string>());
SingleFileAppHostInitDotnetRunTests.cs (6)
85var httpsProfile = runJson["profiles"]?["https"]?.AsObject(); 87Assert.Equal("Project", httpsProfile["commandName"]?.GetValue<string>()); 88Assert.False(string.IsNullOrWhiteSpace(httpsProfile["applicationUrl"]?.GetValue<string>())); 89var httpsEnv = httpsProfile["environmentVariables"]?.AsObject(); 91Assert.False(string.IsNullOrWhiteSpace(httpsEnv["ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL"]?.GetValue<string>())); 92Assert.False(string.IsNullOrWhiteSpace(httpsEnv["ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL"]?.GetValue<string>()));
TypeScriptLegacyAppHostTests.cs (1)
137var appHost = configJson["appHost"]!.AsObject();
TypeScriptMigrateAppHostTests.cs (2)
124var appHost = configJson["appHost"]!.AsObject(); 216var includes = tsconfig["include"]!.AsArray().Select(n => n!.GetValue<string>()).ToArray();
TypeScriptPolyglotTests.cs (30)
354var scripts = packageJson["scripts"]!.AsObject(); 355originalDevScript = scripts["dev"]?.GetValue<string>(); 356originalBuildScript = scripts["build"]?.GetValue<string>(); 357originalPreviewScript = scripts["preview"]?.GetValue<string>(); 358originalPackageType = packageJson["type"]?.GetValue<string>(); 385scripts = packageJson["scripts"]!.AsObject(); 387Assert.Equal(originalDevScript, scripts["dev"]?.GetValue<string>()); 388Assert.Equal(originalBuildScript, scripts["build"]?.GetValue<string>()); 389Assert.Equal(originalPreviewScript, scripts["preview"]?.GetValue<string>()); 390Assert.Equal("custom-apphost-start", scripts["aspire:start"]?.GetValue<string>()); 391Assert.Equal("npm --prefix aspire-apphost run aspire:build", scripts["aspire:build"]?.GetValue<string>()); 392Assert.Equal("npm --prefix aspire-apphost run aspire:dev", scripts["aspire:dev"]?.GetValue<string>()); 393Assert.Equal(originalPackageType, packageJson["type"]?.GetValue<string>()); 395var rootDependencies = packageJson["dependencies"]?.AsObject(); 396var rootDevDependencies = packageJson["devDependencies"]?.AsObject(); 410var appHostScripts = appHostPackageJson["scripts"]!.AsObject(); 411var appHostDependencies = appHostPackageJson["dependencies"]!.AsObject(); 412var appHostDevDependencies = appHostPackageJson["devDependencies"]!.AsObject(); 413Assert.Equal("module", appHostPackageJson["type"]?.GetValue<string>()); 414Assert.Equal("aspire-apphost", appHostPackageJson["name"]?.GetValue<string>()); 415Assert.Equal("aspire run", appHostScripts["aspire:start"]?.GetValue<string>()); 416Assert.NotNull(appHostDependencies["vscode-jsonrpc"]); 417Assert.NotNull(appHostDevDependencies["@types/node"]); 418Assert.NotNull(appHostDevDependencies["nodemon"]); 419Assert.NotNull(appHostDevDependencies["tsx"]); 420Assert.NotNull(appHostDevDependencies["typescript"]); 426var appHost = config["appHost"]!.AsObject(); 427Assert.Equal("aspire-apphost/apphost.mts", appHost["path"]?.GetValue<string>()); 428var packagesNode = config["packages"]; 431Assert.NotNull(packages["Aspire.Hosting.JavaScript"]);
Aspire.Cli.Tests (309)
Agents\CopilotCliAgentEnvironmentScannerTests.cs (9)
65var servers = config["mcpServers"]?.AsObject(); 69var aspireServer = servers["aspire"]?.AsObject(); 71Assert.Equal("local", aspireServer["type"]?.GetValue<string>()); 72Assert.Equal("aspire", aspireServer["command"]?.GetValue<string>()); 74var args = aspireServer["args"]?.AsArray(); 81var env = aspireServer["env"]?.AsObject(); 84Assert.Equal("${DOTNET_ROOT}", env["DOTNET_ROOT"]?.GetValue<string>()); 87var tools = aspireServer["tools"]?.AsArray(); 125var servers = config["mcpServers"]?.AsObject();
Agents\TelemetryHookConfiguratorTests.cs (22)
31Assert.Equal(1, (int)root["version"]!); 33var entry = root["hooks"]!["postToolUse"]!.AsArray()[0]!.AsObject(); 34Assert.Equal("command", (string)entry["type"]!); 35Assert.Equal(30, (int)entry["timeoutSec"]!); 36Assert.Contains("track-telemetry.sh", (string)entry["bash"]!); 37Assert.StartsWith("bash ", (string)entry["bash"]!); 38Assert.Contains("track-telemetry.ps1", (string)entry["powershell"]!); 39Assert.Contains("-File ", (string)entry["powershell"]!); 41Assert.StartsWith("pwsh ", (string)entry["powershell"]!); 78Assert.Equal("command", (string)entry["type"]!); 79Assert.Equal(30, (int)entry["timeout"]!); 83var execCommand = (string)entry["command"]!; 84var args = entry["args"]!.AsArray().Select(a => (string)a!).ToArray(); 144Assert.Equal("claude-opus", (string)root["model"]!); 146var postToolUse = root["hooks"]!["PostToolUse"]!.AsArray(); 230return root["hooks"]!["PostToolUse"]!.AsArray(); 238&& obj["hooks"] is JsonArray hooks 245&& (JsonValueHasTelemetryScript(ho["command"]) 246|| (ho["args"] is JsonArray args && args.Any(JsonValueHasTelemetryScript))); 253&& obj["hooks"] is JsonArray hooks 255&& ho["command"] is JsonValue v 262if (group is JsonObject obj && obj["hooks"] is JsonArray hooks)
Agents\VsCodeAgentEnvironmentScannerTests.cs (8)
151var servers = config["servers"]?.AsObject(); 155var aspireServer = servers["aspire"]?.AsObject(); 157Assert.Equal("stdio", aspireServer["type"]?.GetValue<string>()); 158Assert.Equal("aspire", aspireServer["command"]?.GetValue<string>()); 160var args = aspireServer["args"]?.AsArray(); 203var servers = config["servers"]?.AsObject(); 250Assert.Equal("stdio", aspireServer["type"]?.GetValue<string>()); 251Assert.Equal("aspire", aspireServer["command"]?.GetValue<string>());
Commands\ConfigCommandTests.cs (36)
128Assert.Equal("bar", settings["foo"]?.ToString()); 154Assert.True(settings["docs"] is JsonObject); 155var docsObject = settings["docs"]!.AsObject(); 156Assert.Equal("http://localhost:4321/llms-small.txt", docsObject["llmsTxtUrl"]?.ToString()); 157Assert.True(docsObject["api"] is JsonObject); 158Assert.Equal("http://localhost:4321/sitemap-0.xml", docsObject["api"]?["sitemapUrl"]?.ToString()); 188Assert.True(settings["foo"] is JsonObject); 189var fooObject = settings["foo"]!.AsObject(); 190Assert.Equal("baz", fooObject["bar"]?.ToString()); 214Assert.True(settings["foo"] is JsonObject); 215var fooObject = settings["foo"]!.AsObject(); 216Assert.True(fooObject["bar"] is JsonObject); 217var barObject = fooObject["bar"]!.AsObject(); 218Assert.Equal("hello", barObject["baz"]?.ToString()); 246Assert.True(settings["foo"] is JsonObject); 247var fooObject = settings["foo"]!.AsObject(); 248Assert.Equal("nested", fooObject["bar"]?.ToString()); 697Assert.True(settings["features"] is JsonObject); 698var featuresObject = settings["features"]!.AsObject(); 699Assert.Equal("true", featuresObject["polyglotSupportEnabled"]?.ToString()); 728Assert.True(settings["features"] is JsonObject); 729var featuresObject = settings["features"]!.AsObject(); 730Assert.Equal("false", featuresObject["polyglotSupportEnabled"]?.ToString()); 759Assert.True(settings["features"] is JsonObject); 760var featuresObject = settings["features"]!.AsObject(); 761Assert.Equal("false", featuresObject["polyglotSupportEnabled"]?.ToString()); 819Assert.True(settings["features"] is JsonObject); 820var featuresObject = settings["features"]!.AsObject(); 821Assert.Equal("false", featuresObject["polyglotSupportEnabled"]?.ToString()); 852var featuresObject = settings["features"]!.AsObject(); 853Assert.Equal("nested-value", featuresObject["polyglotSupportEnabled"]?.ToString()); 878var appHost = settings["appHost"]?.AsObject(); 880Assert.Equal("AppHost.csproj", appHost["path"]?.ToString()); 908Assert.Equal("daily", settings["channel"]?.ToString()); 909var appHost = settings["appHost"]?.AsObject(); 911Assert.Equal("AppHost.csproj", appHost["path"]?.ToString());
Commands\InitCommandTests.cs (49)
169var appHost = config["appHost"]!.AsObject(); 170Assert.Equal("apphost.cs", appHost["path"]!.GetValue<string>()); 171Assert.Null(appHost["language"]); 197var profiles = runJson["profiles"]!.AsObject(); 199var https = profiles["https"]!.AsObject(); 200Assert.Equal("Project", https["commandName"]!.GetValue<string>()); 201Assert.True(https["dotnetRunMessages"]!.GetValue<bool>()); 202var httpsUrls = https["applicationUrl"]!.GetValue<string>(); 204var httpsEnv = https["environmentVariables"]!.AsObject(); 205Assert.Equal("Development", httpsEnv[KnownAspNetCoreConfigNames.Environment]!.GetValue<string>()); 206Assert.Equal("Development", httpsEnv[KnownAspNetCoreConfigNames.DotNetEnvironment]!.GetValue<string>()); 207Assert.StartsWith("https://localhost:", httpsEnv["ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL"]!.GetValue<string>()); 208Assert.StartsWith("https://localhost:", httpsEnv["ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL"]!.GetValue<string>()); 210var http = profiles["http"]!.AsObject(); 211Assert.Equal("Project", http["commandName"]!.GetValue<string>()); 212var httpEnv = http["environmentVariables"]!.AsObject(); 213Assert.Equal("Development", httpEnv[KnownAspNetCoreConfigNames.Environment]!.GetValue<string>()); 214Assert.StartsWith("http://localhost:", httpEnv["ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL"]!.GetValue<string>()); 215Assert.StartsWith("http://localhost:", httpEnv["ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL"]!.GetValue<string>()); 216Assert.Equal("true", httpEnv["ASPIRE_ALLOW_UNSECURED_TRANSPORT"]!.GetValue<string>()); 221var aspireProfiles = aspireConfig["profiles"]!.AsObject(); 223aspireProfiles["https"]!["applicationUrl"]!.GetValue<string>(), 226aspireProfiles["http"]!["applicationUrl"]!.GetValue<string>(), 227http["applicationUrl"]!.GetValue<string>()); 275var profiles = runJson["profiles"]!.AsObject(); 276var https = profiles["https"]!.AsObject(); 277var http = profiles["http"]!.AsObject(); 279Assert.Equal("https://localhost:18000;http://localhost:18001", https["applicationUrl"]!.GetValue<string>()); 280Assert.Equal("https://localhost:18002", https["environmentVariables"]!["ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL"]!.GetValue<string>()); 281Assert.Equal("https://localhost:18003", https["environmentVariables"]!["ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL"]!.GetValue<string>()); 282Assert.Equal("http://localhost:18001", http["applicationUrl"]!.GetValue<string>()); 283Assert.Equal("http://localhost:18005", http["environmentVariables"]!["ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL"]!.GetValue<string>()); 284Assert.Equal("http://localhost:18006", http["environmentVariables"]!["ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL"]!.GetValue<string>()); 328var preservedProfiles = aspireConfig["profiles"]!.AsObject(); 330var preservedHttps = preservedProfiles["https"]!.AsObject(); 331Assert.Equal("https://localhost:18000", preservedHttps["applicationUrl"]!.GetValue<string>()); 332var preservedEnv = preservedHttps["environmentVariables"]!.AsObject(); 333Assert.Equal("custom-value", preservedEnv["MY_CUSTOM_VAR"]!.GetValue<string>()); 400var appHost = config["appHost"]!.AsObject(); 401Assert.Equal("apphost.mts", appHost["path"]!.GetValue<string>()); 402Assert.Equal("typescript/nodejs", appHost["language"]!.GetValue<string>()); 689Assert.Equal("apphost.cs", merged["appHost"]!.AsObject()["path"]!.GetValue<string>()); 691Assert.Equal("stable", merged["channel"]!.GetValue<string>()); 692Assert.True(merged["features"]!.AsObject()["polyglotSupportEnabled"]!.GetValue<bool>()); 1136Assert.Null(config["channel"]); 1140Assert.Equal(contextChannel, config["channel"]!.GetValue<string>()); 1173Assert.Equal("pr-99999", config["channel"]!.GetValue<string>()); 1205Assert.Null(config["channel"]); 1249Assert.Null(config["channel"]);
Commands\OperatingSystemCheckTests.cs (8)
28Assert.Equal("Linux", result.Metadata["osType"]!.GetValue<string>()); 29Assert.Equal("Linux Ubuntu", result.Metadata["displayName"]!.GetValue<string>()); 30Assert.Equal("24.04", result.Metadata["version"]!.GetValue<string>()); 31Assert.Equal("Ubuntu 24.04.2 LTS", result.Metadata["description"]!.GetValue<string>()); 50Assert.Equal("unknown", result.Metadata["osType"]!.GetValue<string>()); 51Assert.Equal("unknown", result.Metadata["displayName"]!.GetValue<string>()); 52Assert.Equal("1.2.3", result.Metadata["version"]!.GetValue<string>()); 53Assert.Equal("Unknown OS description", result.Metadata["description"]!.GetValue<string>());
Commands\ResourceCommandHelperTests.cs (1)
143Assert.Equal("#submit", connection.ExecuteResourceCommandArguments["selector"]!.GetValue<string>());
Commands\TelemetryTracesCommandTests.cs (2)
141Assert.Equal("abc1234567890def", item["traceId"]!.GetValue<string>()); 143var dashboardUrl = item["dashboardUrl"]!.GetValue<string>();
Commands\VsCodeExtensionCheckTests.cs (6)
51Assert.True(result.Metadata["vsCodeInstalled"]!.GetValue<bool>()); 52Assert.False(result.Metadata["extensionInstalled"]!.GetValue<bool>()); 53Assert.Equal(VsCodeExtensionCheck.ExtensionId, result.Metadata["extensionId"]!.GetValue<string>()); 80Assert.True(result.Metadata["vsCodeInstalled"]!.GetValue<bool>()); 81Assert.True(result.Metadata["extensionInstalled"]!.GetValue<bool>()); 82Assert.Equal(VsCodeExtensionCheck.ExtensionId, result.Metadata["extensionId"]!.GetValue<string>());
Mcp\ExecuteResourceCommandToolTests.cs (5)
92Assert.Equal("#submit", connection.ExecuteResourceCommandArguments["selector"]!.GetValue<string>()); 113Assert.Equal("3", connection.ExecuteResourceCommandArguments["count"]!.GetValue<string>()); 114Assert.Equal("true", connection.ExecuteResourceCommandArguments["urgent"]!.GetValue<string>()); 115Assert.Equal("1.5", connection.ExecuteResourceCommandArguments["ratio"]!.GetValue<string>()); 116Assert.Null(connection.ExecuteResourceCommandArguments["optional"]);
Mcp\ListStructuredLogsToolTests.cs (11)
199Assert.Equal("api-service-instance-1", firstLog["resourceName"]?.GetValue<string>()); 200Assert.Equal(42, firstLog["logId"]?.GetValue<long>()); 201var firstLogAttributes = firstLog["attributes"]?.AsObject(); 207Assert.Equal("http://localhost:18888/structuredlogs?logEntryId=42", firstLog["dashboardUrl"]?.GetValue<string>()); 212Assert.Equal("api-service-instance-2", secondLog["resourceName"]?.GetValue<string>()); 213Assert.Equal(43, secondLog["logId"]?.GetValue<long>()); 214var secondLogAttributes = secondLog["attributes"]?.AsObject(); 218Assert.Equal("http://localhost:18888/structuredlogs?logEntryId=43", secondLog["dashboardUrl"]?.GetValue<string>()); 223Assert.Equal("worker-service", thirdLog["resourceName"]?.GetValue<string>()); 224Assert.Equal(44, thirdLog["logId"]?.GetValue<long>()); 226Assert.Equal("http://localhost:18888/structuredlogs?logEntryId=44", thirdLog["dashboardUrl"]?.GetValue<string>());
Mcp\ListTracesToolTests.cs (13)
172Assert.Equal("abc123def456789012345678901234567890", firstTrace["traceId"]?.GetValue<string>()); 175var spans = firstTrace["spans"]?.AsArray(); 180Assert.Equal("http://localhost:18888/traces/detail/abc123def456789012345678901234567890", firstTrace["dashboardUrl"]?.GetValue<string>()); 185Assert.Equal("api-service-instance-1", serverSpan["source"]?.GetValue<string>()); 186Assert.Null(serverSpan["destination"]); 191Assert.Equal("api-service-instance-2", clientSpan["source"]?.GetValue<string>()); 192Assert.Equal("catalog-service", clientSpan["destination"]?.GetValue<string>()); 197Assert.Equal("xyz789abc123456789012345678901234567890", secondTrace["traceId"]?.GetValue<string>()); 199Assert.Equal("http://localhost:18888/traces/detail/xyz789abc123456789012345678901234567890", secondTrace["dashboardUrl"]?.GetValue<string>()); 202var secondTraceSpans = secondTrace["spans"]?.AsArray(); 209Assert.Equal("Internal", internalSpan["kind"]?.GetValue<string>()); 210Assert.Equal("worker-service", internalSpan["source"]?.GetValue<string>()); 211Assert.Null(internalSpan["destination"]);
Migrations\TypeScriptAppHostMigrationTests.cs (7)
62Assert.Equal(KnownLanguageId.TypeScript, descriptor.Metadata["language"]!.GetValue<string>()); 63Assert.Equal(appHostPath, descriptor.Metadata["appHostPath"]!.GetValue<string>()); 190Assert.Equal("apphost.mts", config["appHost"]!["path"]!.GetValue<string>()); 193var includes = tsconfig["include"]!.AsArray().Select(n => n!.GetValue<string>()).ToArray(); 197var scripts = packageJson["scripts"]!; 198Assert.Equal("tsc -p tsconfig.apphost.json", scripts["aspire:build"]!.GetValue<string>()); 199Assert.Equal("eslint apphost.mts", scripts["aspire:lint"]!.GetValue<string>());
Projects\ProjectUpdaterTests.cs (11)
758itemsAndProperties["Items"]!["PackageReference"]!.AsArray().Clear(); // Then clear it 765itemsAndProperties["Items"]!["PackageReference"]!.AsArray().Clear(); // Then clear it 4071properties = root["Properties"]!.AsObject(); 4086items = root["Items"]!.AsObject(); 4105var items = root["Items"]!.AsObject(); 4106var packageReferences = items["PackageReference"]!.AsArray(); 4121var items = root["Items"]!.AsObject(); 4122var packageReferences = items["PackageReference"]!.AsArray(); 4137var items = root["Items"]!.AsObject(); 4138var projectReferences = items["ProjectReference"]!.AsArray(); 4154properties = root["Properties"]!.AsObject();
Scaffolding\PackageJsonMergerTests.cs (98)
57Assert.Equal("vite", scripts["dev"]?.GetValue<string>()); 58Assert.Equal("vite build", scripts["build"]?.GetValue<string>()); 61Assert.Equal("aspire run", scripts["aspire:dev"]?.GetValue<string>()); 62Assert.Equal("tsc -p tsconfig.apphost.json", scripts["aspire:build"]?.GetValue<string>()); 65Assert.Equal("eslint apphost.ts", scripts["lint"]?.GetValue<string>()); 94Assert.Equal("jest", scripts["test"]?.GetValue<string>()); 97Assert.Equal("aspire run", scripts["dev"]?.GetValue<string>()); 98Assert.Equal("tsc -p tsconfig.apphost.json", scripts["build"]?.GetValue<string>()); 99Assert.Equal("eslint apphost.ts", scripts["lint"]?.GetValue<string>()); 131Assert.Equal("vite", scripts["dev"]?.GetValue<string>()); 132Assert.Equal("vite build", scripts["build"]?.GetValue<string>()); 135Assert.Equal("custom start", scripts["aspire:start"]?.GetValue<string>()); 136Assert.Equal("tsc -p tsconfig.apphost.json", scripts["aspire:build"]?.GetValue<string>()); 137Assert.Equal("tsc --watch -p tsconfig.apphost.json", scripts["aspire:dev"]?.GetValue<string>()); 138Assert.Equal("eslint apphost.ts", scripts["aspire:lint"]?.GetValue<string>()); 169Assert.Equal("npm run aspire:start", scripts["start"]?.GetValue<string>()); 170Assert.Equal("npm run aspire:lint", scripts["lint"]?.GetValue<string>()); 173Assert.Equal("vite", scripts["dev"]?.GetValue<string>()); 174Assert.Equal("vite build", scripts["build"]?.GetValue<string>()); 201Assert.Equal("yarn run aspire:start", scripts["start"]?.GetValue<string>()); 233Assert.Equal("node server.js", scripts["start"]?.GetValue<string>()); 234Assert.Equal("prettier --check .", scripts["lint"]?.GetValue<string>()); 235Assert.Equal("vite", scripts["dev"]?.GetValue<string>()); 236Assert.Equal("vite build", scripts["build"]?.GetValue<string>()); 239Assert.Equal("aspire run", scripts["aspire:start"]?.GetValue<string>()); 240Assert.Equal("eslint apphost.ts", scripts["aspire:lint"]?.GetValue<string>()); 241Assert.Equal("tsc -p tsconfig.apphost.json", scripts["aspire:build"]?.GetValue<string>()); 245Assert.Equal("node server.js", scripts["start"]?.GetValue<string>()); 246Assert.Equal("prettier --check .", scripts["lint"]?.GetValue<string>()); 276Assert.Equal("vite", scripts["dev"]?.GetValue<string>()); 277Assert.Equal("jest", scripts["test"]?.GetValue<string>()); 280Assert.Equal("aspire run", scripts["aspire:dev"]?.GetValue<string>()); 283Assert.Equal("tsc -p tsconfig.apphost.json", scripts["build"]?.GetValue<string>()); 286Assert.Equal("eslint apphost.ts", scripts["aspire:lint"]?.GetValue<string>()); 287Assert.Equal("npm run aspire:lint", scripts["lint"]?.GetValue<string>()); 369Assert.Equal("my-existing-app", json["name"]?.GetValue<string>()); 370Assert.Equal("3.0.0", json["version"]?.GetValue<string>()); 371Assert.Equal("My cool app", json["description"]?.GetValue<string>()); 372Assert.True(json["private"]?.GetValue<bool>()); 373Assert.Equal("module", json["type"]?.GetValue<string>()); 376Assert.Equal("^20.19.0 || ^22.13.0 || >=24", json["engines"]?["node"]?.GetValue<string>()); 444Assert.Equal("my-app", json["name"]?.GetValue<string>()); 518Assert.Equal("aspire run", scripts["dev"]?.GetValue<string>()); 519Assert.Equal("tsc -p tsconfig.apphost.json", scripts["build"]?.GetValue<string>()); 520Assert.Equal("eslint apphost.ts", scripts["lint"]?.GetValue<string>()); 573var scripts = json["scripts"]!.AsObject(); 576Assert.Equal("vite-project", json["name"]?.GetValue<string>()); 577Assert.Equal("1.0.0", json["version"]?.GetValue<string>()); 580Assert.Equal("vite", scripts["dev"]?.GetValue<string>()); 581Assert.Equal("vite build", scripts["build"]?.GetValue<string>()); 582Assert.Equal("eslint . --ext .ts,.tsx", scripts["lint"]?.GetValue<string>()); 583Assert.Equal("vite preview", scripts["preview"]?.GetValue<string>()); 586Assert.Equal("aspire run", scripts["aspire:dev"]?.GetValue<string>()); 587Assert.Equal("tsc -p tsconfig.apphost.json", scripts["aspire:build"]?.GetValue<string>()); 588Assert.Equal("eslint apphost.ts", scripts["aspire:lint"]?.GetValue<string>()); 591Assert.Equal("tsc --watch -p tsconfig.apphost.json", scripts["watch"]?.GetValue<string>()); 634Assert.Equal("vite", scripts["dev"]?.GetValue<string>()); 635Assert.Equal("vite build", scripts["build"]?.GetValue<string>()); 638Assert.Equal("aspire run", scripts["aspire:start"]?.GetValue<string>()); 639Assert.Equal("tsc -p tsconfig.apphost.json", scripts["aspire:build"]?.GetValue<string>()); 640Assert.Equal("tsc --watch -p tsconfig.apphost.json", scripts["aspire:dev"]?.GetValue<string>()); 641Assert.Equal("eslint apphost.ts", scripts["aspire:lint"]?.GetValue<string>()); 644Assert.Equal("npm run aspire:start", scripts["start"]?.GetValue<string>()); 645Assert.Equal("npm run aspire:lint", scripts["lint"]?.GetValue<string>()); 648Assert.Equal("vite", scripts["dev"]?.GetValue<string>()); 649Assert.Equal("vite build", scripts["build"]?.GetValue<string>()); 698Assert.Equal("tsc && vite build", scripts["build"]?.GetValue<string>()); 699Assert.Equal("concurrently \"tsc -w\" \"vite\"", scripts["dev"]?.GetValue<string>()); 700Assert.Equal("vitest run && echo 'done'", scripts["test"]?.GetValue<string>()); 701Assert.Equal("eslint . --ext .ts,.tsx && prettier --check .", scripts["lint"]?.GetValue<string>()); 702Assert.Equal("rm -rf dist && rm -rf node_modules/.cache", scripts["clean"]?.GetValue<string>()); 703Assert.Equal("node server.js | tee output.log", scripts["start"]?.GetValue<string>()); 1147Assert.Equal("^20.19.0 || ^22.13.0 || >=24", engines["node"]?.GetValue<string>()); 1175Assert.Equal("^20.19.0 || ^22.13.0 || >=24", engines["node"]?.GetValue<string>()); 1177Assert.Equal(">=8", engines["npm"]?.GetValue<string>()); 1200Assert.Equal("^20.19.0 || ^22.13.0 || >=24", engines["node"]?.GetValue<string>()); 1224var keywords = doc["keywords"]!.AsArray(); 1229var files = doc["files"]!.AsArray(); 1278Assert.Equal("my-project", doc["name"]!.GetValue<string>()); 1279Assert.Equal("ISC", doc["license"]!.GetValue<string>()); 1282Assert.NotNull(doc["keywords"]); 1283Assert.IsAssignableFrom<JsonArray>(doc["keywords"]); 1286var scripts = doc["scripts"]!.AsObject(); 1292Assert.NotNull(doc["dependencies"]?["vscode-jsonrpc"]); 1293Assert.NotNull(doc["devDependencies"]?["typescript"]); 1296Assert.Contains(">=24", doc["engines"]?["node"]?.GetValue<string>()); 1463Assert.Equal("vite-brownfield", doc["name"]!.GetValue<string>()); 1464Assert.Equal("2.0.0", doc["version"]!.GetValue<string>()); 1465Assert.Equal("module", doc["type"]!.GetValue<string>()); 1468var scripts = doc["scripts"]!.AsObject(); 1469Assert.Equal("vite", scripts["dev"]?.GetValue<string>()); 1470Assert.Equal("vite build", scripts["build"]?.GetValue<string>()); 1471Assert.Equal("vite preview", scripts["preview"]?.GetValue<string>()); 1474Assert.Equal("aspire run", scripts["aspire:start"]?.GetValue<string>()); 1475Assert.Equal("tsc -p tsconfig.apphost.json", scripts["aspire:build"]?.GetValue<string>()); 1476Assert.Equal("tsc --watch -p tsconfig.apphost.json", scripts["aspire:dev"]?.GetValue<string>()); 1477Assert.Equal("eslint apphost.ts", scripts["aspire:lint"]?.GetValue<string>()); 1492Assert.Contains(">=24", doc["engines"]?["node"]?.GetValue<string>());
Scaffolding\ScaffoldingServiceTests.cs (16)
127Assert.Equal("vitest", scripts["test"]?.GetValue<string>()); 128Assert.Equal("pnpm --dir apps/web/aspire-apphost run aspire:start", scripts["aspire:start"]?.GetValue<string>()); 129Assert.Equal("pnpm --dir apps/web/aspire-apphost run aspire:build", scripts["aspire:build"]?.GetValue<string>()); 130Assert.Equal("pnpm --dir apps/web/aspire-apphost run aspire:dev", scripts["aspire:dev"]?.GetValue<string>()); 153Assert.Equal("pnpm --dir aspire-apphost run aspire:start", scripts["aspire:start"]?.GetValue<string>()); 154Assert.Equal("pnpm --dir aspire-apphost run aspire:build", scripts["aspire:build"]?.GetValue<string>()); 155Assert.Equal("pnpm --dir aspire-apphost run aspire:dev", scripts["aspire:dev"]?.GetValue<string>()); 179Assert.Equal("custom-start", scripts["aspire:start"]?.GetValue<string>()); 180Assert.Equal("npm --prefix aspire-apphost run aspire:build", scripts["aspire:build"]?.GetValue<string>()); 181Assert.Equal("npm --prefix aspire-apphost run aspire:dev", scripts["aspire:dev"]?.GetValue<string>()); 308Assert.True(merged["editor.formatOnSave"]!.GetValue<bool>()); 310Assert.Equal("automatic", merged["java.compile.nullAnalysis.mode"]!.GetValue<string>()); 311Assert.Equal([".", ".aspire/modules"], merged["java.project.sourcePaths"]!.AsArray().Select(v => v!.GetValue<string>())); 333merged["java.project.sourcePaths"]!.AsArray().Select(v => v!.GetValue<string>())); 355Assert.Equal(4, merged["editor.tabSize"]!.GetValue<int>()); 356Assert.Equal(["."], merged["java.project.sourcePaths"]!.AsArray().Select(v => v!.GetValue<string>()));
Utils\DevCertsCheckTests.cs (6)
305var certificates = devCertsResult.Metadata["certificates"]!.AsArray(); 309Assert.Equal("AAAA1111BBBB2222", certNode["thumbprint"]!.GetValue<string>()); 310Assert.Equal(MinVersion, certNode["version"]!.GetValue<int>()); 311Assert.Equal("full", certNode["trustLevel"]!.GetValue<string>()); 312Assert.NotNull(certNode["notBefore"]); 313Assert.NotNull(certNode["notAfter"]);
Utils\EnvironmentCheckerTests.cs (1)
62Assert.Equal(0.1, timeoutResult.Metadata["timeoutSeconds"]!.GetValue<double>());
Aspire.Dashboard (10)
Model\GenAI\GenAISchemaHelpers.cs (6)
22Type = ParseTypeValue(schemaObj["type"]), 23Description = schemaObj["description"]?.GetValue<string>() 27if (schemaObj["properties"] is JsonObject propsObj) 40if (schemaObj["items"] is JsonObject itemsObj) 46if (schemaObj["required"] is JsonArray requiredArray) 59if (schemaObj["enum"] is JsonArray enumArray)
Model\GenAI\GenAIVisualizerDialogViewModel.cs (4)
104Type = obj["type"]?.GetValue<string>() ?? "function", 105Name = obj["name"]?.GetValue<string>(), 106Description = obj["description"]?.GetValue<string>() 110if (obj["parameters"] is JsonObject paramsObj)
Aspire.Dashboard.Tests (6)
Model\GenAIMessageParsingHelperTests.cs (4)
138Assert.Equal("Seattle", toolCallPart.Arguments["location"]!.GetValue<string>()); 153Assert.Equal("Seattle", toolCallPart.Arguments["location"]!.GetValue<string>()); 246Assert.Equal("latest news", serverToolCallPart.ServerToolCall["query"]!.GetValue<string>()); 261Assert.Equal("web_search", serverToolCallResponsePart.ServerToolCallResponse["type"]!.GetValue<string>());
Model\TelemetryExportServiceTests.cs (2)
1436Assert.Equal("localhost", connectionPropertiesObject["Host"]?.GetValue<string>()); 1437Assert.Equal("catalogdb", connectionPropertiesObject["DatabaseName"]?.GetValue<string>());
Aspire.Hosting (24)
Dashboard\DashboardEventHandlers.cs (7)
155if (configJson["runtimeOptions"]?.AsObject() is { } runtimeOptions && 156runtimeOptions["frameworks"]?.AsArray() is { } frameworks) 161frameworkObj["name"]?.GetValue<string>() is { } name && 162frameworkObj["version"]?.GetValue<string>() is { } version) 248if (configJson["runtimeOptions"]?.AsObject() is { } runtimeOptions && 249runtimeOptions["frameworks"]?.AsArray() is { } frameworks) 254frameworkObj["name"]?.GetValue<string>() is { } name)
Dcp\JsonPatch.cs (2)
32operation["op"] is not JsonValue operationValue || 33operation["path"] is not JsonValue pathValue ||
Devcontainers\DevcontainerSettingsWriter.cs (1)
148let l = attrs["label"]?.ToString()
Pipelines\Internal\FileDeploymentStateManager.cs (5)
442target[name] is JsonObject targetObject) 748var legacyFallbackDisabled = migrationState[LegacyFallbackDisabledProperty]?.GetValue<bool>() ?? false; 749var legacyStateSnapshot = migrationState[LegacyStateProperty] switch 755var claimedSectionNames = migrationState[ClaimedSectionsProperty] switch 761var currentState = migrationState[CurrentStateProperty] switch
Publishing\ContainerRuntimeBase.cs (9)
195ReadStringArray(root["Entrypoint"]), 196ReadStringArray(root["Cmd"]), 197root["WorkingDir"]?.GetValue<string>()); 251if (TryCreateManifest(item["Descriptor"] as JsonObject, operatingSystem, architecture, out var manifest)) 265if (manifestObject["manifests"] is JsonArray manifests) 278var descriptor = manifestObject["Descriptor"] as JsonObject ?? 279manifestObject["descriptor"] as JsonObject ?? 307var platform = descriptor["platform"] as JsonObject; 310var digest = descriptor["digest"]?.GetValue<string>();
Aspire.Hosting.Azure (73)
AzureEnvironmentResource.cs (2)
232var resourceGroupName = azureStateSection.Data["ResourceGroup"]?.ToString(); 233var subscriptionId = azureStateSection.Data["SubscriptionId"]?.ToString();
AzureProvisioningController.cs (23)
1857var subscriptionId = section.Data["SubscriptionId"]?.GetValue<string>(); 1858var resourceGroupName = section.Data["ResourceGroup"]?.GetValue<string>(); 2510var deploymentId = section.Data["Id"]?.GetValue<string>(); 2514var outputs = ParseDeploymentStateJson(resource.Name, "Outputs", section.Data["Outputs"]?.GetValue<string>()); 2524["locationOverride"] = section.Data[LocationOverrideKey]?.GetValue<string>(), 2525["checksum"] = section.Data["CheckSum"]?.GetValue<string>(), 2527["scope"] = ParseDeploymentStateJson(resource.Name, "Scope", section.Data["Scope"]?.GetValue<string>()) 2533if (section.Data[BicepProvisioner.DeploymentStateProvisioningStateKey]?.GetValue<string>() is { Length: > 0 } provisioningState) 2745if (section.Data[LocationOverrideKey]?.GetValue<string>() is { Length: > 0 } locationOverride) 2764if (section.Data[LocationOverrideKey]?.GetValue<string>() is { Length: > 0 } locationOverride) 3092=> section.Data["Id"]?.GetValue<string>() is { Length: > 0 } deploymentId ? deploymentId : null; 3096section.Data[BicepProvisioner.DeploymentStateProvisioningStateKey]?.GetValue<string>(), 3157if (section.Data["Parameters"]?.GetValue<string>() is not { Length: > 0 } parametersJson) 3188=> section.Data[LocationOverrideKey]?.GetValue<string>() is { Length: > 0 } locationOverride ? locationOverride : null; 3371section.Data["SubscriptionId"]?.GetValue<string>() ?? provisionerOptions.Value.SubscriptionId ?? configuration["Azure:SubscriptionId"], 3372section.Data["ResourceGroup"]?.GetValue<string>() ?? provisionerOptions.Value.ResourceGroup ?? configuration["Azure:ResourceGroup"], 3373section.Data["Location"]?.GetValue<string>() ?? provisionerOptions.Value.Location ?? configuration["Azure:Location"], 3374section.Data["TenantId"]?.GetValue<string>() ?? provisionerOptions.Value.TenantId ?? configuration["Azure:TenantId"], 3375section.Data["Tenant"]?.GetValue<string>()); 3393if (section.Data["Outputs"]?.GetValue<string>() is not { Length: > 0 } outputsJson) 3512if (section.Data[LocationOverrideKey]?.GetValue<string>() is { Length: > 0 } locationOverride) 3519if (section.Data["Parameters"]?.GetValue<string>() is not { Length: > 0 } parametersJson) 3815section.Data[BicepProvisioner.DeploymentStateProvisioningStateKey]?.GetValue<string>(),
AzureProvisioningFailureDetails.cs (21)
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) 622if (errorObj["details"] is JsonArray detailsArray) 674var code = StringUtils.FirstNonEmpty(errorObj["code"]?.ToString(), errorObj["errorCode"]?.ToString()); 675var message = StringUtils.FirstNonEmpty(errorObj["message"]?.ToString(), errorObj["errorMessage"]?.ToString()); 676var operation = StringUtils.FirstNonEmpty(errorObj["operation"]?.ToString(), errorObj["target"]?.ToString()); 678errorObj["resourceType"]?.ToString(), 680var resourceName = StringUtils.FirstNonEmpty(errorObj["resourceName"]?.ToString(), targetResource?.ResourceName); 681var targetResourceId = StringUtils.FirstNonEmpty(errorObj["targetResourceId"]?.ToString(), targetResource?.Id); 712if (responseObj["properties"] is not JsonObject propertiesObj || 713propertiesObj["targetResource"] is not JsonObject targetResourceObj) 718var id = targetResourceObj["id"]?.ToString(); 719var resourceName = targetResourceObj["resourceName"]?.ToString(); 720var resourceType = targetResourceObj["resourceType"]?.ToString();
Provisioning\BicepUtilities.cs (2)
171if (section.Data[DeploymentStateParametersKey]?.GetValue<string>() is not { Length: > 0 } jsonString) 179var scope = section.Data[DeploymentStateScopeKey]?.GetValue<string>() is { Length: > 0 } scopeString
Provisioning\Internal\RunModeProvisioningContextProvider.cs (5)
237if (data["Location"]?.GetValue<string>() is { Length: > 0 } location) 242if (data["SubscriptionId"]?.GetValue<string>() is { Length: > 0 } subscriptionId) 247if (data["ResourceGroup"]?.GetValue<string>() is { Length: > 0 } resourceGroup) 252if (data["TenantId"]?.GetValue<string>() is { Length: > 0 } tenantId) 257if (TryGetBoolean(data["AllowResourceGroupCreation"]) is bool allowResourceGroupCreation)
Provisioning\JsonExtensions.cs (2)
15var node = jsonObj[key]; 26node = jsonObj[key];
Provisioning\Provisioners\BicepProvisioner.cs (18)
60if (stateSection.Data[DeploymentStateProvisioningStateKey]?.GetValue<string>() is { Length: > 0 } provisioningState && 68var configCheckSum = stateSection.Data[BicepUtilities.DeploymentStateChecksumKey]?.GetValue<string>(); 84if (stateSection.Data[BicepUtilities.DeploymentStateOutputsKey]?.GetValue<string>() is { Length: > 0 } outputJson) 119if (stateSection.Data[BicepUtilities.DeploymentStateIdKey]?.GetValue<string>() is { Length: > 0 } configuredDeploymentId && 187stateSection.Data[BicepUtilities.DeploymentStateIdKey]?.GetValue<string>() is not { Length: > 0 } deploymentId || 358stateSection.Data[BicepUtilities.DeploymentStateChecksumKey]?.GetValue<string>() is not { Length: > 0 } checksum) 375var locationOverride = stateSection.Data[AzureProvisioningController.LocationOverrideKey]?.GetValue<string>(); 455var locationOverride = stateSection.Data[AzureProvisioningController.LocationOverrideKey]?.GetValue<string>(); 476if (stateSection.Data[key]?.GetValue<string>() is not { Length: > 0 } json) 495stateSection.Data[DeploymentStateProvisioningStateKey]?.GetValue<string>(), 622var canceledLocationOverride = canceledStateSection.Data[AzureProvisioningController.LocationOverrideKey]?.GetValue<string>(); 679locationOverride = stateSection.Data[AzureProvisioningController.LocationOverrideKey]?.GetValue<string>(); 797locationOverride = stateSection.Data[AzureProvisioningController.LocationOverrideKey]?.GetValue<string>(); 855var cachedDeploymentId = stateSection.Data[BicepUtilities.DeploymentStateIdKey]?.GetValue<string>(); 856var cachedChecksum = stateSection.Data[BicepUtilities.DeploymentStateChecksumKey]?.GetValue<string>(); 1487section.Data[key]?.GetValue<string>() is { Length: > 0 } value ? value : null; 1491if (section.Data[AzureProvisioningController.LocationOverrideKey]?.GetValue<string>() is { Length: > 0 } locationOverride) 1496if (section.Data[BicepUtilities.DeploymentStateParametersKey]?.GetValue<string>() is { Length: > 0 } parametersJson)
Aspire.Hosting.Azure.Kubernetes (2)
AzureKubernetesEnvironmentResource.AksPipeline.cs (2)
615return (azureState.Data["SubscriptionId"]?.ToString(), azureState.Data["ResourceGroup"]?.ToString());
Aspire.Hosting.Azure.Sandboxes (36)
AzureSandboxContainerDeployment.cs (32)
247var previousOwnerId = previousStateSection.Data["OwnerId"]?.GetValue<string>(); 377var pendingSecurityCleanup = previousStateSection.Data["PendingSecurityCleanup"]?.GetValue<bool>() == true; 481if (portStates.FirstOrDefault() is JsonObject firstPort && firstPort["Url"]?.GetValue<string>() is { } publicUrl) 1280var ownerId = stateSection.Data["OwnerId"]?.GetValue<string>(); 1396if (stateSection.Data["OwnerId"]?.GetValue<string>() is { Length: > 0 } ownerId && 1412stateSection.Data["OwnerId"]?.GetValue<string>())) 1515var sandboxId = stateSection.Data["SandboxId"]?.GetValue<string>(); 1528var diskImageId = stateSection.Data["DiskImageId"]?.GetValue<string>(); 1793if (stateSection.Data["ResourceName"]?.GetValue<string>() is { Length: > 0 } resourceName) 1853var ownerIds = stateSection.Data["PendingOwnerCleanupIds"] is JsonArray pendingOwnerIds 1856if (stateSection.Data["OwnerId"]?.GetValue<string>() is { Length: > 0 } previousOwnerId && 1890if (stateSection.Data["OwnerId"]?.GetValue<string>() is { Length: > 0 } previousOwnerId && 1903stateSection.Data["PendingLegacyDeploymentCleanup"]?.DeepClone() as JsonObject; 1993previousStateSection.Data["HasRuntimeEnvironmentConfiguration"]?.GetValue<bool>() == true || 1995previousStateSection.Data["HasRuntimeCommandConfiguration"]?.GetValue<bool>() == true) 2000if (previousStateSection.Data["PendingSecurityCleanup"]?.GetValue<bool>() == true) 2005var previousFingerprint = previousStateSection.Data["EndpointSecurityFingerprint"]?.GetValue<string>(); 2034var subscriptionId = stateSection.Data["SubscriptionId"]?.GetValue<string>(); 2035var resourceGroup = stateSection.Data["ResourceGroup"]?.GetValue<string>(); 2036var location = stateSection.Data["Location"]?.GetValue<string>(); 2037var sandboxGroup = stateSection.Data["SandboxGroup"]?.GetValue<string>(); 2058!string.IsNullOrWhiteSpace(stateSection.Data["OwnerId"]?.GetValue<string>()) || 2059!string.IsNullOrWhiteSpace(stateSection.Data["SandboxId"]?.GetValue<string>()) || 2060!string.IsNullOrWhiteSpace(stateSection.Data["DiskImageId"]?.GetValue<string>()); 2075if (stateSection.Data["Ports"] is not JsonArray ports) 2082if (port["Url"]?.GetValue<string>() is { Length: > 0 } url) 2098if (previousStateSection.Data["DeployId"]?.GetValue<string>() is { Length: > 0 } previousDeployId) 2113if (previousStateSection.Data[stateKey]?.GetValue<string>() is { Length: > 0 } previousId) 2123if (stateSection.Data["Ports"] is JsonArray ports) 2127if (port["Port"]?.GetValue<int>() is { } portNumber) 2136if (stateSection.Data["Port"]?.GetValue<int>() is { } legacyPort) 2267var value = section.Data[name]?.GetValue<string>();
AzureSandboxEndpointPropertyValueProvider.cs (4)
123if (stateSection.Data["Ports"] is not JsonArray ports) 131if (port["Port"]?.GetValue<int>() == _sandboxEndpoint.TargetPort) 136if (string.Equals(port["Name"]?.GetValue<string>(), _sandboxEndpoint.Name, StringComparison.Ordinal)) 147url = port["Url"]?.GetValue<string>();
Aspire.Hosting.Azure.Tests (195)
AzureBicepProvisionerTests.cs (21)
1021Assert.Equal("westus3", section.Data[AzureProvisioningController.LocationOverrideKey]?.GetValue<string>()); 1083Assert.Equal("/subscriptions/12345678-1234-1234-1234-123456789012/resourceGroups/test-rg/providers/Microsoft.Resources/deployments/storage2", section.Data["Id"]?.GetValue<string>()); 1084Assert.Equal(BicepProvisioner.DeploymentStateProvisioningStateRunning, section.Data[BicepProvisioner.DeploymentStateProvisioningStateKey]?.GetValue<string>()); 1338Assert.Equal(BicepProvisioner.DeploymentStateProvisioningStateCanceled, section.Data[BicepProvisioner.DeploymentStateProvisioningStateKey]?.GetValue<string>()); 1371Assert.Equal(BicepProvisioner.DeploymentStateProvisioningStateCanceled, section.Data[BicepProvisioner.DeploymentStateProvisioningStateKey]?.GetValue<string>()); 1403Assert.Equal(BicepProvisioner.DeploymentStateProvisioningStateCanceled, section.Data[BicepProvisioner.DeploymentStateProvisioningStateKey]?.GetValue<string>()); 1437Assert.Null(section.Data[BicepProvisioner.DeploymentStateProvisioningStateKey]); 1438Assert.Equal(deploymentId, section.Data[BicepUtilities.DeploymentStateIdKey]?.GetValue<string>()); 1496Assert.Equal(ResourcesProvisioningState.Failed.ToString(), section.Data[BicepProvisioner.DeploymentStateProvisioningStateKey]?.GetValue<string>()); 1597Assert.Null(section.Data[BicepProvisioner.DeploymentStateProvisioningStateKey]); 1598Assert.Equal(deploymentId, section.Data[BicepUtilities.DeploymentStateIdKey]?.GetValue<string>()); 1599var outputs = JsonNode.Parse(section.Data[BicepUtilities.DeploymentStateOutputsKey]!.GetValue<string>())!.AsObject(); 1600Assert.Equal("https://storage.blob.core.windows.net/", outputs["blobEndpoint"]?["value"]?.GetValue<string>()); 1678Assert.Equal(BicepProvisioner.DeploymentStateProvisioningStateRunning, section.Data[BicepProvisioner.DeploymentStateProvisioningStateKey]?.GetValue<string>()); 1679Assert.Equal(deploymentId, section.Data[BicepUtilities.DeploymentStateIdKey]?.GetValue<string>()); 1707Assert.Equal(BicepProvisioner.DeploymentStateProvisioningStateRunning, section.Data[BicepProvisioner.DeploymentStateProvisioningStateKey]?.GetValue<string>()); 1708Assert.Equal(deploymentId, section.Data[BicepUtilities.DeploymentStateIdKey]?.GetValue<string>()); 1733Assert.Equal(BicepProvisioner.DeploymentStateProvisioningStateFailed, section.Data[BicepProvisioner.DeploymentStateProvisioningStateKey]?.GetValue<string>()); 1758Assert.Equal(BicepProvisioner.DeploymentStateProvisioningStateCanceled, section.Data[BicepProvisioner.DeploymentStateProvisioningStateKey]?.GetValue<string>()); 1791Assert.Null(section.Data[BicepProvisioner.DeploymentStateProvisioningStateKey]); 1792Assert.Equal(deploymentId, section.Data[BicepUtilities.DeploymentStateIdKey]?.GetValue<string>());
AzureEnvironmentResourceExtensionsTests.cs (145)
368Assert.Contains("orphaned", resultData["warning"]?.GetValue<string>(), StringComparison.Ordinal); 369var recommendedActions = Assert.IsType<JsonArray>(resultData["recommendedActions"]); 762Assert.Equal(1, data["resourceCount"]?.GetValue<int>()); 842Assert.Equal(AzureProvisioningController.GetAzureResourceCommandName, data["command"]?.GetValue<string>()); 843Assert.Equal("storage", data["resourceName"]?.GetValue<string>()); 844Assert.Equal("westus2", data["azureLocation"]?.GetValue<string>()); 845Assert.Equal("westus3", data["location"]?.GetValue<string>()); 846Assert.Equal("westus3", data["effectiveLocation"]?.GetValue<string>()); 850var azureContext = Assert.IsType<JsonObject>(data["azureContext"]); 851Assert.Equal(subscriptionId, azureContext["subscriptionId"]?.GetValue<string>()); 852Assert.Equal(tenantId, azureContext["tenantId"]?.GetValue<string>()); 853Assert.Equal(resourceGroup, azureContext["resourceGroup"]?.GetValue<string>()); 854Assert.Equal("westus2", azureContext["location"]?.GetValue<string>()); 856var deployment = Assert.IsType<JsonObject>(data["deployment"]); 857Assert.True(deployment["hasState"]?.GetValue<bool>()); 858Assert.Equal(deploymentId, deployment["deploymentId"]?.GetValue<string>()); 859Assert.Equal(resourceId, deployment["resourceId"]?.GetValue<string>()); 860Assert.Equal("westus3", deployment["locationOverride"]?.GetValue<string>()); 861Assert.Equal("checksum", deployment["checksum"]?.GetValue<string>()); 862Assert.Equal(BicepProvisioner.DeploymentStateProvisioningStateRunning, deployment["provisioningState"]?.GetValue<string>()); 863Assert.Contains("/DeploymentDetailsBlade/", deployment["deploymentPortalUrl"]?.GetValue<string>()); 864Assert.Contains("/resource/subscriptions/", deployment["resourcePortalUrl"]?.GetValue<string>()); 866var outputs = Assert.IsType<JsonObject>(deployment["outputs"]); 867Assert.Equal("https://storage.blob.core.windows.net/", outputs["blobEndpoint"]?["value"]?.GetValue<string>()); 869var scope = Assert.IsType<JsonObject>(deployment["scope"]); 870Assert.Equal(resourceGroup, scope["resourceGroup"]?.GetValue<string>()); 872var live = Assert.IsType<JsonObject>(data["live"]); 873Assert.True(live["checked"]?.GetValue<bool>()); 874Assert.True(live["exists"]?.GetValue<bool>()); 925var live = Assert.IsType<JsonObject>(data["live"]); 926Assert.True(live["checked"]?.GetValue<bool>()); 927Assert.False(live["exists"]?.GetValue<bool>()); 928Assert.Equal("missing-live-resource", live["reason"]?.GetValue<string>()); 929Assert.Equal("azure", live["source"]?.GetValue<string>()); 930Assert.Equal("missing-live-resource", live["code"]?.GetValue<string>()); 931Assert.Contains("resource was not found in Azure", live["message"]?.GetValue<string>(), StringComparison.Ordinal); 932var recommendedActions = Assert.IsType<JsonArray>(live["recommendedActions"]); 987Assert.Equal("Microsoft.Storage/storageAccounts", json["resourceType"]?.GetValue<string>()); 988Assert.Equal("storage", json["resourceName"]?.GetValue<string>()); 989Assert.Equal(targetResourceId, json["targetResourceId"]?.GetValue<string>()); 1195var deployment = Assert.IsType<JsonObject>(data["deployment"]); 1196Assert.True(deployment["hasState"]?.GetValue<bool>()); 1197Assert.Null(deployment["resourceId"]); 1199var live = Assert.IsType<JsonObject>(data["live"]); 1200Assert.False(live["checked"]?.GetValue<bool>()); 1201Assert.Null(live["exists"]); 1202Assert.Equal("missing-resource-id", live["reason"]?.GetValue<string>()); 1203Assert.Equal("aspire", live["source"]?.GetValue<string>()); 1204Assert.Equal("missing-resource-id", live["code"]?.GetValue<string>()); 1205Assert.Contains("cached deployment state does not contain a resource ID", live["message"]?.GetValue<string>(), StringComparison.Ordinal); 1206var recommendedActions = Assert.IsType<JsonArray>(live["recommendedActions"]); 1258var live = Assert.IsType<JsonObject>(data["live"]); 1259Assert.True(live["checked"]?.GetValue<bool>()); 1260Assert.Null(live["exists"]); 1261Assert.Equal("request-failed", live["reason"]?.GetValue<string>()); 1262Assert.Equal("azure", live["source"]?.GetValue<string>()); 1263Assert.Equal(403, live["status"]?.GetValue<int>()); 1264Assert.Equal("Azure", live["provider"]?.GetValue<string>()); 1265Assert.Equal(403, live["httpStatus"]?.GetValue<int>()); 1266Assert.Equal("AuthorizationFailed", live["errorCode"]?.GetValue<string>()); 1267Assert.Equal("live-resource-check", live["operation"]?.GetValue<string>()); 1268Assert.Contains("Forbidden", live["message"]?.GetValue<string>(), StringComparison.Ordinal); 1319var live = Assert.IsType<JsonObject>(data["live"]); 1320Assert.True(live["checked"]?.GetValue<bool>()); 1321Assert.Null(live["exists"]); 1322Assert.Equal("credential-unavailable", live["reason"]?.GetValue<string>()); 1323Assert.Contains("Credential unavailable", live["message"]?.GetValue<string>(), StringComparison.Ordinal); 1383Assert.Equal(BicepProvisioner.DeploymentStateProvisioningStateCanceled, storageSection.Data[BicepProvisioner.DeploymentStateProvisioningStateKey]?.GetValue<string>()); 1517Assert.Equal(BicepProvisioner.DeploymentStateProvisioningStateCanceled, storageSection.Data[BicepProvisioner.DeploymentStateProvisioningStateKey]?.GetValue<string>()); 1721Assert.Equal(BicepProvisioner.DeploymentStateProvisioningStateSucceeded, storageSection.Data[BicepProvisioner.DeploymentStateProvisioningStateKey]?.GetValue<string>()); 1811Assert.Equal(2, resultData["deletedResourceCount"]?.GetValue<int>()); 1812var resultResourceIds = Assert.IsType<JsonArray>(resultData["deletedResourceIds"]); 1816Assert.Equal("westus3", storageSection.Data[AzureProvisioningController.LocationOverrideKey]?.GetValue<string>()); 1821Assert.Equal("storage2-deployment", storage2Section.Data["Id"]?.GetValue<string>()); 1902Assert.Equal(1, resultData["deletedResourceCount"]?.GetValue<int>()); 2130Assert.Equal("storage2-deployment", storage2Section.Data["Id"]?.GetValue<string>()); 2195Assert.Equal("storage2-deployment", storage2Section.Data["Id"]?.GetValue<string>()); 2804Assert.Equal("westus2", storageSection.Data[AzureProvisioningController.LocationOverrideKey]?.GetValue<string>()); 2851Assert.Equal("westus3", storageSection.Data[AzureProvisioningController.LocationOverrideKey]?.GetValue<string>()); 2854Assert.Equal(1, data["schemaVersion"]?.GetValue<int>()); 2855Assert.Equal(AzureProvisioningController.ChangeResourceLocationCommandName, data["command"]?.GetValue<string>()); 2856Assert.Equal("storage", data["resourceName"]?.GetValue<string>()); 2857Assert.Equal("westus3", data["location"]?.GetValue<string>()); 2858Assert.Equal("westus3", data["effectiveLocation"]?.GetValue<string>()); 2859Assert.Equal("eastus", data["azureLocation"]?.GetValue<string>()); 2860var azureContext = Assert.IsType<JsonObject>(data["azureContext"]); 2861Assert.Equal("eastus", azureContext["location"]?.GetValue<string>()); 2909Assert.Equal("westus3", bicepSection.Data[AzureProvisioningController.LocationOverrideKey]?.GetValue<string>()); 3235Assert.Equal("westus3", storageSection.Data[AzureProvisioningController.LocationOverrideKey]?.GetValue<string>()); 3297Assert.Equal("westus3", storageSection.Data[AzureProvisioningController.LocationOverrideKey]?.GetValue<string>()); 3362Assert.Equal("westus3", storageSection.Data[AzureProvisioningController.LocationOverrideKey]?.GetValue<string>()); 3416Assert.Equal("12345678-1234-1234-1234-123456789012", azureSection.Data["SubscriptionId"]?.GetValue<string>()); 3417Assert.Equal("westus2", azureSection.Data["Location"]?.GetValue<string>()); 3418Assert.Equal("test-rg", azureSection.Data["ResourceGroup"]?.GetValue<string>()); 3419Assert.Equal("87654321-4321-4321-4321-210987654321", azureSection.Data["TenantId"]?.GetValue<string>()); 3462Assert.Equal("12345678-1234-1234-1234-123456789012", azureSection.Data["SubscriptionId"]?.GetValue<string>()); 3463Assert.Equal("westus3", azureSection.Data["Location"]?.GetValue<string>()); 3464Assert.Equal("cli-rg-é", azureSection.Data["ResourceGroup"]?.GetValue<string>()); 3465Assert.Equal("87654321-4321-4321-4321-210987654321", azureSection.Data["TenantId"]?.GetValue<string>()); 3468Assert.Equal(1, data["schemaVersion"]?.GetValue<int>()); 3469Assert.Equal(AzureProvisioningController.ChangeAzureContextCommandName, data["command"]?.GetValue<string>()); 3470Assert.Equal("12345678-1234-1234-1234-123456789012", data["subscriptionId"]?.GetValue<string>()); 3471Assert.Equal("87654321-4321-4321-4321-210987654321", data["tenantId"]?.GetValue<string>()); 3472Assert.Equal("cli-rg-é", data["resourceGroup"]?.GetValue<string>()); 3473Assert.Equal("westus3", data["azureLocation"]?.GetValue<string>()); 3474var azureContext = Assert.IsType<JsonObject>(data["azureContext"]); 3475Assert.Equal("12345678-1234-1234-1234-123456789012", azureContext["subscriptionId"]?.GetValue<string>()); 3476Assert.Equal("87654321-4321-4321-4321-210987654321", azureContext["tenantId"]?.GetValue<string>()); 3477Assert.Equal("cli-rg-é", azureContext["resourceGroup"]?.GetValue<string>()); 3478Assert.Equal("westus3", azureContext["location"]?.GetValue<string>()); 3482Assert.Equal(1, data["resourceCount"]?.GetValue<int>()); 3535Assert.Null(data["tenantId"]); 3583Assert.Equal("westus2", azureSection.Data["Location"]?.GetValue<string>()); 3678Assert.Equal("westus3", storage2Section.Data[AzureProvisioningController.LocationOverrideKey]?.GetValue<string>()); 3724Assert.Equal("westus3", storage2Section.Data[AzureProvisioningController.LocationOverrideKey]?.GetValue<string>()); 3783Assert.Equal("westus3", storage2Section.Data[AzureProvisioningController.LocationOverrideKey]?.GetValue<string>()); 4026Assert.False(data["success"]?.GetValue<bool>()); 4027var diagnostics = Assert.IsType<JsonArray>(data["diagnostics"]); 4029Assert.Equal("Microsoft.KeyVault", diagnostic["provider"]?.GetValue<string>()); 4030Assert.Equal("Microsoft.KeyVault/vaults", diagnostic["resourceType"]?.GetValue<string>()); 4031Assert.Equal("kv-test", diagnostic["resourceName"]?.GetValue<string>()); 4032Assert.Equal(keyVaultResourceId, diagnostic["targetResourceId"]?.GetValue<string>()); 4033Assert.Equal(AzureProvisioningFailureDetails.KeyVaultDeletedStateTombstoneNotFoundReason, diagnostic["errorCode"]?.GetValue<string>()); 4034Assert.Equal(409, diagnostic["httpStatus"]?.GetValue<int>()); 4035Assert.Contains("deleted vault was not found", diagnostic["errorMessage"]?.GetValue<string>(), StringComparison.Ordinal); 4036var recommendedActions = Assert.IsType<JsonArray>(diagnostic["recommendedActions"]); 4233Assert.False(data["success"]?.GetValue<bool>()); 4234Assert.Equal("failed", data["status"]?.GetValue<string>()); 4235var diagnostics = Assert.IsType<JsonArray>(data["diagnostics"]); 4237Assert.Equal("azure", diagnostic["source"]?.GetValue<string>()); 4238Assert.Equal("Microsoft.ManagedIdentity", diagnostic["provider"]?.GetValue<string>()); 4239Assert.Equal("Microsoft.ManagedIdentity/userAssignedIdentities", diagnostic["resourceType"]?.GetValue<string>()); 4240Assert.Equal(400, diagnostic["httpStatus"]?.GetValue<int>()); 4241Assert.Equal("LocationNotAvailableForResourceType", diagnostic["errorCode"]?.GetValue<string>()); 4242Assert.Equal("provision", diagnostic["operation"]?.GetValue<string>()); 4243var resultRecommendedActions = Assert.IsType<JsonArray>(diagnostic["recommendedActions"]); 4539Assert.Equal("12345678-1234-1234-1234-123456789012", azureSection.Data["SubscriptionId"]?.GetValue<string>()); 4540Assert.Equal("westus2", azureSection.Data["Location"]?.GetValue<string>()); 4541Assert.Equal("test-rg", azureSection.Data["ResourceGroup"]?.GetValue<string>()); 4542Assert.Equal("87654321-4321-4321-4321-210987654321", azureSection.Data["TenantId"]?.GetValue<string>()); 4688Assert.Equal("storage-deployment", storageSection.Data["Id"]?.GetValue<string>()); 5555azureSection.Data["SubscriptionId"]?.GetValue<string>(), 5556azureSection.Data["ResourceGroup"]?.GetValue<string>(), 5557azureSection.Data["Location"]?.GetValue<string>(), 5558azureSection.Data["TenantId"]?.GetValue<string>());
AzureEventHubsExtensionsTests.cs (1)
400document["UserConfig"]!["LoggingConfig"] = new JsonObject { ["Type"] = "Console" };
AzureInfrastructureExtensionsTests.cs (2)
28Assert.Equal("azure.bicep.v0", manifest["type"]?.ToString()); 29Assert.Equal("infrastructure1.module.bicep", manifest["path"]?.ToString());
AzureSandboxesTests.cs (1)
345Assert.Equal("existing-rg", rolesManifest["scope"]?["resourceGroup"]?.GetValue<string>());
AzureServiceBusExtensionsTests.cs (1)
512document["UserConfig"]!["Logging"] = new JsonObject { ["Type"] = "Console" };
BicepUtilitiesTests.cs (16)
26Assert.Equal("david", parameters["name"]?["value"]?.ToString()); 62Assert.Equal("john", parameters["name"]?["value"]?.ToString()); 63Assert.Equal(20, parameters["age"]?["value"]?.GetValue<int>()); 64Assert.Equal(["a", "b", "c"], parameters["values"]?["value"]?.AsArray()?.Select(v => v?.ToString()) ?? []); 65Assert.Equal("connection string", parameters["conn"]?["value"]?.ToString()); 66Assert.Equal("value", parameters["jsonObj"]?["value"]?["key"]?.ToString()); 67Assert.Equal("paramValue", parameters["param"]?["value"]?.ToString()); 68Assert.Equal("paramValue/1", parameters["expr"]?["value"]?.ToString()); 69Assert.Equal("http://localhost:1023", parameters["endpoint"]?["value"]?.ToString()); 343Assert.Equal("test-rg", scope["resourceGroup"]?.ToString()); 358Assert.Equal("test-rg", scope["resourceGroup"]?.ToString()); 359Assert.Equal("12345678-1234-1234-1234-123456789012", scope["subscription"]?.ToString()); 374Assert.Equal("12345678-1234-1234-1234-123456789012", scope["subscription"]?.ToString()); 393Assert.Equal("12345678-1234-1234-1234-123456789012", scope["subscription"]?.ToString()); 408Assert.Equal("current", scope["tenant"]?.ToString()); 422Assert.Null(scope["resourceGroup"]?.AsValue().GetValue<object>());
JsonExtensionsTests.cs (7)
23Assert.Equal("TestValue", retrievedNode["TestProperty"]!.GetValue<string>()); 37Assert.Same(rootJson["NewProperty"], newNode); 53Assert.NotNull(rootJson["Level1"]); 54Assert.NotNull(rootJson["Level1"]!["Level2"]); 55Assert.NotNull(rootJson["Level1"]!["Level2"]!["Level3"]); 56Assert.NotNull(rootJson["Level1"]!["Level2"]!["Level3"]!["Level4"]); 57Assert.Same(deeply, rootJson["Level1"]!["Level2"]!["Level3"]!["Level4"]);
ProvisioningContextTests.cs (1)
210Assert.Equal("test-id", loadedSection.Data["SubscriptionId"]?.ToString());
Aspire.Hosting.CodeGeneration.TypeScript (2)
TypeScriptLanguageSupport.cs (2)
193var existingVersion = GetStringValue(section[packageName]); 208if (parent[propertyName] is JsonObject obj)
Aspire.Hosting.CodeGeneration.TypeScript.Tests (60)
AtsTypeScriptCodeGeneratorTests.cs (3)
42Assert.Equal("aspire-host", packageJson["name"]?.GetValue<string>()); 43Assert.Equal("module", packageJson["type"]?.GetValue<string>()); 44Assert.NotNull(packageJson["dependencies"]?["vscode-jsonrpc"]);
TypeScriptLanguageSupportTests.cs (57)
31var scripts = packageJson["scripts"]!.AsObject(); 32var devDependencies = packageJson["devDependencies"]!.AsObject(); 34Assert.Equal("brownfieldapp", packageJson["name"]?.GetValue<string>()); 35Assert.Equal("1.0.0", packageJson["version"]?.GetValue<string>()); 36Assert.True(packageJson["private"]?.GetValue<bool>()); 37Assert.Equal("module", packageJson["type"]?.GetValue<string>()); 38Assert.Equal("aspire run", scripts["aspire:start"]?.GetValue<string>()); 39Assert.Equal("tsc -p tsconfig.apphost.json", scripts["aspire:build"]?.GetValue<string>()); 40Assert.Equal("tsc --watch -p tsconfig.apphost.json", scripts["aspire:dev"]?.GetValue<string>()); 41Assert.Equal("eslint apphost.mts", scripts["aspire:lint"]?.GetValue<string>()); 42Assert.Equal("npm run aspire:lint", scripts["lint"]?.GetValue<string>()); 43Assert.Equal("npm run aspire:lint", scripts["predev"]?.GetValue<string>()); 44Assert.Equal("npm run aspire:start", scripts["dev"]?.GetValue<string>()); 45Assert.Equal("npm run aspire:lint", scripts["prebuild"]?.GetValue<string>()); 46Assert.Equal("npm run aspire:build", scripts["build"]?.GetValue<string>()); 47Assert.Equal("npm run aspire:dev", scripts["watch"]?.GetValue<string>()); 48Assert.Equal("^4.21.0", devDependencies["tsx"]?.GetValue<string>()); 49Assert.Equal("^5.9.3", devDependencies["typescript"]?.GetValue<string>()); 50Assert.Equal("^10.0.3", devDependencies["eslint"]?.GetValue<string>()); 51Assert.Equal("^8.57.1", devDependencies["typescript-eslint"]?.GetValue<string>()); 53var engines = packageJson["engines"]!.AsObject(); 54Assert.Equal("^20.19.0 || ^22.13.0 || >=24", engines["node"]?.GetValue<string>()); 63Assert.Equal("./dist/apphost", tsConfig["compilerOptions"]?["outDir"]?.GetValue<string>()); 99var scripts = packageJson["scripts"]!.AsObject(); 100var dependencies = packageJson["dependencies"]!.AsObject(); 101var devDependencies = packageJson["devDependencies"]!.AsObject(); 105Assert.Null(packageJson["name"]); 106Assert.Null(packageJson["version"]); 107Assert.Null(packageJson["type"]); 108Assert.Null(packageJson["private"]); 111Assert.Equal("aspire run", scripts["aspire:start"]?.GetValue<string>()); 112Assert.Equal("tsc -p tsconfig.apphost.json", scripts["aspire:build"]?.GetValue<string>()); 113Assert.Equal("tsc --watch -p tsconfig.apphost.json", scripts["aspire:dev"]?.GetValue<string>()); 114Assert.Equal("eslint apphost.mts", scripts["aspire:lint"]?.GetValue<string>()); 120Assert.Equal("^8.2.0", dependencies["vscode-jsonrpc"]?.GetValue<string>()); 121Assert.Equal("^4.21.0", devDependencies["tsx"]?.GetValue<string>()); 122Assert.Equal("^22.0.0", devDependencies["@types/node"]?.GetValue<string>()); 123Assert.Equal("^3.1.14", devDependencies["nodemon"]?.GetValue<string>()); 124Assert.Equal("^5.9.3", devDependencies["typescript"]?.GetValue<string>()); 128var engines = packageJson["engines"]!.AsObject(); 129Assert.Equal("^20.19.0 || ^22.13.0 || >=24", engines["node"]?.GetValue<string>()); 147Assert.Equal("aspire-apphost", packageJson["name"]?.GetValue<string>()); 148Assert.Equal("1.0.0", packageJson["version"]?.GetValue<string>()); 149Assert.True(packageJson["private"]?.GetValue<bool>()); 150Assert.Equal("module", packageJson["type"]?.GetValue<string>()); 179var dependencies = packageJson["dependencies"]!.AsObject(); 180var devDependencies = packageJson["devDependencies"]!.AsObject(); 184Assert.Equal("^8.2.0", dependencies["vscode-jsonrpc"]?.GetValue<string>()); 185Assert.Equal("^22.0.0", devDependencies["@types/node"]?.GetValue<string>()); 186Assert.Equal("^3.1.14", devDependencies["nodemon"]?.GetValue<string>()); 187Assert.Equal("^4.21.0", devDependencies["tsx"]?.GetValue<string>()); 188Assert.Equal("^5.9.3", devDependencies["typescript"]?.GetValue<string>()); 235var httpsProfile = appHostRunJson["profiles"]!["https"]!.AsObject(); 236var applicationUrls = httpsProfile["applicationUrl"]!.GetValue<string>().Split(';', StringSplitOptions.RemoveEmptyEntries); 237var environmentVariables = httpsProfile["environmentVariables"]!.AsObject(); 243var otlpHttpsPort = GetPort(environmentVariables["ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL"]!.GetValue<string>()); 244var resourceServiceHttpsPort = GetPort(environmentVariables["ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL"]!.GetValue<string>());
Aspire.Hosting.Docker (3)
DockerComposeEnvironmentResource.cs (3)
147var savedComposeFilePath = stateSection.Data["ComposeFilePath"]?.ToString(); 163var savedOutputPath = stateSection.Data["OutputPath"]?.ToString() ?? Path.GetDirectoryName(savedComposeFilePath)!; 164var savedProjectName = stateSection.Data["ProjectName"]?.ToString() ?? GetDockerComposeProjectName(ctx, this);
Aspire.Hosting.Docker.Tests (2)
DockerComposeTests.cs (2)
1056Assert.NotNull(stateSection.Data["ComposeFilePath"]?.ToString()); 1057Assert.NotNull(stateSection.Data["ProjectName"]?.ToString());
Aspire.Hosting.Foundry.Tests (6)
HostedAgentConfigurationTests.cs (6)
89var definition = payload["definition"]!; 91var protocolVersion = Assert.Single(definition["protocol_versions"]!.AsArray()); 93Assert.Equal("2.0.0", protocolVersion["version"]!.GetValue<string>()); 94Assert.Equal("myregistry.azurecr.io/myagent:v1", definition["container_configuration"]!["image"]!.GetValue<string>()); 95Assert.Null(definition["container_protocol_versions"]); 96Assert.Null(definition["image"]);
Aspire.Hosting.JavaScript.Tests (4)
AddJavaScriptAppTests.cs (3)
286Assert.Equal("container.v1", manifest["type"]?.ToString()); 304Assert.Equal("bun", manifest["entrypoint"]?.ToString()); 323Assert.Equal("container.v1", manifest["type"]?.ToString());
AddViteAppTests.cs (1)
487Assert.Equal("container.v1", manifest["type"]?.ToString());
Aspire.Hosting.Kubernetes (4)
Deployment\HelmDeploymentEngine.cs (2)
192var savedReleaseName = stateSection.Data["ReleaseName"]?.ToString(); 193var savedNamespace = stateSection.Data["Namespace"]?.ToString();
KubernetesHelmChartExtensions.cs (2)
402var savedReleaseName = stateSection.Data["ReleaseName"]?.ToString(); 403var savedNamespace = stateSection.Data["Namespace"]?.ToString();
Aspire.Hosting.Kubernetes.Tests (1)
KubernetesDeployTests.cs (1)
1946Assert.Equal("my-release", stateSection.Data["ReleaseName"]?.ToString());
Aspire.Hosting.Redis.Tests (40)
AddRedisTests.cs (35)
152var resources = fullManifest["resources"]!; 153var manifest = resources["redis"]!; 155Assert.Equal("container.v0", manifest["type"]!.GetValue<string>()); 156var connectionString = manifest["connectionString"]!.GetValue<string>(); 161Assert.Equal($"{RedisContainerImageTags.Registry}/{RedisContainerImageTags.Image}:{RedisContainerImageTags.Tag}", manifest["image"]!.GetValue<string>()); 162Assert.Equal("/bin/sh", manifest["entrypoint"]!.GetValue<string>()); 163Assert.Equal("{redis-password.value}", manifest["env"]!["REDIS_PASSWORD"]!.GetValue<string>()); 164Assert.Equal("redis", manifest["bindings"]!["tcp"]!["scheme"]!.GetValue<string>()); 165Assert.Equal(6379, manifest["bindings"]!["tcp"]!["targetPort"]!.GetValue<int>()); 177var resources = fullManifest["resources"]!; 178var manifest = resources["redis"]!; 180Assert.Equal("container.v0", manifest["type"]!.GetValue<string>()); 181var connectionString = manifest["connectionString"]!.GetValue<string>(); 186Assert.Equal($"{RedisContainerImageTags.Registry}/{RedisContainerImageTags.Image}:{RedisContainerImageTags.Tag}", manifest["image"]!.GetValue<string>()); 187Assert.Equal("/bin/sh", manifest["entrypoint"]!.GetValue<string>()); 188Assert.Equal("redis", manifest["bindings"]!["tcp"]!["scheme"]!.GetValue<string>()); 189Assert.Equal(6379, manifest["bindings"]!["tcp"]!["targetPort"]!.GetValue<int>()); 206var resources = fullManifest["resources"]!; 207var manifest = resources["redis"]!; 209Assert.Equal("container.v0", manifest["type"]!.GetValue<string>()); 210var connectionString = manifest["connectionString"]!.GetValue<string>(); 215Assert.Equal($"{RedisContainerImageTags.Registry}/{RedisContainerImageTags.Image}:{RedisContainerImageTags.Tag}", manifest["image"]!.GetValue<string>()); 216Assert.Equal("{pass.value}", manifest["env"]!["REDIS_PASSWORD"]!.GetValue<string>()); 217Assert.Equal("redis", manifest["bindings"]!["tcp"]!["scheme"]!.GetValue<string>()); 218Assert.Equal(6379, manifest["bindings"]!["tcp"]!["targetPort"]!.GetValue<int>()); 232var resources = fullManifest["resources"]!; 233var manifest = resources["redis"]!; 235Assert.Equal("container.v0", manifest["type"]!.GetValue<string>()); 236var connectionString = manifest["connectionString"]!.GetValue<string>(); 241Assert.Equal($"{RedisContainerImageTags.Registry}/{RedisContainerImageTags.Image}:{RedisContainerImageTags.Tag}", manifest["image"]!.GetValue<string>()); 242Assert.Equal("{pass.value}", manifest["env"]!["REDIS_PASSWORD"]!.GetValue<string>()); 243Assert.Equal("redis", manifest["bindings"]!["tcp"]!["scheme"]!.GetValue<string>()); 244Assert.Equal(6379, manifest["bindings"]!["tcp"]!["targetPort"]!.GetValue<int>()); 1001var creEntry = resources[creName]; 1003Assert.Equal("value.v0", creEntry["type"]!.GetValue<string>());
RedisFunctionalTests.cs (5)
609var agreements = jo["agreements"]; 612Assert.False(agreements["analytics"]!.GetValue<bool>()); 613Assert.False(agreements["notifications"]!.GetValue<bool>()); 614Assert.False(agreements["encryption"]!.GetValue<bool>()); 615Assert.True(agreements["eula"]!.GetValue<bool>());
Aspire.Hosting.RemoteHost (1)
Ats\AtsCallbackProxyFactory.cs (1)
405if (returnedArgs[key] is JsonObject modifiedDto)
Aspire.Hosting.RemoteHost.Tests (51)
AtsMarshallerTests.cs (32)
542Assert.NotNull(jsonObj["$handle"]); 543Assert.NotNull(jsonObj["$type"]); 545var typeId = jsonObj["$type"]!.GetValue<string>(); 561Assert.NotNull(jsonObj["$handle"]); 562Assert.NotNull(jsonObj["$type"]); 564var typeId = jsonObj["$type"]!.GetValue<string>(); 580Assert.NotNull(jsonObj["$handle"]); 581Assert.NotNull(jsonObj["$type"]); 776Assert.Equal("test", jsonObj["name"]?.GetValue<string>()); 777Assert.Equal(10, jsonObj["count"]?.GetValue<int>()); 829Assert.Equal(1500, json["required"]?.GetValue<double>()); 830Assert.Equal(90_000, json["optional"]?.GetValue<double>()); 831Assert.Null(json["empty"]); 923Assert.Equal("root", obj["name"]!.GetValue<string>()); 924Assert.True(obj["self"] is null || obj["self"]!.GetValueKind() == System.Text.Json.JsonValueKind.Null); 939Assert.Equal("parent", obj["label"]!.GetValue<string>()); 940var childObj = Assert.IsType<JsonObject>(obj["child"]); 941Assert.Equal("child", childObj["label"]!.GetValue<string>()); 943Assert.True(childObj["parent"] is null || childObj["parent"]!.GetValueKind() == System.Text.Json.JsonValueKind.Null); 959Assert.Equal("typed", obj["name"]!.GetValue<string>()); 960Assert.True(obj["self"] is null || obj["self"]!.GetValueKind() == System.Text.Json.JsonValueKind.Null); 975Assert.Equal("parent", obj["label"]!.GetValue<string>()); 976var childObj = Assert.IsType<JsonObject>(obj["child"]); 977Assert.Equal("child", childObj["label"]!.GetValue<string>()); 978Assert.True(childObj["parent"] is null || childObj["parent"]!.GetValueKind() == System.Text.Json.JsonValueKind.Null); 1247Assert.NotNull(jsonObj["$handle"]); 1248Assert.NotNull(jsonObj["$type"]); 1264var handleId = json["$handle"]!.GetValue<string>();
CallbackProxyTests.cs (11)
128Assert.Equal("hello-world", args["p0"]?.GetValue<string>()); 145Assert.Equal("test-name", args["p0"]?.GetValue<string>()); 146Assert.Equal(42, args["p1"]?.GetValue<int>()); 169var handle = Assert.IsAssignableFrom<JsonObject>(args["p0"]); 170Assert.NotNull(handle["$handle"]?.GetValue<string>()); 171Assert.Equal(AtsTypeMapping.DeriveTypeId(typeof(ITestCallbackHandle)), handle["$type"]?.GetValue<string>()); 201Assert.Equal("test", args["p0"]?.GetValue<string>()); 202var tokenId = args["p1"]?.GetValue<string>(); 205Assert.Equal(tokenId, args["$cancellationToken"]?.GetValue<string>()); 222var tokenId = args["p0"]?.GetValue<string>(); 224Assert.Equal(tokenId, args["$cancellationToken"]?.GetValue<string>());
CapabilityDispatcherTests.cs (3)
390var nestedHandleId = handleRef["$handle"]!.GetValue<string>(); 391var nestedTypeId = handleRef["$type"]!.GetValue<string>(); 719Assert.Equal("hello from C#", callbackArgs["p0"]?.GetValue<string>());
HandleRegistryTests.cs (4)
174Assert.NotNull(json["$handle"]); 175Assert.NotNull(json["$type"]); 176Assert.Equal("aspire/TestObject", json["$type"]!.GetValue<string>()); 178var handleId = json["$handle"]!.GetValue<string>();
ReferenceExpressionRefTests.cs (1)
251((JsonObject)json["$expr"]!)["valueProviders"] = providersArray;
Aspire.Hosting.Tests (110)
Backchannel\AuxiliaryBackchannelRpcTargetTests.cs (2)
1333Assert.Equal("localhost", nameValueObject["Host"]?.GetValue<string>()); 1334Assert.Equal("catalogdb", nameValueObject["DatabaseName"]?.GetValue<string>());
JsonFlattenerTests.cs (31)
37Assert.Equal("existing-flat-value", result["Azure:SubscriptionId"]!.ToString()); 38Assert.Equal("microsoft.onmicrosoft.com", result["Azure:Tenant"]!.ToString()); 39Assert.Equal("/subscriptions/123/deployments/MyStorage", result["Azure:Deployments:MyStorage:Id"]!.ToString()); 40Assert.Equal("{ \"param\": \"value\" }", result["Azure:Deployments:MyStorage:Parameters"]!.ToString()); 62Assert.Equal("07268dd7-4c50-434b-b1ff-67b8164edb41", result["Azure:SubscriptionId"]!.ToString()); 63Assert.Equal("microsoft.onmicrosoft.com", result["Azure:Tenant"]!.ToString()); 64Assert.Equal("eastus2", result["Azure:Location"]!.ToString()); 103Assert.Equal("nested-value", result["Level1:Level2:Level3:DeepValue"]!.ToString()); 127Assert.Equal("text", result["StringValue"]!.ToString()); 128Assert.Equal("42", result["NumberValue"]!.ToString()); 129Assert.Equal("true", result["BoolValue"]!.ToString()); 130Assert.Null(result["NullValue"]); 131Assert.Equal("inner-text", result["Nested:InnerString"]!.ToString()); 132Assert.Null(result["Nested:InnerNull"]); 150Assert.Equal("value1", result["SimpleArray:0"]!.ToString()); 151Assert.Equal("value2", result["SimpleArray:1"]!.ToString()); 152Assert.Equal("value3", result["SimpleArray:2"]!.ToString()); 154Assert.Equal("1", result["NumberArray:0"]!.ToString()); 155Assert.Equal("2", result["NumberArray:1"]!.ToString()); 156Assert.Equal("3", result["NumberArray:2"]!.ToString()); 158Assert.Equal("text", result["MixedArray:0"]!.ToString()); 159Assert.Equal("42", result["MixedArray:1"]!.ToString()); 160Assert.Equal("true", result["MixedArray:2"]!.ToString()); 161Assert.Null(result["MixedArray:3"]); 190Assert.Equal("Item1", result["ObjectArray:0:Name"]!.ToString()); 191Assert.Equal("Value1", result["ObjectArray:0:Value"]!.ToString()); 192Assert.Equal("Item2", result["ObjectArray:1:Name"]!.ToString()); 193Assert.Equal("Value2", result["ObjectArray:1:Value"]!.ToString()); 195Assert.Equal("1", result["NestedConfig:Items:0:Id"]!.ToString()); 196Assert.Equal("true", result["NestedConfig:Items:0:Settings:Enabled"]!.ToString()); 214Assert.Equal("test", result["OtherValue"]!.ToString());
KestrelConfigTests.cs (1)
299Assert.Equal(expectedEnv, manifest["env"]!.ToString());
Publishing\DeploymentStateManagerTests.cs (75)
51Assert.Equal("value1", section2.Data["key1"]?.GetValue<string>()); 67Assert.Null(restartedSection.Data["NullValue"]); 120Assert.Equal("value1", parametersCheck.Data["param1"]?.GetValue<string>()); 121Assert.Equal("azure-value1", azureCheck.Data["resource1"]?.GetValue<string>()); 149Assert.Equal($"value{i}", section.Data[$"key{i}"]?.GetValue<string>()); 168Assert.Equal("value1", section2.Data["key1"]?.GetValue<string>()); 189Assert.Equal("value1", section2.Data["key1"]?.GetValue<string>()); 202Assert.Equal("value1", section3.Data["key1"]?.GetValue<string>()); 203Assert.Equal("value2", section3.Data["key2"]?.GetValue<string>()); 241Assert.Equal("value1", parametersSection.Data["param1"]?.GetValue<string>()); 242Assert.Equal("azure-value1", azureSection.Data["resource1"]?.GetValue<string>()); 243Assert.Equal("value1", restartedParametersSection.Data["param1"]?.GetValue<string>()); 260Assert.Equal("value1", retrievedSection.Data["key1"]?.GetValue<string>()); 277Assert.Equal("nestedValue", verifySection.Data["nestedKey"]?.GetValue<string>()); 297Assert.Equal("value1", verify1.Data["key1"]?.GetValue<string>()); 298Assert.Equal("value2", verify2.Data["key2"]?.GetValue<string>()); 314Assert.Equal("value1", verify.Data[""]?.GetValue<string>()); 374Assert.Equal("topValue", verifyTop.Data["topKey"]?.GetValue<string>()); 375Assert.Equal("nestedValue", verifyNested.Data["nestedKey"]?.GetValue<string>()); 481Assert.True(migratedSection.Data["legacy"]?.GetValue<bool>()); 493Assert.True(currentSection.Data["legacy"]?.GetValue<bool>()); 494Assert.True(currentSection.Data["current"]?.GetValue<bool>()); 536Assert.Equal("legacy", legacyAfterRestart.Data["Value"]?.GetValue<string>()); 537Assert.Equal("current", replacementAfterRestart.Data["Value"]?.GetValue<string>()); 559Assert.Equal("committed", restartedSection.Data["Value"]?.GetValue<string>()); 597Assert.Equal("legacy", parameterSection.Data[""]?.GetValue<string>()); 624Assert.Equal("existing", section.Data[""]?.GetValue<string>()); 630Assert.Equal("existing", restartedSection.Data[""]?.GetValue<string>()); 661Assert.Equal("updated", restartedSection.Data[""]?.GetValue<string>()); 693Assert.Equal("updated", restartedSection.Data["Leaf"]?.GetValue<string>()); 721var features = Assert.IsType<JsonObject>(restartedSection.Data["Features"]); 723Assert.True(features["A"]?.GetValue<bool>()); 724Assert.True(features["B"]?.GetValue<bool>()); 757Assert.Equal("first-sandbox", migratedFirstSection.Data["SandboxId"]?.GetValue<string>()); 758Assert.True(migratedFirstSection.Data["Migrated"]?.GetValue<bool>()); 770Assert.True(restartedFirstSection.Data["Migrated"]?.GetValue<bool>()); 771Assert.Equal("second-sandbox", restartedSecondSection.Data["SandboxId"]?.GetValue<string>()); 776Assert.Equal("second-sandbox", secondSection.Data["SandboxId"]?.GetValue<string>()); 786Assert.Equal("first-sandbox", clearedFirstLegacySection.Data["SandboxId"]?.GetValue<string>()); 787Assert.Equal("second-sandbox", preservedSecondLegacySection.Data["SandboxId"]?.GetValue<string>()); 811Assert.Equal("current-subscription", currentAzureSection.Data["SubscriptionId"]?.GetValue<string>()); 812Assert.Null(currentAzureSection.Data["Sandboxes"]); 816Assert.Equal("current-subscription", restartedAzureSection.Data["SubscriptionId"]?.GetValue<string>()); 817Assert.Equal("first-sandbox", restartedAzureSection.Data["Sandboxes"]?["first"]?["SandboxId"]?.GetValue<string>()); 818Assert.Equal("second-sandbox", restartedAzureSection.Data["Sandboxes"]?["second"]?["SandboxId"]?.GetValue<string>()); 819Assert.Null((await restartedStateManager.AcquireCurrentSectionAsync("Azure")).Data["Sandboxes"]); 850Assert.Null(restartedAzureSection.Data["SubscriptionId"]); 851Assert.Null(restartedAzureSection.Data["Sandboxes"]?["legacy"]); 854restartedAzureSection.Data["Sandboxes"]?["new"]?["SandboxId"]?.GetValue<string>()); 895Assert.Null(restartedSandboxesSection.Data["first"]?["SandboxId"]); 896Assert.Null(restartedSandboxesSection.Data["first"]?["LegacyOnly"]); 899restartedSandboxesSection.Data["first"]?["new"]?["SandboxId"]?.GetValue<string>()); 902restartedSandboxesSection.Data["second"]?["SandboxId"]?.GetValue<string>()); 938Assert.Equal("first-sandbox", restartedFirstSection.Data["SandboxId"]?.GetValue<string>()); 939Assert.True(restartedFirstSection.Data["Updated"]?.GetValue<bool>()); 940Assert.Equal("second-sandbox", restartedSecondSection.Data["SandboxId"]?.GetValue<string>()); 941Assert.True(restartedSecondSection.Data["Updated"]?.GetValue<bool>()); 971Assert.Equal("current-subscription", restartedAzureSection.Data["SubscriptionId"]?.GetValue<string>()); 972Assert.Equal("current-location", restartedAzureSection.Data["Location"]?.GetValue<string>()); 975Assert.Equal("current-subscription", currentAzureSection.Data["SubscriptionId"]?.GetValue<string>()); 976Assert.Equal("current-location", currentAzureSection.Data["Location"]?.GetValue<string>()); 1006Assert.Equal("sub", preservedLegacySection.Data["SubscriptionId"]?.GetValue<string>()); 1036Assert.Equal("current-sub", asyncEffectiveState["Azure"]?["SubscriptionId"]?.GetValue<string>()); 1037Assert.Equal("current-sub", syncEffectiveState["Azure"]?["SubscriptionId"]?.GetValue<string>()); 1038Assert.Equal("current-sub", migratedSection.Data["SubscriptionId"]?.GetValue<string>()); 1060Assert.Equal("current-sub", asyncEffectiveState["Azure"]?["SubscriptionId"]?.GetValue<string>()); 1061Assert.Equal("current-sub", syncEffectiveState["Azure"]?["SubscriptionId"]?.GetValue<string>()); 1062Assert.Equal("current-sub", restartedSection.Data["SubscriptionId"]?.GetValue<string>()); 1068Assert.Equal("current-sub", savedSection.Data["SubscriptionId"]?.GetValue<string>()); 1069Assert.Equal("westus", savedSection.Data["Location"]?.GetValue<string>()); 1087Assert.Equal("sub", currentSection.Data["SubscriptionId"]?.GetValue<string>()); 1138.Data["SandboxId"]?.GetValue<string>()); 1142.Data["SubscriptionId"]?.GetValue<string>()); 1179.Data["SandboxId"]?.GetValue<string>()); 1183.Data["SandboxId"]?.GetValue<string>());
WithEndpointTests.cs (1)
724Assert.Equal(expectedEnv, manifest["env"]!.ToString());
Aspire.Hosting.TestUtilities (2)
Utils\ManifestUtils.cs (2)
41var resourceNode = obj[resource.Name]; 88var resourceNode = obj[r.Name];
ConfigurationSchemaGenerator (11)
ConfigSchemaEmitter.cs (11)
119var backupTypeNode = currentNode["type"]; 123if (currentNode[propertiesName] is not JsonObject propertiesNode) 132if (propertiesNode[pathSegment] is not JsonObject pathSegmentNode) 147backupCasingOfPathSegmentName = propertiesNode[pathSegment].GetPropertyName(); 174var existingValue = propertiesNode[pathSegment]; 240var backupTypeNode = currentNode["type"]; 244if (currentNode["properties"] is not JsonObject propertiesNode) 284var backupPropertyNode = currentNode[property.ConfigurationKeyName]; 315var backupTypeNode = currentNode["type"]; 316var backupContainerNode = currentNode[containerName]; 449var propertyNodeType = propertyNode["type"];
dotnet (2)
Telemetry\TelemetryDiskLogger.cs (1)
56var activitiesArray = root["activities"]!.AsArray();
ToolPackage\ToolPackageDownloaderBase.cs (1)
391if (jsonObject["runtimeOptions"] is JsonObject runtimeOptions)
dotnet-aot (1)
src\sdk\src\Cli\dotnet\Telemetry\TelemetryDiskLogger.cs (1)
56var activitiesArray = root["activities"]!.AsArray();
dotnet-user-jwts (6)
Helpers\JwtAuthenticationSchemeSettings.cs (4)
28if (config[AuthenticationKey] is JsonObject authentication) 30if (authentication[SchemesKey] is JsonObject schemes) 76if (config[AuthenticationKey] is JsonObject authentication && 77authentication[SchemesKey] is JsonObject schemes)
Helpers\SigningKeysHandler.cs (2)
82var signingKeys = secrets[signkingKeysPropertyName].AsArray(); 85var toRemove = signingKeys.SingleOrDefault(key => key["Issuer"].GetValue<string>() == issuer);
Infrastructure.Tests (8)
Pipelines\NpmCliPackageTests.cs (8)
257GetStringArray(packageJson["keywords"])); 263Assert.Equal(["bin", "README.md"], GetStringArray(packageJson["files"])); 340Assert.Equal(expectation.Os, GetStringArray(packageJson["os"])); 341Assert.Equal(expectation.Cpu, GetStringArray(packageJson["cpu"])); 342Assert.Equal(["bin", "README.md"], GetStringArray(packageJson["files"])); 350Assert.Equal(expectation.Libc, GetStringArray(packageJson["libc"])); 773return jsonObject[propertyName]?.AsObject() 779return jsonObject[propertyName]?.GetValue<string>()
Microsoft.AspNetCore.OpenApi (11)
Extensions\JsonNodeSchemaExtensions.cs (10)
138var isArray = MapJsonNodeToSchemaType(schema[OpenApiSchemaKeywords.TypeKeyword]) is { } schemaTypes && schemaTypes.HasFlag(JsonSchemaType.Array); 144var isArray = MapJsonNodeToSchemaType(schema[OpenApiSchemaKeywords.TypeKeyword]) is { } schemaTypes && schemaTypes.HasFlag(JsonSchemaType.Array); 150var isArray = MapJsonNodeToSchemaType(schema[OpenApiSchemaKeywords.TypeKeyword]) is { } schemaTypes && schemaTypes.HasFlag(JsonSchemaType.Array); 361if (enumType.IsEnum && schema[OpenApiSchemaKeywords.EnumKeyword] is JsonArray) 376var defaultKey = schema[OpenApiConstants.RefDefaultAnnotation] is not null 380&& schema[defaultKey] is JsonNode defaultNode 400&& MapJsonNodeToSchemaType(schema[OpenApiSchemaKeywords.TypeKeyword]) is { } schemaTypes && 508return (schema[OpenApiConstants.SchemaId] is JsonNode schemaIdNode 557if (MapJsonNodeToSchemaType(schema[OpenApiSchemaKeywords.TypeKeyword]) is { } schemaTypes) 592schema[OpenApiSchemaKeywords.TypeKeyword] is JsonArray typeArray)
Services\Schemas\OpenApiSchemaService.cs (1)
277if (rawNode[OpenApiSchemaKeywords.EnumKeyword] is JsonArray rawEnum && rawEnum.Count > 0)
Microsoft.Extensions.AI.Abstractions (1)
Utilities\AIJsonUtilities.Schema.Create.cs (1)
782if (ctx.TypeInfo.NumberHandling is not JsonNumberHandling.Strict && schema["type"] is JsonArray typeArray)
Microsoft.Extensions.AI.Abstractions.Tests (1)
Utilities\AIJsonUtilitiesTests.cs (1)
1850Assert.Equal(((JsonArray)schemaObj["required"]!).Count, ((JsonObject)props!).Count);
Microsoft.Extensions.AI.OpenAI (2)
OpenAIClientExtensions.cs (2)
83if (schemaObj[propName] is { } propNode) 92schemaObj["description"] = schemaObj["description"] is { } descriptionNode && descriptionNode.GetValueKind() == JsonValueKind.String ?
Microsoft.ML.AutoML (9)
SweepableEstimator\Converter\MultiModelPipelineConverter.cs (2)
18var schema = jValue["schema"].GetValue<string>(); 19var estimators = jValue["estimator"].GetValue<Dictionary<string, SweepableEstimator>>();
SweepableEstimator\Converter\SweepableEstimatorConverter.cs (2)
19var estimatorType = jsonObject["estimatorType"].GetValue<EstimatorType>(); 20var parameter = jsonObject["parameter"].GetValue<Parameter>();
SweepableEstimator\Converter\SweepableEstimatorPipelineConverter.cs (2)
18var parameter = jNode["parameter"].GetValue<Parameter>(); 19var estimators = jNode["estimators"].GetValue<SweepableEstimator[]>();
SweepableEstimator\Converter\SweepablePipelineConverter.cs (3)
18var currentSchema = jValue["currentSchema"].GetValue<string>(); 19var schema = jValue["schema"].GetValue<string>(); 20var estimators = jValue["estimator"].GetValue<Dictionary<string, SweepableEstimator>>();
Microsoft.ML.AutoML.SourceGenerator (10)
SearchSpaceGenerator.cs (10)
39var className = Utils.ToTitleCase(jNode["name"].GetValue<string>()); 40var searchSpaceJArray = jNode["search_space"].AsArray(); 43var optionName = Utils.ToTitleCase(t["name"].GetValue<string>()); 44string optionTypeName = t["type"].GetValue<string>() switch 65var defaultToken = t.AsObject().ContainsKey("default") ? t["default"] : null; 86var searchSpaceNode = t.AsObject().ContainsKey("search_space") ? t["search_space"] : null; 96var minToken = searchSpaceNode["min"]; 97var minValue = searchSpaceNode["min"].GetValue<double>(); 98var maxValue = searchSpaceNode["max"].GetValue<double>(); 99var logBase = searchSpaceObject.ContainsKey("log_base") is false ? "false" : searchSpaceNode["log_base"].GetValue<bool>() ? "true" : "false";
Microsoft.NET.Build.Containers (16)
ImageConfig.cs (14)
51if (_config["config"] is not JsonObject) 69internal string? GetUser() => _config["config"]?["User"]?.ToString(); 70internal string[]? GetEntrypoint() => _config["config"]?["Entrypoint"]?.AsArray()?.Select(node => node!.GetValue<string>())?.ToArray(); 71private string[]? GetCmd() => _config["config"]?["Entrypoint"]?.AsArray()?.Select(node => node!.GetValue<string>())?.ToArray(); 72private List<HistoryEntry> GetHistory() => _config["history"]?.AsArray().Select(node => node.Deserialize<HistoryEntry>()!).ToList() ?? new List<HistoryEntry>(); 75string? os = _config["os"]?.ToString(); 81string? architecture = _config["architecture"]?.ToString(); 129if (_config["config"]?[propertyName] is JsonNode propertyValue) 246if (_config["config"]?["ExposedPorts"] is JsonObject portsJson) 265if (_config["config"]?["Labels"] is JsonObject labelsJson) 282if (_config["config"]?["Env"] is JsonArray envVarJson) 335if (_config["rootfs"] is { } rootfs) 337if (rootfs["type"]?.GetValue<string>() == "layers" && rootfs["diff_ids"] is JsonArray layers)
Tasks\CreateImageIndex.cs (2)
151var architecture = configJson["architecture"]?.ToString(); 157var os = configJson["os"]?.ToString();
Microsoft.TemplateEngine.Cli (1)
PostActionProcessors\AddJsonPropertyPostActionProcessor.cs (1)
228JsonNode? childNode = node[property];
MSBuild (3)
JsonOutputFormatter.cs (3)
34Assumed.Null(_topLevelNode["Properties"], "Should not add multiple lists of properties to the json format."); 52Assumed.Null(_topLevelNode["Items"], "Should not add multiple lists of items to the json format."); 88Assumed.Null(_topLevelNode["TargetResults"], "Should not add multiple lists of target results to the json format.");
sdk-tasks (7)
GetRuntimePackRids.cs (1)
23string [] runtimeIdentifiers = runtimeJsonRoot["runtimes"]!.AsObject().Select(p => p.Key).ToArray();
PublishMutationUtilities.cs (2)
20foreach (var target in deps["targets"]!.AsObject()) 38var librariesObj = deps["libraries"]!.AsObject();
RemoveAssetFromDepsPackages.cs (1)
37foreach (var target in deps["targets"]!.AsObject())
UpdateRuntimeConfig.cs (3)
38var frameworks = config["runtimeOptions"]?["frameworks"]; 39var framework = config["runtimeOptions"]?["framework"]; 58var name = framework["name"]!.GetValue<string>();
ServiceBus.AppHost (1)
AppHost.cs (1)
38document["UserConfig"]!["Logging"] = new JsonObject { ["Type"] = "Console" };