JobStructForLambdaJob(LambdaJobDescriptionConstruction lambdaJobDescriptionConstruction2)
        {
            LambdaJobDescriptionConstruction = lambdaJobDescriptionConstruction2;
            var containingMethod = LambdaJobDescriptionConstruction.ContainingMethod;

            if (containingMethod.DeclaringType.NestedTypes.Any(t => t.Name == LambdaJobDescriptionConstruction.Name))
            {
                UserError.DC0003(LambdaJobDescriptionConstruction.Name, containingMethod, LambdaJobDescriptionConstruction.ScheduleOrRunInvocationInstruction).Throw();
            }

            var moduleDefinition = containingMethod.Module;

            var typeAttributes = TypeAttributes.BeforeFieldInit | TypeAttributes.Sealed |
                                 TypeAttributes.AnsiClass | TypeAttributes.SequentialLayout |
                                 TypeAttributes.NestedPrivate;

            TypeDefinition = new TypeDefinition(containingMethod.DeclaringType.Namespace, LambdaJobDescriptionConstruction.Name, typeAttributes, moduleDefinition.ImportReference(typeof(ValueType)))
            {
                DeclaringType = containingMethod.DeclaringType,
                Interfaces    = { new InterfaceImplementation(moduleDefinition.ImportReference(InterfaceTypeFor(LambdaJobDescriptionConstruction.Kind))) }
            };

            containingMethod.DeclaringType.NestedTypes.Add(TypeDefinition);


            if (LambdaJobDescriptionConstruction.LambdaWasEmittedAsInstanceMethodOnContainingType)
            {
                //if you capture no locals, but you do use a field/method on the componentsystem, the lambda gets emitted as an instance method on the component system
                //this is inconvenient for us. To make the rest of our code not have to deal with this case, we will emit an OriginalLambda method on our job type, that calls
                //the lambda as it is emitted as an instance method on the component system.  See EntitiesForEachNonCapturingInvokingInstanceMethod test for more details.
                //example:
                //https://sharplab.io/#v2:CYLg1APgAgTAjAWAFBQMwAJboMLoN7LpGYZQAs6AsgJ4CSAdgM4AuAhvQMYCmlXzAFgHtgACgCU+AL6FiMomkwVK4/HOJEAogA8uHAK7MuIlQF4AfFTpM2nHnyGixYgNxrpSdVDgA2Rem26BkZeMOisYnjukkA==

                MakeOriginalLambdaMethodThatRelaysToInstanceMethodOnComponentSystem();
            }
            else
            {
                CloneLambdaMethodAndItsLocalMethods();
            }

            ApplyFieldAttributes();

            var lambdaParameterValueProviderInformations = MakeLambdaParameterValueProviderInformations();

            MakeDeallocateOnCompletionMethod();

            ExecuteMethod = MakeExecuteMethod(lambdaParameterValueProviderInformations);

            ScheduleTimeInitializeMethod = AddMethod(MakeScheduleTimeInitializeMethod(lambdaParameterValueProviderInformations));

            AddRunWithoutJobSystemMembers();

            ApplyBurstAttributeIfRequired();
        }