File: _generated\42\RunFileJsonSerializerContext.RunProperties.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
{
    internal partial class RunFileJsonSerializerContext
    {
        private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.DotNet.Cli.Commands.Run.RunProperties>? _RunProperties;
        
        /// <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.RunProperties> RunProperties
        #nullable enable annotations
        {
            get => _RunProperties ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.DotNet.Cli.Commands.Run.RunProperties>)Options.GetTypeInfo(typeof(global::Microsoft.DotNet.Cli.Commands.Run.RunProperties));
        }
        
        private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.DotNet.Cli.Commands.Run.RunProperties> Create_RunProperties(global::System.Text.Json.JsonSerializerOptions options)
        {
            if (!TryGetTypeInfoForRuntimeCustomConverter<global::Microsoft.DotNet.Cli.Commands.Run.RunProperties>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.DotNet.Cli.Commands.Run.RunProperties> jsonTypeInfo))
            {
                var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues<global::Microsoft.DotNet.Cli.Commands.Run.RunProperties>
                {
                    ObjectCreator = null,
                    ObjectWithParameterizedConstructorCreator = static args => new global::Microsoft.DotNet.Cli.Commands.Run.RunProperties((string)args[0], (string)args[1], (string)args[2], (string)args[3], (string)args[4], (string)args[5]),
                    PropertyMetadataInitializer = _ => RunPropertiesPropInit(options),
                    ConstructorParameterMetadataInitializer = RunPropertiesCtorParamInit,
                    ConstructorAttributeProviderFactory = static () => typeof(global::Microsoft.DotNet.Cli.Commands.Run.RunProperties).GetConstructor(InstanceMemberBindingFlags, binder: null, new[] {typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string)}, modifiers: null),
                    SerializeHandler = RunPropertiesSerializeHandler,
                };
                
                jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo<global::Microsoft.DotNet.Cli.Commands.Run.RunProperties>(options, objectInfo);
                jsonTypeInfo.NumberHandling = null;
            }
        
            jsonTypeInfo.OriginatingResolver = this;
            return jsonTypeInfo;
        }

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

            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.RunProperties),
                Converter = null,
                Getter = static obj => ((global::Microsoft.DotNet.Cli.Commands.Run.RunProperties)obj).Command,
                Setter = static (obj, value) => __set_RunProperties_Command((global::Microsoft.DotNet.Cli.Commands.Run.RunProperties)obj, value!),
                IgnoreCondition = null,
                HasJsonInclude = false,
                IsExtensionData = false,
                NumberHandling = null,
                PropertyName = "Command",
                JsonPropertyName = null,
                AttributeProviderFactory = static () => typeof(global::Microsoft.DotNet.Cli.Commands.Run.RunProperties).GetProperty("Command", 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].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.RunProperties),
                Converter = null,
                Getter = static obj => ((global::Microsoft.DotNet.Cli.Commands.Run.RunProperties)obj).Arguments,
                Setter = static (obj, value) => __set_RunProperties_Arguments((global::Microsoft.DotNet.Cli.Commands.Run.RunProperties)obj, value!),
                IgnoreCondition = null,
                HasJsonInclude = false,
                IsExtensionData = false,
                NumberHandling = null,
                PropertyName = "Arguments",
                JsonPropertyName = null,
                AttributeProviderFactory = static () => typeof(global::Microsoft.DotNet.Cli.Commands.Run.RunProperties).GetProperty("Arguments", 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);

            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.RunProperties),
                Converter = null,
                Getter = static obj => ((global::Microsoft.DotNet.Cli.Commands.Run.RunProperties)obj).WorkingDirectory,
                Setter = static (obj, value) => __set_RunProperties_WorkingDirectory((global::Microsoft.DotNet.Cli.Commands.Run.RunProperties)obj, value!),
                IgnoreCondition = null,
                HasJsonInclude = false,
                IsExtensionData = false,
                NumberHandling = null,
                PropertyName = "WorkingDirectory",
                JsonPropertyName = null,
                AttributeProviderFactory = static () => typeof(global::Microsoft.DotNet.Cli.Commands.Run.RunProperties).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);

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

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

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

            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 RunPropertiesSerializeHandler(global::System.Text.Json.Utf8JsonWriter writer, global::Microsoft.DotNet.Cli.Commands.Run.RunProperties? value)
        {
            if (value is null)
            {
                writer.WriteNullValue();
                return;
            }
            
            writer.WriteStartObject();

            writer.WriteString(PropName_Command, ((global::Microsoft.DotNet.Cli.Commands.Run.RunProperties)value).Command);
            writer.WriteString(PropName_Arguments, ((global::Microsoft.DotNet.Cli.Commands.Run.RunProperties)value).Arguments);
            writer.WriteString(PropName_WorkingDirectory, ((global::Microsoft.DotNet.Cli.Commands.Run.RunProperties)value).WorkingDirectory);
            writer.WriteString(PropName_RuntimeIdentifier, ((global::Microsoft.DotNet.Cli.Commands.Run.RunProperties)value).RuntimeIdentifier);
            writer.WriteString(PropName_DefaultAppHostRuntimeIdentifier, ((global::Microsoft.DotNet.Cli.Commands.Run.RunProperties)value).DefaultAppHostRuntimeIdentifier);
            writer.WriteString(PropName_TargetFrameworkVersion, ((global::Microsoft.DotNet.Cli.Commands.Run.RunProperties)value).TargetFrameworkVersion);

            writer.WriteEndObject();
        }

        private static global::System.Text.Json.Serialization.Metadata.JsonParameterInfoValues[] RunPropertiesCtorParamInit() => new global::System.Text.Json.Serialization.Metadata.JsonParameterInfoValues[]
        {
            new()
            {
                Name = "Command",
                ParameterType = typeof(string),
                Position = 0,
                HasDefaultValue = false,
                DefaultValue = null,
                IsNullable = false,
            },

            new()
            {
                Name = "Arguments",
                ParameterType = typeof(string),
                Position = 1,
                HasDefaultValue = false,
                DefaultValue = null,
                IsNullable = true,
            },

            new()
            {
                Name = "WorkingDirectory",
                ParameterType = typeof(string),
                Position = 2,
                HasDefaultValue = false,
                DefaultValue = null,
                IsNullable = true,
            },

            new()
            {
                Name = "RuntimeIdentifier",
                ParameterType = typeof(string),
                Position = 3,
                HasDefaultValue = false,
                DefaultValue = null,
                IsNullable = false,
            },

            new()
            {
                Name = "DefaultAppHostRuntimeIdentifier",
                ParameterType = typeof(string),
                Position = 4,
                HasDefaultValue = false,
                DefaultValue = null,
                IsNullable = false,
            },

            new()
            {
                Name = "TargetFrameworkVersion",
                ParameterType = typeof(string),
                Position = 5,
                HasDefaultValue = false,
                DefaultValue = null,
                IsNullable = false,
            },
        };

        [global::System.Runtime.CompilerServices.UnsafeAccessorAttribute(global::System.Runtime.CompilerServices.UnsafeAccessorKind.Method, Name = "set_Command")]
        private static extern void __set_RunProperties_Command(global::Microsoft.DotNet.Cli.Commands.Run.RunProperties obj, string value);
        [global::System.Runtime.CompilerServices.UnsafeAccessorAttribute(global::System.Runtime.CompilerServices.UnsafeAccessorKind.Method, Name = "set_Arguments")]
        private static extern void __set_RunProperties_Arguments(global::Microsoft.DotNet.Cli.Commands.Run.RunProperties obj, string value);
        [global::System.Runtime.CompilerServices.UnsafeAccessorAttribute(global::System.Runtime.CompilerServices.UnsafeAccessorKind.Method, Name = "set_WorkingDirectory")]
        private static extern void __set_RunProperties_WorkingDirectory(global::Microsoft.DotNet.Cli.Commands.Run.RunProperties obj, string value);
        [global::System.Runtime.CompilerServices.UnsafeAccessorAttribute(global::System.Runtime.CompilerServices.UnsafeAccessorKind.Method, Name = "set_RuntimeIdentifier")]
        private static extern void __set_RunProperties_RuntimeIdentifier(global::Microsoft.DotNet.Cli.Commands.Run.RunProperties obj, string value);
        [global::System.Runtime.CompilerServices.UnsafeAccessorAttribute(global::System.Runtime.CompilerServices.UnsafeAccessorKind.Method, Name = "set_DefaultAppHostRuntimeIdentifier")]
        private static extern void __set_RunProperties_DefaultAppHostRuntimeIdentifier(global::Microsoft.DotNet.Cli.Commands.Run.RunProperties obj, string value);
        [global::System.Runtime.CompilerServices.UnsafeAccessorAttribute(global::System.Runtime.CompilerServices.UnsafeAccessorKind.Method, Name = "set_TargetFrameworkVersion")]
        private static extern void __set_RunProperties_TargetFrameworkVersion(global::Microsoft.DotNet.Cli.Commands.Run.RunProperties obj, string value);
    }
}