File: _generated\25\RunFileApiJsonSerializerContext.RunCommand.g.cs
Web Access
Project: src\src\sdk\src\Cli\dotnet\dotnet.csproj (dotnet)
// <auto-generated/>

#nullable enable annotations
#nullable disable warnings

// Suppress warnings about [Obsolete] member usage in generated code.
#pragma warning disable CS0612, CS0618

namespace Microsoft.DotNet.Cli.Commands.Run.Api
{
    internal partial class RunFileApiJsonSerializerContext
    {
        private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.DotNet.Cli.Commands.Run.Api.RunApiOutput.RunCommand>? _RunCommand;
        
        /// <summary>
        /// Defines the source generated JSON serialization contract metadata for a given type.
        /// </summary>
        #nullable disable annotations // Marking the property type as nullable-oblivious.
        public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.DotNet.Cli.Commands.Run.Api.RunApiOutput.RunCommand> RunCommand
        #nullable enable annotations
        {
            get => _RunCommand ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.DotNet.Cli.Commands.Run.Api.RunApiOutput.RunCommand>)Options.GetTypeInfo(typeof(global::Microsoft.DotNet.Cli.Commands.Run.Api.RunApiOutput.RunCommand));
        }
        
        private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.DotNet.Cli.Commands.Run.Api.RunApiOutput.RunCommand> Create_RunCommand(global::System.Text.Json.JsonSerializerOptions options)
        {
            if (!TryGetTypeInfoForRuntimeCustomConverter<global::Microsoft.DotNet.Cli.Commands.Run.Api.RunApiOutput.RunCommand>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.DotNet.Cli.Commands.Run.Api.RunApiOutput.RunCommand> jsonTypeInfo))
            {
                var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues<global::Microsoft.DotNet.Cli.Commands.Run.Api.RunApiOutput.RunCommand>
                {
                    ObjectCreator = null,
                    ObjectWithParameterizedConstructorCreator = static args => new global::Microsoft.DotNet.Cli.Commands.Run.Api.RunApiOutput.RunCommand(){ ExecutablePath = (string)args[0], CommandLineArguments = (string)args[1], WorkingDirectory = (string)args[2], EnvironmentVariables = (global::System.Collections.Generic.IReadOnlyDictionary<string, string>)args[3] },
                    PropertyMetadataInitializer = _ => RunCommandPropInit(options),
                    ConstructorParameterMetadataInitializer = RunCommandCtorParamInit,
                    ConstructorAttributeProviderFactory = static () => typeof(global::Microsoft.DotNet.Cli.Commands.Run.Api.RunApiOutput.RunCommand).GetConstructor(InstanceMemberBindingFlags, binder: null, global::System.Array.Empty<global::System.Type>(), modifiers: null),
                    SerializeHandler = RunCommandSerializeHandler,
                };
                
                jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo<global::Microsoft.DotNet.Cli.Commands.Run.Api.RunApiOutput.RunCommand>(options, objectInfo);
                jsonTypeInfo.NumberHandling = null;
            }
        
