9 instantiations of JsonElement
Microsoft.AspNetCore.Components.WebAssembly.Server (1)
System.Text.Json (8)
1309 references to JsonElement
aspire (149)
BackchannelJsonSerializerContext.CallMcpToolRequest.g.cs (5)
32ObjectWithParameterizedConstructorCreator = static args => new global::Aspire.Cli.Backchannel.CallMcpToolRequest(){ ResourceName = (string)args[0], ToolName = (string)args[1], Arguments = (global::System.Text.Json.JsonElement?)args[2] },
97var info2 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<global::System.Text.Json.JsonElement?>
112AttributeProviderFactory = static () => typeof(global::Aspire.Cli.Backchannel.CallMcpToolRequest).GetProperty("Arguments", InstanceMemberBindingFlags, null, typeof(global::System.Text.Json.JsonElement?), global::System.Array.Empty<global::System.Type>(), null),
115properties[2] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<global::System.Text.Json.JsonElement?>(options, info2);
163ParameterType = typeof(global::System.Text.Json.JsonElement?),
BackchannelJsonSerializerContext.DictionaryStringJsonElement.g.cs (13)
13private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::System.Collections.Generic.Dictionary<string, global::System.Text.Json.JsonElement>>? _DictionaryStringJsonElement;
19public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::System.Collections.Generic.Dictionary<string, global::System.Text.Json.JsonElement>> DictionaryStringJsonElement
22get => _DictionaryStringJsonElement ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::System.Collections.Generic.Dictionary<string, global::System.Text.Json.JsonElement>>)Options.GetTypeInfo(typeof(global::System.Collections.Generic.Dictionary<string, global::System.Text.Json.JsonElement>));
25private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::System.Collections.Generic.Dictionary<string, global::System.Text.Json.JsonElement>> Create_DictionaryStringJsonElement(global::System.Text.Json.JsonSerializerOptions options)
27if (!TryGetTypeInfoForRuntimeCustomConverter<global::System.Collections.Generic.Dictionary<string, global::System.Text.Json.JsonElement>>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::System.Collections.Generic.Dictionary<string, global::System.Text.Json.JsonElement>> jsonTypeInfo))
29var info = new global::System.Text.Json.Serialization.Metadata.JsonCollectionInfoValues<global::System.Collections.Generic.Dictionary<string, global::System.Text.Json.JsonElement>>
31ObjectCreator = () => new global::System.Collections.Generic.Dictionary<string, global::System.Text.Json.JsonElement>(),
35jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateDictionaryInfo<global::System.Collections.Generic.Dictionary<string, global::System.Text.Json.JsonElement>, string, global::System.Text.Json.JsonElement>(options, info);
45private void DictionaryStringJsonElementSerializeHandler(global::System.Text.Json.Utf8JsonWriter writer, global::System.Collections.Generic.Dictionary<string, global::System.Text.Json.JsonElement>? value)
55foreach (global::System.Collections.Generic.KeyValuePair<string, global::System.Text.Json.JsonElement> entry in value)
BackchannelJsonSerializerContext.Tool.g.cs (6)
113var info3 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<global::System.Text.Json.JsonElement>
128AttributeProviderFactory = static () => typeof(global::ModelContextProtocol.Protocol.Tool).GetProperty("InputSchema", InstanceMemberBindingFlags, null, typeof(global::System.Text.Json.JsonElement), global::System.Array.Empty<global::System.Type>(), null),
131properties[3] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<global::System.Text.Json.JsonElement>(options, info3);
133var info4 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<global::System.Text.Json.JsonElement?>
148AttributeProviderFactory = static () => typeof(global::ModelContextProtocol.Protocol.Tool).GetProperty("OutputSchema", InstanceMemberBindingFlags, null, typeof(global::System.Text.Json.JsonElement?), global::System.Array.Empty<global::System.Type>(), null),
151properties[4] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<global::System.Text.Json.JsonElement?>(options, info4);
DotNet\DotNetCliRunner.cs (13)
243var rootElement = jsonDocument.RootElement;
245if (!rootElement.TryGetProperty("Properties", out var properties))
250if (!properties.TryGetProperty("IsAspireHost", out var isAspireHostElement))
260if (rootElement.TryGetProperty("Items", out var items))
263if (items.TryGetProperty("PackageReference", out var packageReferences))
265foreach (var packageRef in packageReferences.EnumerateArray())
267if (packageRef.TryGetProperty("Identity", out var identity) &&
269packageRef.TryGetProperty("Version", out var version))
278if (aspireHostingVersion == null && items.TryGetProperty("AspireProjectOrPackageReference", out var aspireProjectOrPackageReferences))
280foreach (var aspireRef in aspireProjectOrPackageReferences.EnumerateArray())
282if (aspireRef.TryGetProperty("Identity", out var identity) &&
284aspireRef.TryGetProperty("Version", out var version))
294if (aspireHostingVersion == null && properties.TryGetProperty("AspireHostingSDKVersion", out var aspireHostingSdkVersionElement))
JsonSourceGenerationContext.AspireJsonConfiguration.g.cs (3)
191var info7 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<global::System.Collections.Generic.Dictionary<string, global::System.Text.Json.JsonElement>>
206AttributeProviderFactory = static () => typeof(global::Aspire.Cli.Configuration.AspireJsonConfiguration).GetProperty("ExtensionData", InstanceMemberBindingFlags, null, typeof(global::System.Collections.Generic.Dictionary<string, global::System.Text.Json.JsonElement>), global::System.Array.Empty<global::System.Type>(), null),
209properties[7] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<global::System.Collections.Generic.Dictionary<string, global::System.Text.Json.JsonElement>>(options, info7);
JsonSourceGenerationContext.DictionaryStringJsonElement.g.cs (13)
13private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::System.Collections.Generic.Dictionary<string, global::System.Text.Json.JsonElement>>? _DictionaryStringJsonElement;
19public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::System.Collections.Generic.Dictionary<string, global::System.Text.Json.JsonElement>> DictionaryStringJsonElement
22get => _DictionaryStringJsonElement ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::System.Collections.Generic.Dictionary<string, global::System.Text.Json.JsonElement>>)Options.GetTypeInfo(typeof(global::System.Collections.Generic.Dictionary<string, global::System.Text.Json.JsonElement>));
25private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::System.Collections.Generic.Dictionary<string, global::System.Text.Json.JsonElement>> Create_DictionaryStringJsonElement(global::System.Text.Json.JsonSerializerOptions options)
27if (!TryGetTypeInfoForRuntimeCustomConverter<global::System.Collections.Generic.Dictionary<string, global::System.Text.Json.JsonElement>>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::System.Collections.Generic.Dictionary<string, global::System.Text.Json.JsonElement>> jsonTypeInfo))
29var info = new global::System.Text.Json.Serialization.Metadata.JsonCollectionInfoValues<global::System.Collections.Generic.Dictionary<string, global::System.Text.Json.JsonElement>>
31ObjectCreator = () => new global::System.Collections.Generic.Dictionary<string, global::System.Text.Json.JsonElement>(),
35jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateDictionaryInfo<global::System.Collections.Generic.Dictionary<string, global::System.Text.Json.JsonElement>, string, global::System.Text.Json.JsonElement>(options, info);
45private void DictionaryStringJsonElementSerializeHandler(global::System.Text.Json.Utf8JsonWriter writer, global::System.Collections.Generic.Dictionary<string, global::System.Text.Json.JsonElement>? value)
55foreach (global::System.Collections.Generic.KeyValuePair<string, global::System.Text.Json.JsonElement> entry in value)
Aspire.Azure.Npgsql (6)
Aspire.Azure.Npgsql.EntityFrameworkCore.PostgreSQL (6)
Aspire.Cli.Tests (31)
Aspire.Dashboard (29)
GenAIMessagesContext.DictionaryStringJsonElement.g.cs (13)
13private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::System.Collections.Generic.Dictionary<string, global::System.Text.Json.JsonElement>>? _DictionaryStringJsonElement;
19public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::System.Collections.Generic.Dictionary<string, global::System.Text.Json.JsonElement>> DictionaryStringJsonElement
22get => _DictionaryStringJsonElement ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::System.Collections.Generic.Dictionary<string, global::System.Text.Json.JsonElement>>)Options.GetTypeInfo(typeof(global::System.Collections.Generic.Dictionary<string, global::System.Text.Json.JsonElement>));
25private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::System.Collections.Generic.Dictionary<string, global::System.Text.Json.JsonElement>> Create_DictionaryStringJsonElement(global::System.Text.Json.JsonSerializerOptions options)
27if (!TryGetTypeInfoForRuntimeCustomConverter<global::System.Collections.Generic.Dictionary<string, global::System.Text.Json.JsonElement>>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::System.Collections.Generic.Dictionary<string, global::System.Text.Json.JsonElement>> jsonTypeInfo))
29var info = new global::System.Text.Json.Serialization.Metadata.JsonCollectionInfoValues<global::System.Collections.Generic.Dictionary<string, global::System.Text.Json.JsonElement>>
31ObjectCreator = () => new global::System.Collections.Generic.Dictionary<string, global::System.Text.Json.JsonElement>(),
35jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateDictionaryInfo<global::System.Collections.Generic.Dictionary<string, global::System.Text.Json.JsonElement>, string, global::System.Text.Json.JsonElement>(options, info);
45private void DictionaryStringJsonElementSerializeHandler(global::System.Text.Json.Utf8JsonWriter writer, global::System.Collections.Generic.Dictionary<string, global::System.Text.Json.JsonElement>? value)
55foreach (global::System.Collections.Generic.KeyValuePair<string, global::System.Text.Json.JsonElement> entry in value)
GenAIMessagesContext.GenericPart.g.cs (3)
51var info0 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<global::System.Collections.Generic.Dictionary<string, global::System.Text.Json.JsonElement>>
66AttributeProviderFactory = static () => typeof(global::Aspire.Dashboard.Model.GenAI.GenericPart).GetProperty("AdditionalProperties", InstanceMemberBindingFlags, null, typeof(global::System.Collections.Generic.Dictionary<string, global::System.Text.Json.JsonElement>), global::System.Array.Empty<global::System.Type>(), null),
69properties[0] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<global::System.Collections.Generic.Dictionary<string, global::System.Text.Json.JsonElement>>(options, info0);
Aspire.Dashboard.Tests (5)
Aspire.Hosting (14)
Dcp\DcpLogParser.cs (6)
143var root = doc.RootElement;
158("Cmd", root.TryGetProperty("Cmd", out var cmdProp) ? cmdProp.GetString() : null),
159("Args", root.TryGetProperty("Args", out var argsProp) ? argsProp.ToString() : null),
160("ContainerName", root.TryGetProperty("ContainerName", out var containerNameProp) ? containerNameProp.GetString() : null),
161("ContainerId", root.TryGetProperty("ContainerID", out var containerIdProp) ? containerIdProp.GetString() : null),
162("Error", root.TryGetProperty("error", out var errorProp) ? errorProp.GetString() : null)
Aspire.Hosting.JavaScript (2)
Aspire.Hosting.Maui (3)
Aspire.Hosting.OpenAI (3)
Aspire.Hosting.PostgreSQL.Tests (1)
Aspire.Hosting.Seq.Tests (2)
Aspire.Hosting.Tests (39)
Aspire.Templates.Tests (2)
Diagnostics.FunctionalTests (2)
dotnet-openapi (1)
dotnet-user-jwts (8)
IdentitySample.PasskeyConformance (5)
JwtBearerSample (1)
Microsoft.AspNetCore.Authentication (4)
Microsoft.AspNetCore.Authentication.OAuth (24)
Microsoft.AspNetCore.Authentication.OpenIdConnect (1)
Microsoft.AspNetCore.Authentication.Test (2)
Microsoft.AspNetCore.Authentication.Twitter (5)
Microsoft.AspNetCore.Components.Endpoints (13)
Microsoft.AspNetCore.Components.Endpoints.Tests (33)
TempData\JsonTempDataSerializerTest.cs (16)
118var jsonDocument = JsonSerializer.Deserialize<Dictionary<string, JsonElement>>(serialized);
136var jsonDocument = JsonSerializer.Deserialize<Dictionary<string, JsonElement>>(serialized);
154var jsonDocument = JsonSerializer.Deserialize<Dictionary<string, JsonElement>>(serialized);
173var jsonDocument = JsonSerializer.Deserialize<Dictionary<string, JsonElement>>(serialized);
192var jsonDocument = JsonSerializer.Deserialize<Dictionary<string, JsonElement>>(serialized);
211var jsonDocument = JsonSerializer.Deserialize<Dictionary<string, JsonElement>>(serialized);
229var jsonDocument = JsonSerializer.Deserialize<Dictionary<string, JsonElement>>(serialized);
251var jsonDocument = JsonSerializer.Deserialize<Dictionary<string, JsonElement>>(serialized);
270var jsonDocument = JsonSerializer.Deserialize<Dictionary<string, JsonElement>>(serialized);
291var jsonDocument = JsonSerializer.Deserialize<Dictionary<string, JsonElement>>(serialized);
312var jsonDocument = JsonSerializer.Deserialize<Dictionary<string, JsonElement>>(serialized);
333var jsonDocument = JsonSerializer.Deserialize<Dictionary<string, JsonElement>>(serialized);
353var jsonDocument = JsonSerializer.Deserialize<Dictionary<string, JsonElement>>(serialized);
375var jsonDocument = JsonSerializer.Deserialize<Dictionary<string, JsonElement>>(serialized);
397var jsonDocument = JsonSerializer.Deserialize<Dictionary<string, JsonElement>>(serialized);
418var jsonDocument = JsonSerializer.Deserialize<Dictionary<string, JsonElement>>(serialized);
Microsoft.AspNetCore.Components.Server (6)
Microsoft.AspNetCore.Components.Server.Tests (2)
Microsoft.AspNetCore.Components.Web (36)
Microsoft.AspNetCore.Components.Web.Tests (51)
Microsoft.AspNetCore.Components.WebAssembly (14)
Microsoft.AspNetCore.Components.WebAssembly.Server (12)
Microsoft.AspNetCore.Components.WebView (6)
IpcCommon.cs (6)
19public static bool TryDeserializeIncoming(string message, out IncomingMessageType messageType, out ArraySegment<JsonElement> args)
22public static bool TryDeserializeOutgoing(string message, out OutgoingMessageType messageType, out ArraySegment<JsonElement> args)
37private static bool TryDeserialize<T>(string message, out T messageType, out ArraySegment<JsonElement> args)
44var parsed = (JsonElement[])JsonSerializer.Deserialize(messageAfterPrefix, typeof(JsonElement[]), JsonSerializerOptionsProvider.Options);
46args = new ArraySegment<JsonElement>(parsed, 1, parsed.Length - 1);
Microsoft.AspNetCore.Diagnostics.Tests (10)
Microsoft.AspNetCore.Grpc.JsonTranscoding (2)
Microsoft.AspNetCore.Grpc.JsonTranscoding.Tests (7)
Microsoft.AspNetCore.Http.Abstractions.Tests (1)
Microsoft.AspNetCore.Http.Extensions (10)
Microsoft.AspNetCore.Identity (44)
IdentityJsonSerializerContext.PublicKeyCredentialAuthenticatorAssertionResponse.g.cs (5)
32ObjectWithParameterizedConstructorCreator = static args => new global::Microsoft.AspNetCore.Identity.PublicKeyCredential<global::Microsoft.AspNetCore.Identity.AuthenticatorAssertionResponse>(){ Id = (global::Microsoft.AspNetCore.Identity.BufferSource)args[0], Type = (string)args[1], ClientExtensionResults = (global::System.Text.Json.JsonElement)args[2], Response = (global::Microsoft.AspNetCore.Identity.AuthenticatorAssertionResponse)args[3], AuthenticatorAttachment = (string)args[4] },
97var info2 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<global::System.Text.Json.JsonElement>
112AttributeProviderFactory = static () => typeof(global::Microsoft.AspNetCore.Identity.PublicKeyCredential<global::Microsoft.AspNetCore.Identity.AuthenticatorAssertionResponse>).GetProperty("ClientExtensionResults", InstanceMemberBindingFlags, null, typeof(global::System.Text.Json.JsonElement), global::System.Array.Empty<global::System.Type>(), null),
115properties[2] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<global::System.Text.Json.JsonElement>(options, info2);
227ParameterType = typeof(global::System.Text.Json.JsonElement),
IdentityJsonSerializerContext.PublicKeyCredentialAuthenticatorAttestationResponse.g.cs (5)
32ObjectWithParameterizedConstructorCreator = static args => new global::Microsoft.AspNetCore.Identity.PublicKeyCredential<global::Microsoft.AspNetCore.Identity.AuthenticatorAttestationResponse>(){ Id = (global::Microsoft.AspNetCore.Identity.BufferSource)args[0], Type = (string)args[1], ClientExtensionResults = (global::System.Text.Json.JsonElement)args[2], Response = (global::Microsoft.AspNetCore.Identity.AuthenticatorAttestationResponse)args[3], AuthenticatorAttachment = (string)args[4] },
97var info2 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<global::System.Text.Json.JsonElement>
112AttributeProviderFactory = static () => typeof(global::Microsoft.AspNetCore.Identity.PublicKeyCredential<global::Microsoft.AspNetCore.Identity.AuthenticatorAttestationResponse>).GetProperty("ClientExtensionResults", InstanceMemberBindingFlags, null, typeof(global::System.Text.Json.JsonElement), global::System.Array.Empty<global::System.Type>(), null),
115properties[2] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<global::System.Text.Json.JsonElement>(options, info2);
227ParameterType = typeof(global::System.Text.Json.JsonElement),
IdentityJsonSerializerContext.PublicKeyCredentialCreationOptions.g.cs (6)
32ObjectWithParameterizedConstructorCreator = static args => new global::Microsoft.AspNetCore.Identity.PublicKeyCredentialCreationOptions(){ Rp = (global::Microsoft.AspNetCore.Identity.PublicKeyCredentialRpEntity)args[0], User = (global::Microsoft.AspNetCore.Identity.PublicKeyCredentialUserEntity)args[1], Challenge = (global::Microsoft.AspNetCore.Identity.BufferSource)args[2], PubKeyCredParams = (global::System.Collections.Generic.IReadOnlyList<global::Microsoft.AspNetCore.Identity.PublicKeyCredentialParameters>)args[3], Timeout = (ulong?)args[4], ExcludeCredentials = (global::System.Collections.Generic.IReadOnlyList<global::Microsoft.AspNetCore.Identity.PublicKeyCredentialDescriptor>)args[5], AuthenticatorSelection = (global::Microsoft.AspNetCore.Identity.AuthenticatorSelectionCriteria)args[6], Hints = (global::System.Collections.Generic.IReadOnlyList<string>)args[7], Attestation = (string)args[8], AttestationFormats = (global::System.Collections.Generic.IReadOnlyList<string>)args[9], Extensions = (global::System.Text.Json.JsonElement?)args[10] },
268var info10 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<global::System.Text.Json.JsonElement?>
283AttributeProviderFactory = static () => typeof(global::Microsoft.AspNetCore.Identity.PublicKeyCredentialCreationOptions).GetProperty("Extensions", InstanceMemberBindingFlags, null, typeof(global::System.Text.Json.JsonElement?), global::System.Array.Empty<global::System.Type>(), null),
286properties[10] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<global::System.Text.Json.JsonElement?>(options, info10);
362global::System.Text.Json.JsonElement? __value_Extensions = ((global::Microsoft.AspNetCore.Identity.PublicKeyCredentialCreationOptions)value).Extensions;
467ParameterType = typeof(global::System.Text.Json.JsonElement?),
IdentityJsonSerializerContext.PublicKeyCredentialRequestOptions.g.cs (6)
32ObjectWithParameterizedConstructorCreator = static args => new global::Microsoft.AspNetCore.Identity.PublicKeyCredentialRequestOptions(){ Challenge = (global::Microsoft.AspNetCore.Identity.BufferSource)args[0], Timeout = (ulong?)args[1], RpId = (string)args[2], AllowCredentials = (global::System.Collections.Generic.IReadOnlyList<global::Microsoft.AspNetCore.Identity.PublicKeyCredentialDescriptor>)args[3], UserVerification = (string)args[4], Hints = (global::System.Collections.Generic.IReadOnlyList<string>)args[5], Extensions = (global::System.Text.Json.JsonElement?)args[6] },
178var info6 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<global::System.Text.Json.JsonElement?>
193AttributeProviderFactory = static () => typeof(global::Microsoft.AspNetCore.Identity.PublicKeyCredentialRequestOptions).GetProperty("Extensions", InstanceMemberBindingFlags, null, typeof(global::System.Text.Json.JsonElement?), global::System.Array.Empty<global::System.Type>(), null),
196properties[6] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<global::System.Text.Json.JsonElement?>(options, info6);
247global::System.Text.Json.JsonElement? __value_Extensions = ((global::Microsoft.AspNetCore.Identity.PublicKeyCredentialRequestOptions)value).Extensions;
316ParameterType = typeof(global::System.Text.Json.JsonElement?),
Microsoft.AspNetCore.Identity.FunctionalTests (106)
Microsoft.AspNetCore.Identity.Test (3)
Microsoft.AspNetCore.JsonPatch.SystemTextJson (7)
Microsoft.AspNetCore.JsonPatch.SystemTextJson.Tests (1)
Microsoft.AspNetCore.Mvc.FunctionalTests (3)
Microsoft.AspNetCore.Mvc.ViewFeatures (6)
Microsoft.AspNetCore.Server.HttpSys.FunctionalTests (1)
Microsoft.AspNetCore.SignalR.Client.FunctionalTests (1)
Microsoft.AspNetCore.SignalR.Tests (4)
Microsoft.CodeAnalysis.EditorFeatures (8)
Microsoft.CodeAnalysis.ExternalAccess.Xaml (2)
Microsoft.CodeAnalysis.Features (1)
Microsoft.CodeAnalysis.LanguageServer.Protocol (25)
Microsoft.CodeAnalysis.LanguageServer.Protocol.UnitTests (5)
Microsoft.CodeAnalysis.LanguageServer.UnitTests (2)
Microsoft.CodeAnalysis.Workspaces.MSBuild (2)
Microsoft.CodeAnalysis.Workspaces.MSBuild.Contracts (2)
Microsoft.CommonLanguageServerProtocol.Framework.Package (6)
Microsoft.DotNet.Arcade.Sdk (3)
Microsoft.Extensions.AI (9)
Microsoft.Extensions.AI.Abstractions (50)
Functions\AIFunctionFactory.cs (24)
82/// invocation directly if the object is already of a compatible type. Otherwise, if the argument is a <see cref="JsonElement"/>, <see cref="JsonDocument"/>,
94/// By default, return values are serialized to <see cref="JsonElement"/> using <paramref name="options"/>'s
155/// invocation directly if the object is already of a compatible type. Otherwise, if the argument is a <see cref="JsonElement"/>, <see cref="JsonDocument"/>,
167/// Return values are serialized to <see cref="JsonElement"/> using <paramref name="serializerOptions"/> if provided,
240/// invocation directly if the object is already of a compatible type. Otherwise, if the argument is a <see cref="JsonElement"/>, <see cref="JsonDocument"/>,
252/// By default, return values are serialized to <see cref="JsonElement"/> using <paramref name="options"/>'s
320/// invocation directly if the object is already of a compatible type. Otherwise, if the argument is a <see cref="JsonElement"/>, <see cref="JsonDocument"/>,
332/// Return values are serialized to <see cref="JsonElement"/> using <paramref name="serializerOptions"/> if provided,
374/// Return values are serialized to <see cref="JsonElement"/> using <paramref name="options"/>'s
377/// <see cref="AIFunctionFactoryOptions.SerializerOptions"/>. If the argument is a <see cref="JsonElement"/>,
418/// invocation directly if the object is already of a compatible type. Otherwise, if the argument is a <see cref="JsonElement"/>, <see cref="JsonDocument"/>,
430/// By default, return values are serialized to <see cref="JsonElement"/> using <paramref name="options"/>'s
464JsonElement jsonSchema,
465JsonElement? returnJsonSchema = null) =>
473string name, string description, JsonElement jsonSchema, JsonElement? returnJsonSchema) :
478public override JsonElement JsonSchema => jsonSchema;
479public override JsonElement? ReturnJsonSchema => returnJsonSchema;
555public override JsonElement JsonSchema => FunctionDescriptor.JsonSchema;
556public override JsonElement? ReturnJsonSchema => FunctionDescriptor.ReturnJsonSchema;
723public JsonElement JsonSchema { get; }
724public JsonElement? ReturnJsonSchema { get; }
843JsonElement element => JsonSerializer.Deserialize(element, typeInfo),
1071return JsonElement.ParseValue(ref reader);
Microsoft.Extensions.AI.Abstractions.Tests (103)
Utilities\AIJsonUtilitiesTests.cs (65)
152JsonElement expected = JsonDocument.Parse("""
174JsonElement actual = AIJsonUtilities.CreateJsonSchema(typeof(MyPoco), serializerOptions: JsonContext.Default.Options);
182JsonElement expected = JsonDocument.Parse("""
189JsonElement actual = AIJsonUtilities.CreateJsonSchema(typeof(object[]), serializerOptions: JsonContext.Default.Options);
197JsonElement expected = JsonDocument.Parse("""
232JsonElement actual = AIJsonUtilities.CreateJsonSchema(
246JsonElement expected = JsonDocument.Parse("""
282JsonElement actual = AIJsonUtilities.CreateJsonSchema(typeof(MyPoco), serializerOptions: JsonContext.Default.Options, inferenceOptions: inferenceOptions);
295JsonElement resolvedSchema = AIJsonUtilities.CreateFunctionJsonSchema(func.UnderlyingMethod, title: string.Empty);
322JsonElement expected = JsonDocument.Parse($$"""
358JsonElement resolvedSchema = AIJsonUtilities.CreateFunctionJsonSchema(func.UnderlyingMethod, title: string.Empty, description: string.Empty, inferenceOptions: inferenceOptions);
368JsonElement schemaParameters = func.JsonSchema.GetProperty("properties");
388JsonElement expected = JsonDocument.Parse($$"""
394JsonElement actualSchema = property.Value;
441JsonElement schema = AIJsonUtilities.CreateFunctionJsonSchema(method);
444Assert.True(doc.RootElement.TryGetProperty("title", out JsonElement titleElement));
446Assert.True(doc.RootElement.TryGetProperty("description", out JsonElement descElement));
460JsonElement schema = AIJsonUtilities.CreateFunctionJsonSchema(method, title: "override_title");
463Assert.True(doc.RootElement.TryGetProperty("title", out JsonElement titleElement));
470JsonElement schema = AIJsonUtilities.CreateJsonSchema(typeof(object));
489JsonElement schema = AIJsonUtilities.CreateJsonSchema(testData.Type, serializerOptions: options, inferenceOptions: createOptions);
514JsonElement schema = AIJsonUtilities.CreateJsonSchema(typeof(AIContent), serializerOptions: options);
524JsonElement expectedSchema = JsonDocument.Parse("""
531JsonElement schema = AIJsonUtilities.CreateJsonSchema(typeof(MyEnumValue?), serializerOptions: JsonContext.Default.Options);
1019JsonElement expectedSchema = JsonDocument.Parse("""
1032JsonElement actualSchema = AIJsonUtilities.CreateJsonSchema(typeof(ClassWithNullableMaxLengthProperty), serializerOptions: JsonContext.Default.Options);
1154JsonElement schema = AIJsonUtilities.CreateFunctionJsonSchema(method.Method, inferenceOptions: new()
1182JsonElement schema = AIJsonUtilities.CreateFunctionJsonSchema(method.Method, inferenceOptions: new()
1187JsonElement properties = schema.GetProperty("properties");
1199JsonElement schema = AIJsonUtilities.CreateFunctionJsonSchema(method.Method, inferenceOptions: new()
1209JsonElement properties = schema.GetProperty("properties");
1223JsonElement schema = AIJsonUtilities.CreateFunctionJsonSchema(method.Method, inferenceOptions: new()
1228JsonElement properties = schema.GetProperty("properties");
1242JsonElement schema = AIJsonUtilities.CreateFunctionJsonSchema(method.Method, inferenceOptions: new()
1247JsonElement properties = schema.GetProperty("properties");
1260JsonElement schema = AIJsonUtilities.CreateFunctionJsonSchema(method.Method, inferenceOptions: new()
1269JsonElement properties = schema.GetProperty("properties");
1278JsonElement schema = JsonDocument.Parse("""
1289JsonElement expectedSchema = JsonDocument.Parse("""
1305JsonElement transformedSchema = AIJsonUtilities.TransformSchema(schema, options);
1312JsonElement schema = JsonDocument.Parse("""
1323JsonElement expectedSchema = JsonDocument.Parse("""
1339JsonElement transformedSchema = AIJsonUtilities.TransformSchema(schema, options);
1346JsonElement schema = JsonDocument.Parse("""
1357JsonElement expectedSchema = JsonDocument.Parse("""
1374JsonElement transformedSchema = AIJsonUtilities.TransformSchema(schema, options);
1381JsonElement schema = JsonDocument.Parse("""
1393JsonElement expectedSchema = JsonDocument.Parse("""
1411JsonElement transformedSchema = AIJsonUtilities.TransformSchema(schema, options);
1418JsonElement schema = JsonDocument.Parse("""
1426JsonElement expectedSchema = JsonDocument.Parse("""
1438JsonElement transformedSchema = AIJsonUtilities.TransformSchema(schema, options);
1457JsonElement schema = AIJsonUtilities.CreateJsonSchema(testData.Type, serializerOptions: options, inferenceOptions: createOptions);
1475JsonElement transformedSchema = AIJsonUtilities.TransformSchema(schema, transformOptions);
1509JsonElement schema = JsonDocument.Parse("{}").RootElement;
1522JsonElement schema = JsonDocument.Parse(invalidSchema).RootElement;
1534JsonElement schema = JsonDocument.Parse(booleanSchema).RootElement;
1538JsonElement result = AIJsonUtilities.TransformSchema(schema, transformOptions);
1550Assert.True(result.TryGetProperty("not", out JsonElement notValue));
1560[JsonSerializable(typeof(JsonElement))]
1569private static bool DeepEquals(JsonElement element1, JsonElement element2)
1571return JsonElement.DeepEquals(element1, element2);
1574private static void AssertDeepEquals(JsonElement element1, JsonElement element2)
Microsoft.Extensions.AI.Evaluation.Safety (4)
Microsoft.Extensions.AI.Integration.Tests (7)
Microsoft.Extensions.AI.OpenAI (5)
Microsoft.Extensions.AI.OpenAI.Tests (30)
OpenAIConversionTests.cs (16)
113var jsonSchema = JsonDocument.Parse("""
144var root = parsedParams.RootElement;
146Assert.True(root.TryGetProperty("$defs", out var defs), "The $defs property should be preserved in the function parameters");
147Assert.True(defs.TryGetProperty("Person", out var person), "The Person definition should exist in $defs");
148Assert.True(person.TryGetProperty("properties", out var properties), "Person should have properties");
623var root = jsonDoc.RootElement;
626Assert.True(root.TryGetProperty("properties", out var properties));
627Assert.True(properties.TryGetProperty("name", out var nameProperty));
687Assert.True(JsonElement.DeepEquals(JsonSerializer.SerializeToElement(new Dictionary<string, object?>
691}), JsonElement.Parse(tc.FunctionArguments.ToMemory().Span)));
743Assert.True(JsonElement.DeepEquals(JsonSerializer.SerializeToElement(new Dictionary<string, object?>
747}), JsonElement.Parse(m3.FunctionArguments.ToMemory().Span)));
1080Assert.Equal(42, ((JsonElement)deserializedArgs["number"]!).GetInt32());
1081Assert.True(((JsonElement)deserializedArgs["boolean"]!).GetBoolean());
1084var nestedObj = (JsonElement)deserializedArgs["nestedObject"]!;
Microsoft.Extensions.AI.Tests (42)
Functions\AIFunctionFactoryTest.cs (29)
158AIFunction func = AIFunctionFactory.Create((JsonElement param) => param, serializerOptions: options);
159JsonElement expectedResult = JsonDocument.Parse(jsonStringParam, new() { CommentHandling = JsonCommentHandling.Skip }).RootElement;
178AIFunction func = AIFunctionFactory.Create((JsonElement param) => param);
179JsonElement expectedResult = JsonDocument.Parse(JsonSerializer.Serialize(invalidJsonParam, JsonContext.Default.String)).RootElement;
375var result = (JsonElement?)await func.InvokeAsync(new()
1003JsonElement expectedSchema = JsonDocument.Parse("""
1036JsonElement expectedSchema = JsonDocument.Parse("""
1073JsonElement schema = AIJsonUtilities.CreateJsonSchema(typeof(int), serializerOptions: AIJsonUtilities.DefaultOptions);
1325JsonElement schema = func.JsonSchema;
1326JsonElement properties = schema.GetProperty("properties");
1329JsonElement nullableIntSchema = properties.GetProperty("nullableInt");
1331nullableIntSchema.TryGetProperty("type", out JsonElement nullableIntType),
1338JsonElement nullableIntWithDefaultSchema = properties.GetProperty("nullableIntWithDefault");
1340nullableIntWithDefaultSchema.TryGetProperty("type", out JsonElement nullableIntWithDefaultType),
1346nullableIntWithDefaultSchema.TryGetProperty("default", out JsonElement nullableIntWithDefaultDefault),
1351JsonElement required = schema.GetProperty("required");
1365JsonElement schema = func.JsonSchema;
1366JsonElement properties = schema.GetProperty("properties");
1369JsonElement nullableStringSchema = properties.GetProperty("nullableString");
1371nullableStringSchema.TryGetProperty("type", out JsonElement nullableStringType),
1378JsonElement nullableIntSchema = properties.GetProperty("nullableInt");
1380nullableIntSchema.TryGetProperty("type", out JsonElement nullableIntType),
1387JsonElement nullableStringWithDefaultSchema = properties.GetProperty("nullableStringWithDefault");
1389nullableStringWithDefaultSchema.TryGetProperty("type", out JsonElement nullableStringWithDefaultType),
1395nullableStringWithDefaultSchema.TryGetProperty("default", out JsonElement nullableStringWithDefaultDefault),
1400JsonElement nullableIntWithDefaultSchema = properties.GetProperty("nullableIntWithDefault");
1402nullableIntWithDefaultSchema.TryGetProperty("type", out JsonElement nullableIntWithDefaultType),
1408nullableIntWithDefaultSchema.TryGetProperty("default", out JsonElement nullableIntWithDefaultDefault),
1413JsonElement required = schema.GetProperty("required");
Microsoft.Extensions.Configuration.Json (4)
Microsoft.JSInterop.Tests (3)
Microsoft.ML.GenAI.Phi (4)
Microsoft.ML.Tokenizers.Tests (29)
BpeTests.cs (25)
956JsonElement root = doc.RootElement;
957if (!root.TryGetProperty("model", out JsonElement modelElement) ||
959!modelElement.TryGetProperty("type", out JsonElement typeElement) ||
961!modelElement.TryGetProperty("vocab", out JsonElement vocabElement) ||
969if (modelElement.TryGetProperty("unk_token", out JsonElement unKnownElement))
974if (modelElement.TryGetProperty("continuing_subword_prefix", out JsonElement continuingSubwordPrefixElement))
979if (modelElement.TryGetProperty("end_of_word_suffix", out JsonElement endOfWordSuffixElement))
984if (modelElement.TryGetProperty("fuse_unknown_tokens", out JsonElement fuseUnknownTokensElement))
1004private static IEnumerable<KeyValuePair<string, int>> GetVocabulary(JsonElement vocabElement)
1012private static IEnumerable<string> GetMerges(JsonElement modelElement)
1014if (modelElement.TryGetProperty("merges", out JsonElement mergesElement) && mergesElement.ValueKind == JsonValueKind.Array)
1016foreach (JsonElement merge in mergesElement.EnumerateArray())
1028private static IReadOnlyList<PreTokenizer>? GetPreTokenizer(JsonElement root, out bool byteLevel)
1033if (root.TryGetProperty("pre_tokenizer", out JsonElement preTokenizerElement) &&
1035preTokenizerElement.TryGetProperty("type", out JsonElement typeElement) &&
1038preTokenizerElement.TryGetProperty("pretokenizers", out JsonElement preTokenizersElement) &&
1041foreach (JsonElement preTokenizer in preTokenizersElement.EnumerateArray())
1044preTokenizer.TryGetProperty("type", out JsonElement preTokenizerTypeElement) &&
1050if (preTokenizer.TryGetProperty("pattern", out JsonElement patternElement) &&
1052patternElement.TryGetProperty("Regex", out JsonElement regexElement) &&
1073private static Dictionary<string, int>? GetSpecialTokens(JsonElement root)
1075if (root.TryGetProperty("added_tokens", out JsonElement modelElement) && modelElement.ValueKind == JsonValueKind.Array)
1078foreach (JsonElement token in modelElement.EnumerateArray())
1080if (token.TryGetProperty("content", out JsonElement contentElement) &&
1082token.TryGetProperty("id", out JsonElement idElement) && idElement.ValueKind == JsonValueKind.Number)
Negotiate.Client (2)
OpenIdConnectSample (2)
Shared.Tests (4)
SocialSample (2)
System.Text.Json (209)
System\Text\Json\Document\JsonElement.cs (27)
62public JsonElement this[int index]
107/// Gets a <see cref="JsonElement"/> representing the value of a required property identified
118/// A <see cref="JsonElement"/> representing the value of the requested property.
133public JsonElement GetProperty(string propertyName)
137if (TryGetProperty(propertyName, out JsonElement property))
146/// Gets a <see cref="JsonElement"/> representing the value of a required property identified
161/// A <see cref="JsonElement"/> representing the value of the requested property.
173public JsonElement GetProperty(ReadOnlySpan<char> propertyName)
175if (TryGetProperty(propertyName, out JsonElement property))
184/// Gets a <see cref="JsonElement"/> representing the value of a required property identified
201/// A <see cref="JsonElement"/> representing the value of the requested property.
213public JsonElement GetProperty(ReadOnlySpan<byte> utf8PropertyName)
215if (TryGetProperty(utf8PropertyName, out JsonElement property))
253public bool TryGetProperty(string propertyName, out JsonElement value)
287public bool TryGetProperty(ReadOnlySpan<char> propertyName, out JsonElement value)
323public bool TryGetProperty(ReadOnlySpan<byte> utf8PropertyName, out JsonElement value)
1237/// Compares the values of two <see cref="JsonElement"/> values for equality, including the values of all descendant elements.
1239/// <param name="element1">The first <see cref="JsonElement"/> to compare.</param>
1240/// <param name="element2">The second <see cref="JsonElement"/> to compare.</param>
1257public static bool DeepEquals(JsonElement element1, JsonElement element2)
1303foreach (JsonElement e1 in element1.EnumerateArray())
1367Dictionary<string, ValueQueue<JsonElement>> properties2 = new(capacity: remainingProps, StringComparer.Ordinal);
1372ref ValueQueue<JsonElement> values = ref CollectionsMarshal.GetValueRefOrAddDefault(properties2, prop2.Name, out bool _);
1387ref ValueQueue<JsonElement> values = ref CollectionsMarshal.GetValueRefOrAddDefault(properties2, prop.Name, out bool exists);
1391if (!exists || !values.TryDequeue(out JsonElement value) || !DeepEquals(prop.Value, value))
1692public JsonElement Clone()
System\Text\Json\Serialization\JsonSerializer.Write.Element.cs (19)
14/// Converts the provided value into a <see cref="JsonElement"/>.
17/// <returns>A <see cref="JsonElement"/> representation of the JSON value.</returns>
26public static JsonElement SerializeToElement<TValue>(TValue value, JsonSerializerOptions? options = null)
33/// Converts the provided value into a <see cref="JsonElement"/>.
35/// <returns>A <see cref="JsonElement"/> representation of the value.</returns>
51public static JsonElement SerializeToElement(object? value, Type inputType, JsonSerializerOptions? options = null)
59/// Converts the provided value into a <see cref="JsonElement"/>.
62/// <returns>A <see cref="JsonElement"/> representation of the value.</returns>
68public static JsonElement SerializeToElement<TValue>(TValue value, JsonTypeInfo<TValue> jsonTypeInfo)
77/// Converts the provided value into a <see cref="JsonElement"/>.
79/// <returns>A <see cref="JsonElement"/> representation of the value.</returns>
88public static JsonElement SerializeToElement(object? value, JsonTypeInfo jsonTypeInfo)
97/// Converts the provided value into a <see cref="JsonElement"/>.
99/// <returns>A <see cref="JsonElement"/> representation of the value.</returns>
114public static JsonElement SerializeToElement(object? value, Type inputType, JsonSerializerContext context)
123private static JsonElement WriteElement<TValue>(in TValue value, JsonTypeInfo<TValue> jsonTypeInfo)
133return JsonElement.Parse(output.WrittenSpan, options.GetDocumentOptions());
141private static JsonElement WriteElementAsObject(object? value, JsonTypeInfo jsonTypeInfo)
151return JsonElement.Parse(output.WrittenSpan, options.GetDocumentOptions());
Templates.Blazor.Tests (4)
Templates.Blazor.WebAssembly.Auth.Tests (4)
Templates.Blazor.WebAssembly.Tests (4)
Templates.Mvc.Tests (4)
Templates.Tests (4)