            jsonTypeInfo.OriginatingResolver = this;
            return jsonTypeInfo;
        }

        private static global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[] RunCommandPropInit(global::System.Text.Json.JsonSerializerOptions options)
        {
            var properties = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[5];

            var info0 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<string>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::Microsoft.DotNet.Cli.Commands.Run.Api.RunApiOutput.RunCommand),
                Converter = null,
                Getter = static obj => ((global::Microsoft.DotNet.Cli.Commands.Run.Api.RunApiOutput.RunCommand)obj).ExecutablePath,
                Setter = static (obj, value) => __set_RunCommand_ExecutablePath((global::Microsoft.DotNet.Cli.Commands.Run.Api.RunApiOutput.RunCommand)obj, value!),
                IgnoreCondition = null,
                HasJsonInclude = false,
                IsExtensionData = false,
                NumberHandling = null,
                PropertyName = "ExecutablePath",
                JsonPropertyName = null,
                AttributeProviderFactory = static () => typeof(global::Microsoft.DotNet.Cli.Commands.Run.Api.RunApiOutput.RunCommand).GetProperty("ExecutablePath", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null),
            };
            
            properties[0] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<string>(options, info0);
            properties[0].IsRequired = true;
            properties[0].IsGetNullable = false;
            properties[0].IsSetNullable = false;

            var info1 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<string>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::Microsoft.DotNet.Cli.Commands.Run.Api.RunApiOutput.RunCommand),
                Converter = null,
                Getter = static obj => ((global::Microsoft.DotNet.Cli.Commands.Run.Api.RunApiOutput.RunCommand)obj).CommandLineArguments,
                Setter = static (obj, value) => __set_RunCommand_CommandLineArguments((global::Microsoft.DotNet.Cli.Commands.Run.Api.RunApiOutput.RunCommand)obj, value!),
                IgnoreCondition = null,
                HasJsonInclude = false,
                IsExtensionData = false,
                NumberHandling = null,
                PropertyName = "CommandLineArguments",
                JsonPropertyName = null,
                AttributeProviderFactory = static () => typeof(global::Microsoft.DotNet.Cli.Commands.Run.Api.RunApiOutput.RunCommand).GetProperty("CommandLineArguments", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null),
            };
            
            properties[1] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<string>(options, info1);
            properties[1].IsRequired = true;
            properties[1].IsGetNullable = false;
            properties[1].IsSetNullable = false;

            var info2 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<string>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::Microsoft.DotNet.Cli.Commands.Run.Api.RunApiOutput.RunCommand),
                Converter = null,
                Getter = static obj => ((global::Microsoft.DotNet.Cli.Commands.Run.Api.RunApiOutput.RunCommand)obj).WorkingDirectory,
                Setter = static (obj, value) => __set_RunCommand_WorkingDirectory((global::Microsoft.DotNet.Cli.Commands.Run.Api.RunApiOutput.RunCommand)obj, value!),
                IgnoreCondition = null,
                HasJsonInclude = false,
                IsExtensionData = false,
                NumberHandling = null,
                PropertyName = "WorkingDirectory",
                JsonPropertyName = null,
                AttributeProviderFactory = static () => typeof(global::Microsoft.DotNet.Cli.Commands.Run.Api.RunApiOutput.RunCommand).GetProperty("WorkingDirectory", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null),
            };
            
            properties[2] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<string>(options, info2);
            properties[2].IsRequired = true;

            var info3 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<global::System.Collections.Generic.IReadOnlyDictionary<string, string>>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::Microsoft.DotNet.Cli.Commands.Run.Api.RunApiOutput.RunCommand),
                Converter = null,
                Getter = static obj => ((global::Microsoft.DotNet.Cli.Commands.Run.Api.RunApiOutput.RunCommand)obj).EnvironmentVariables,
                Setter = static (obj, value) => __set_RunCommand_EnvironmentVariables((global::Microsoft.DotNet.Cli.Commands.Run.Api.RunApiOutput.RunCommand)obj, value!),
                IgnoreCondition = null,
                HasJsonInclude = false,
                IsExtensionData = false,
                NumberHandling = null,
                PropertyName = "EnvironmentVariables",
                JsonPropertyName = null,
                AttributeProviderFactory = static () => typeof(global::Microsoft.DotNet.Cli.Commands.Run.Api.RunApiOutput.RunCommand).GetProperty("EnvironmentVariables", InstanceMemberBindingFlags, null, typeof(global::System.Collections.Generic.IReadOnlyDictionary<string, string>), global::System.Array.Empty<global::System.Type>(), null),
            };
            
            properties[3] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<global::System.Collections.Generic.IReadOnlyDictionary<string, string>>(options, info3);
            properties[3].IsRequired = true;
            properties[3].IsGetNullable = false;
            properties[3].IsSetNullable = false;

            var info4 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<int>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::Microsoft.DotNet.Cli.Commands.Run.Api.RunApiOutput),
                Converter = null,
                Getter = static obj => ((global::Microsoft.DotNet.Cli.Commands.Run.Api.RunApiOutput)obj).Version,
                Setter = null,
                IgnoreCondition = null,
                HasJsonInclude = false,
                IsExtensionData = false,
                NumberHandling = null,
                PropertyName = "Version",
                JsonPropertyName = null,
                AttributeProviderFactory = static () => typeof(global::Microsoft.DotNet.Cli.Commands.Run.Api.RunApiOutput).GetProperty("Version", InstanceMemberBindingFlags, null, typeof(int), global::System.Array.Empty<global::System.Type>(), null),
            };
            
            properties[4] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<int>(options, info4);
            properties[4].Order = -1;

            return properties;
        }

        // Intentionally not a static method because we create a delegate to it. Invoking delegates to instance
        // methods is almost as fast as virtual calls. Static methods need to go through a shuffle thunk.
        private void RunCommandSerializeHandler(global::System.Text.Json.Utf8JsonWriter writer, global::Microsoft.DotNet.Cli.Commands.Run.Api.RunApiOutput.RunCommand? value)
        {
            if (value is null)
            {
                writer.WriteNullValue();
                return;
            }
            
            writer.WriteStartObject();

            writer.WriteNumber(PropName_Version, ((global::Microsoft.DotNet.Cli.Commands.Run.Api.RunApiOutput)value).Version);
            writer.WriteString(PropName_ExecutablePath, ((global::Microsoft.DotNet.Cli.Commands.Run.Api.RunApiOutput.RunCommand)value).ExecutablePath);
            writer.WriteString(PropName_CommandLineArguments, ((global::Microsoft.DotNet.Cli.Commands.Run.Api.RunApiOutput.RunCommand)value).CommandLineArguments);
            writer.WriteString(PropName_WorkingDirectory, ((global::Microsoft.DotNet.Cli.Commands.Run.Api.RunApiOutput.RunCommand)value).WorkingDirectory);
            writer.WritePropertyName(PropName_EnvironmentVariables);
            IReadOnlyDictionaryStringStringSerializeHandler(writer, ((global::Microsoft.DotNet.Cli.Commands.Run.Api.RunApiOutput.RunCommand)value).EnvironmentVariables);

            writer.WriteEndObject();
        }

        private static global::System.Text.Json.Serialization.Metadata.JsonParameterInfoValues[] RunCommandCtorParamInit() => new global::System.Text.Json.Serialization.Metadata.JsonParameterInfoValues[]
        {
            new()
            {
                Name = "ExecutablePath",
                ParameterType = typeof(string),
                Position = 0,
                IsNullable = false,
                IsMemberInitializer = true,
            },

            new()
            {
                Name = "CommandLineArguments",
                ParameterType = typeof(string),
                Position = 1,
                IsNullable = false,
                IsMemberInitializer = true,
            },

            new()
            {
                Name = "WorkingDirectory",
                ParameterType = typeof(string),
                Position = 2,
                IsNullable = true,
                IsMemberInitializer = true,
            },

            new()
            {
                Name = "EnvironmentVariables",
                ParameterType = typeof(global::System.Collections.Generic.IReadOnlyDictionary<string, string>),
                Position = 3,
                IsNullable = false,
                IsMemberInitializer = true,
            },
        };

        [global::System.Runtime.CompilerServices.UnsafeAccessorAttribute(global::System.Runtime.CompilerServices.UnsafeAccessorKind.Method, Name = "set_ExecutablePath")]
        private static extern void __set_RunCommand_ExecutablePath(global::Microsoft.DotNet.Cli.Commands.Run.Api.RunApiOutput.RunCommand obj, string value);
        [global::System.Runtime.CompilerServices.UnsafeAccessorAttribute(global::System.Runtime.CompilerServices.UnsafeAccessorKind.Method, Name = "set_CommandLineArguments")]
        private static extern void __set_RunCommand_CommandLineArguments(global::Microsoft.DotNet.Cli.Commands.Run.Api.RunApiOutput.RunCommand obj, string value);
        [global::System.Runtime.CompilerServices.UnsafeAccessorAttribute(global::System.Runtime.CompilerServices.UnsafeAccessorKind.Method, Name = "set_WorkingDirectory")]
        private static extern void __set_RunCommand_WorkingDirectory(global::Microsoft.DotNet.Cli.Commands.Run.Api.RunApiOutput.RunCommand obj, string value);
        [global::System.Runtime.CompilerServices.UnsafeAccessorAttribute(global::System.Runtime.CompilerServices.UnsafeAccessorKind.Method, Name = "set_EnvironmentVariables")]
        private static extern void __set_RunCommand_EnvironmentVariables(global::Microsoft.DotNet.Cli.Commands.Run.Api.RunApiOutput.RunCommand obj, global::System.Collections.Generic.IReadOnlyDictionary<string, string> value);
    }
}