public HasEqualityCheckerTests()
 {
     var moduleDefinition = ModuleDefinition.ReadModule(GetType().Assembly.Location);
     var typeDefinition = moduleDefinition.Types.First(definition => definition.Name == "HasEqualityCheckerTests");
     properties = typeDefinition.Properties;
     fields = typeDefinition.Fields;
 }
Example #2
0
        private static object BuildSupportedStandards(Mono.Collections.Generic.Collection <CustomAttributeArgument> supportedStandardsAttribute)
        {
            if (supportedStandardsAttribute == null || supportedStandardsAttribute.Count == 0)
            {
                return("[]");
            }

            var    entry = supportedStandardsAttribute.First();
            string extra = "[";

            foreach (var item in entry.Value as CustomAttributeArgument[])
            {
                extra += ($"\"{ScapeJson(item.Value.ToString())}\",");
            }
            extra  = extra[0..^ 1];
Example #3
0
        protected void WriteMethodsStubs(MethodDefinition mdef, Mono.Collections.Generic.Collection <MethodDefinition> methods,
                                         string rskw, string rekw)
        {
            Write(rskw);
            WriteLine("\" Methods stubs \"");
            WriteComment("Do not add or update any method. If compilation fails because of a method declaration, comment it");
            foreach (var smdef in FilterAutogeneratedMembers(methods.Where(smdef => mdef != smdef)))
            {
                WriteMethodSignature(smdef);
                WriteMethodBody(smdef);
                WriteLine();
            }

            WriteLine(rekw);
        }
		public void VisitEventDefinitionCollection(Mono.Collections.Generic.Collection<EventDefinition> events)
		{
			foreach (EventDefinition evt in events)
			{
				AppendNode(evt.DeclaringType, evt, true);
				if (evt.AddMethod != null)
				{
					AppendNode(evt, evt.AddMethod, false);
				}
				if (evt.RemoveMethod != null)
				{
					AppendNode(evt, evt.RemoveMethod, false);
				}
			}
		}
Example #5
0
        private void ExtractExplicitMethodOverrides(AnalysisNet.Types.TypeDefinition type, Cecil.TypeDefinition typeDefinition)
        {
            foreach (Cecil.MethodDefinition method in typeDefinition.Methods)
            {
                AnalysisNet.Types.IMethodReference implementingMethod = ExtractMethod(method);
                Mono.Collections.Generic.Collection <Cecil.MethodReference> overrides = method.Overrides;

                foreach (Cecil.MethodReference implemented in overrides)
                {
                    AnalysisNet.Types.IMethodReference     implementedMethod    = ExtractMethod(implemented);
                    AnalysisNet.Types.MethodImplementation methodImplementation = new AnalysisNet.Types.MethodImplementation(implementedMethod, implementingMethod);
                    type.ExplicitOverrides.Add(methodImplementation);
                }
            }
        }
Example #6
0
 static void RemoveWhere <T>(Mono.Collections.Generic.Collection <T> list, Func <T, bool> predicate, Action <T> removalCheck = null)
 {
     for (int i = list.Count - 1; i >= 0; i--)
     {
         var item = list [i];
         if (predicate(item))
         {
             if (removalCheck != null)
             {
                 removalCheck(item);
             }
             list.RemoveAt(i);
         }
     }
 }
Example #7
0
 public void VisitPropertyDefinitionCollection(Mono.Collections.Generic.Collection <PropertyDefinition> properties)
 {
     foreach (PropertyDefinition @property in properties)
     {
         AppendNode(@property.DeclaringType, @property, true);
         if (@property.GetMethod != null)
         {
             AppendNode(@property, @property.GetMethod, false);
         }
         if (@property.SetMethod != null)
         {
             AppendNode(@property, @property.SetMethod, false);
         }
     }
 }
 private void CheckArguments(Mono.Collections.Generic.Collection <ParameterDefinition> parameters, ExpressionCollection arguments)
 {
     for (int i = 0; i < arguments.Count; i++)
     {
         Expression argument = arguments[i];
         if (argument.HasType)
         {
             TypeDefinition argumentType  = argument.ExpressionType.Resolve();
             TypeReference  parameterType = parameters[i].ParameterType;
             if (ShouldAddCast(argumentType, parameterType))
             {
                 arguments[i] = new CastExpression(argument, parameterType, null);
             }
         }
     }
 }
Example #9
0
        private bool AreSame(Mono.Collections.Generic.Collection <ParameterDefinition> a, Mono.Collections.Generic.Collection <ParameterDefinition> b)
        {
            if (a.Count != b.Count)
            {
                return(false);
            }

            for (int i = 0; i < a.Count; i++)
            {
                if (!AreSame(a[i].ParameterType, b[i].ParameterType))
                {
                    return(false);
                }
            }
            return(true);
        }
Example #10
0
        private static bool IsUnifiableMono(Type t1, Mono.Cecil.TypeReference t2)
        {
            // If both are not generic then they have to be equal types.
            if ((!t1.IsGenericParameter) && (!t2.IsGenericParameter))
            {
                return(t1.Name == t2.Name);
            }

            // Handle any generic arguments
            if (t1.IsGenericType && t2.HasGenericParameters)
            {
                Type[] t1Arguments = t1.GetGenericArguments();
                Mono.Collections.Generic.Collection <Mono.Cecil.GenericParameter> t2Arguments = t2.GenericParameters;
                if (t1Arguments.Length == t2Arguments.Count)
                {
                    for (int i = 0; i < t1Arguments.Length; ++i)
                    {
                        if (!IsSimilarType(t1Arguments[i], t2Arguments[i]))
                        {
                            return(false);
                        }
                    }
                    return(true);
                }
            }

            // Find if matches for either t1 or t2 in matching table.
            Mono.Cecil.TypeReference match_t1 = null;
            try
            {
                match_t1 = matches_mono[t1];
            }
            catch
            {
            }

            // If entry for match for either, then the match has to match.
            if (match_t1 != null)
            {
                return(match_t1 == t2);
            }

            // Not matched before, so these match.
            matches_mono.Add(t1, t2);

            return(true);
        }
Example #11
0
        public static void PatchLevelUpdate(MethodDefinition method, CustomAttribute attrib)
        {
            if (!method.HasBody)
            {
                return;
            }

            FieldDefinition f_SubHudRenderer = method.DeclaringType.FindField("SubHudRenderer");

            if (f_SubHudRenderer == null)
            {
                return;
            }

            Mono.Collections.Generic.Collection <Instruction> instrs = method.Body.Instructions;
            ILProcessor il = method.Body.GetILProcessor();

            for (int instri = 0; instri < instrs.Count; instri++)
            {
                Instruction instr = instrs[instri];

                /* We expect something similar enough to the following:
                 * call class Monocle.MInput/KeyboardData Monocle.MInput::get_Keyboard()
                 * ldc.i4.s 9
                 * callvirt instance bool Monocle.MInput/KeyboardData::Pressed(valuetype [FNA]Microsoft.Xna.Framework.Input.Keys) // We're here
                 *
                 * Note that MonoMod requires the full type names (System.UInt32 instead of uint32) and skips escaping 's
                 */

                if (instri > 1 &&
                    instri < instrs.Count - 2 &&
                    instrs[instri - 2].OpCode == OpCodes.Call && (instrs[instri - 2].Operand as MethodReference)?.GetFindableID() == "Monocle.MInput/KeyboardData Monocle.MInput::get_Keyboard()" &&
                    instrs[instri - 1].GetIntOrNull() == 9 &&
                    instr.OpCode == OpCodes.Callvirt && (instr.Operand as MethodReference)?.GetFindableID() == "System.Boolean Monocle.MInput/KeyboardData::Pressed(Microsoft.Xna.Framework.Input.Keys)"
                    )
                {
                    // Replace the offending instructions with a ldc.i4.0
                    instri -= 2;

                    instrs.RemoveAt(instri);
                    instrs.RemoveAt(instri);
                    instrs.RemoveAt(instri);
                    instrs.Insert(instri, il.Create(OpCodes.Ldc_I4_0));
                    instri++;
                }
            }
        }
 private void ButInsertAfter_Click(object sender, EventArgs e)
 {
     if (IsFormComplete)
     {
         VariableDefinition newvar = CreateVariable();
         if (newvar != null)
         {
             Mono.Collections.Generic.Collection <VariableDefinition> vars = MethodDefinition.Body.Variables;
             vars.Insert(vars.IndexOf(SelectedVariable) + 1, newvar);
         }
         DialogResult = DialogResult.OK;
     }
     else
     {
         DialogResult = DialogResult.None;
     }
 }
Example #13
0
        static Instruction findNextRet(Mono.Collections.Generic.Collection <Instruction> instructions, Instruction pos)
        {
            bool posFound = false;

            for (int i = 0; i < instructions.Count; i++)
            {
                if (posFound && instructions[i].OpCode == OpCodes.Ret)
                {
                    return(instructions[i]);
                }
                else if (instructions[i] == pos)
                {
                    posFound = true;
                }
            }
            return(null);
        }
 private void ButInsertAfter_Click(object sender, EventArgs e)
 {
     if (IsFormComplete)
     {
         ParameterDefinition newprm = CreateParameter();
         if (newprm != null)
         {
             Mono.Collections.Generic.Collection <ParameterDefinition> prms = MethodDefinition.Parameters;
             prms.Insert(prms.IndexOf(SelectedParameter) + 1, newprm);
         }
         DialogResult = DialogResult.OK;
     }
     else
     {
         DialogResult = DialogResult.None;
     }
 }
Example #15
0
 public static List <InterfaceImplementation> InterfacesSolved(this TypeDefinition type)
 {
     Mono.Collections.Generic.Collection <InterfaceImplementation> toRemove = new Mono.Collections.Generic.Collection <InterfaceImplementation>();
     foreach (var i in type.Interfaces)
     {
         var InterfaceDef = i.InterfaceType.Resolve();
         var Interfaces   = InterfaceDef.Interfaces.Select(a => a.InterfaceType);
         foreach (var ii in type.Interfaces)
         {
             if (Interfaces.Contains(ii.InterfaceType))
             {
                 toRemove.Add(ii);
             }
         }
     }
     return(type.Interfaces.Except(toRemove).ToList());
 }
Example #16
0
        protected void RunVisitors <T>(Mono.Collections.Generic.Collection <T> collection, Action <IModuleVisitor, T> action)
            where T : class
        {
            var max = collection.Count;

            for (var i = 0; i < max; i++)
            {
                var current = collection[i];

                foreach (var visitor in visitors)
                {
                    if (visitor.Enabled)
                    {
                        action(visitor, current);
                    }
                }
            }
        }
Example #17
0
        /// <summary>
        /// Compares the list of method's parameters.
        /// </summary>
        /// <param name="coll1">The first list to compare.</param>
        /// <param name="coll2">The second list to copare.</param>
        /// <returns>true if both list have parameters of the same types at the same positions.</returns>
        private static bool CompareParameterLists(Mono.Collections.Generic.Collection <ParameterDefinition> coll1, Mono.Collections.Generic.Collection <ParameterDefinition> coll2)
        {
            if (coll1.Count != coll2.Count)
            {
                return(false);
            }

            for (int index = 0; index < coll1.Count; index++)
            {
                var param1 = coll1[index];
                var param2 = coll2[index];
                if (param1.Attributes != param2.Attributes || !AreSameType(param1.ParameterType, param2.ParameterType))
                {
                    return(false);
                }
            }
            return(true);
        }
Example #18
0
        static JsonThing DependencyJson(Mono.Collections.Generic.Collection <CustomAttributeArgument> arguments)
        {
            JsonObject dep = new JsonObject();

            dep.Add("Name", arguments[0].Value.ToString());
            string type = "";

            if (arguments.Count <= 1 || arguments[1].Value.ToString() == "1")
            {
                type = "hard";
            }
            else
            {
                type = "soft";
            }
            dep.Add("Type", type);
            return(dep);
        }
Example #19
0
        /// <summary>
        /// 注意 IL注入时,符号表.pbd文件一定要与dll在同一目录,否则会报错
        /// </summary>
        private static void ILInjection()
        {
            string path             = "D://ClassLibrary1.dll";
            var    readerParameters = new ReaderParameters {
                ReadSymbols = true
            };
            AssemblyDefinition assemblyDefinition = Mono.Cecil.AssemblyDefinition.ReadAssembly(path, readerParameters);
            ModuleDefinition   mainModule         = assemblyDefinition.MainModule;

            try
            {
                foreach (TypeDefinition type in mainModule.GetTypes())
                {
                    if (type.Name == "DebugClass")
                    {
                        Mono.Collections.Generic.Collection <MethodDefinition> methods = type.Methods;
                        foreach (MethodDefinition method in methods)
                        {
                            if (method.Name == "ConsoleLog")
                            {
                                // 开始注入IL代码
                                var insertPoint = method.Body.Instructions[0];
                                var ilProcessor = method.Body.GetILProcessor();
                                ilProcessor.InsertBefore(insertPoint, ilProcessor.Create(OpCodes.Nop));
                                ilProcessor.InsertBefore(insertPoint, ilProcessor.Create(OpCodes.Ldstr, "a = {0}, b = {1}"));
                                ilProcessor.InsertBefore(insertPoint, ilProcessor.Create(OpCodes.Ret));
                            }
                        }
                    }
                }
            }
            finally
            {
                if (assemblyDefinition.MainModule.SymbolReader != null)
                {
                    assemblyDefinition.MainModule.SymbolReader.Dispose();
                }

                assemblyDefinition.Write("D://ClassLibrary2.dll", new WriterParameters()
                {
                    WriteSymbols = true
                });
            }
        }
Example #20
0
        public override void Run()
        {
            var npcType = this.Type <Terraria.NPC>();
            var npcLoot = this.Method(() => (new Terraria.NPC()).NPCLoot());
            //var dropLoot = SourceDefinition.Type("Terraria.NPC").Method("DropLoot");

            //In this patch we swap all Item.NewItem calls in NPCLoot to use our previously
            //created DropLoot method

            //Gather all Item.NewItem calls
            var itemCalls = npcLoot.Body.Instructions.Where(x => x.OpCode == OpCodes.Call &&
                                                            x.Operand is MethodReference &&
                                                            (x.Operand as MethodReference).Name == "NewItem" &&
                                                            (x.Operand as MethodReference).DeclaringType.Name == "Item").ToArray();

            var processor = npcLoot.Body.GetILProcessor();

            //Swap each Item.NewItem calls to our Npc.DropLoot method.
            foreach (var call in itemCalls)
            {
                var parameters = new Mono.Collections.Generic.Collection <ParameterDefinition>(
                    (call.Operand as MethodDefinition).Parameters.ToArray()
                    );
                parameters.Add(new ParameterDefinition("npc", ParameterAttributes.In, npcType));
                var dropLoot = npcType.Method("DropLoot",
                                              parameters: parameters,
                                              skipMethodParameters: 0
                                              );

                //Swap to our custom method
                call.Operand = dropLoot;

                //Append the additional arguments to the end of the existing call
                processor.InsertBefore(call, new[]
                {
                    new { OpCodes.Ldarg_0 }                     //Adds 'this' (so the npc instance)
                });
            }

            //Ensure the short branches are updated
            npcLoot.Body.SimplifyMacros();
            npcLoot.Body.OptimizeMacros();
        }
Example #21
0
 /// <summary>
 /// Remove a type definition
 /// </summary>
 /// <param name="tdef">Nested or flat type definition</param>
 public static void Delete(TypeDefinition tdef)
 {
     if (tdef.DeclaringType != null)
     {
         Mono.Collections.Generic.Collection <TypeDefinition> coll = tdef.DeclaringType.NestedTypes;
         if (coll.Contains(tdef))
         {
             coll.Remove(tdef);
         }
     }
     if (tdef.Module != null)
     {
         Mono.Collections.Generic.Collection <TypeDefinition> coll = tdef.Module.Types;
         if (coll.Contains(tdef))
         {
             coll.Remove(tdef);
         }
     }
 }
Example #22
0
        public FieldReference ImportField(FieldReference field, Mono.Collections.Generic.Collection <IGenericParameterProvider> context)
        {
            var declaring_type = ImportType(field.DeclaringType, context);

            AddToContext(ref context, declaring_type);
            try
            {
                return(new FieldReference
                {
                    Name = field.Name,
                    DeclaringType = declaring_type,
                    FieldType = ImportType(field.FieldType, context),
                });
            }
            finally
            {
                RemoveFromContext(context);
            }
        }
		public override void Run()
		{
			var npcType = this.Type<Terraria.NPC>();
			var npcLoot = this.Method(() => (new Terraria.NPC()).NPCLoot());
			//var dropLoot = SourceDefinition.Type("Terraria.NPC").Method("DropLoot");

			//In this patch we swap all Item.NewItem calls in NPCLoot to use our previously
			//created DropLoot method

			//Gather all Item.NewItem calls
			var itemCalls = npcLoot.Body.Instructions.Where(x => x.OpCode == OpCodes.Call
								&& x.Operand is MethodReference
								&& (x.Operand as MethodReference).Name == "NewItem"
								&& (x.Operand as MethodReference).DeclaringType.Name == "Item").ToArray();

			var processor = npcLoot.Body.GetILProcessor();

			//Swap each Item.NewItem calls to our Npc.DropLoot method.
			foreach (var call in itemCalls)
			{
				var parameters = new Mono.Collections.Generic.Collection<ParameterDefinition>(
					(call.Operand as MethodDefinition).Parameters.ToArray()
				);
				parameters.Add(new ParameterDefinition("npc", ParameterAttributes.In, npcType));
				var dropLoot = npcType.Method("DropLoot",
					parameters: parameters,
					skipMethodParameters: 0
				);

				//Swap to our custom method
				call.Operand = dropLoot;

				//Append the additional arguments to the end of the existing call
				processor.InsertBefore(call, new[]
				{
					new { OpCodes.Ldarg_0 } //Adds 'this' (so the npc instance)
				});
			}

			//Ensure the short branches are updated
			npcLoot.Body.SimplifyMacros();
			npcLoot.Body.OptimizeMacros();
		}
        static bool RemoveAttributes(string attrName, Mono.Collections.Generic.Collection <CustomAttribute> customAttributes)
        {
            int index = -1;

            for (var i = 0; i < customAttributes.Count; i++)
            {
                var attr = customAttributes[i];
                if (attr.Constructor != null && attr.Constructor.DeclaringType.FullName == attrName)
                {
                    index = i;
                    break;
                }
            }
            if (index != -1)
            {
                customAttributes.RemoveAt(index);
                return(true);
            }
            return(false);
        }
Example #25
0
 public MethodParamList(ICLRSharp_Environment env, Mono.Collections.Generic.Collection <Mono.Cecil.Cil.VariableDefinition> ps)
 {
     {
         // foreach(var p in ps)
         var __enumerator3 = (ps).GetEnumerator();
         while (__enumerator3.MoveNext())
         {
             var p = __enumerator3.Current;
             {
                 string paramname = p.VariableType.FullName;
                 var    type      = env.GetType(paramname);
                 if (type != null && type.IsEnum())
                 {
                     type = env.GetType(type.TypeForSystem);
                 }
                 this.Add(type);
             }
         }
     }
 }
Example #26
0
        /// <summary>
        /// Remove a property definition and getter/setter method(s)
        /// </summary>
        /// <param name="pdef">Property definition</param>
        public static void Delete(PropertyDefinition pdef)
        {
            if (pdef.DeclaringType != null)
            {
                Mono.Collections.Generic.Collection <PropertyDefinition> coll = pdef.DeclaringType.Properties;
                if (coll.Contains(pdef))
                {
                    if (pdef.GetMethod != null)
                    {
                        Delete(pdef.GetMethod);
                    }
                    if (pdef.SetMethod != null)
                    {
                        Delete(pdef.SetMethod);
                    }

                    coll.Remove(pdef);
                }
            }
        }
Example #27
0
        internal static bool AreSame(Mono.Collections.Generic.Collection <ParameterDefinition> a, Mono.Collections.Generic.Collection <ParameterDefinition> b, int aStart)
        {
            int aIndex = aStart;
            int bIndex = 0;

            if (a.Count - aIndex != b.Count)
            {
                return(false);
            }

            for (; aIndex < a.Count; aIndex++, bIndex++)
            {
                if (!AreSame(a[aIndex].ParameterType, b[bIndex].ParameterType))
                {
                    return(false);
                }
            }

            return(true);
        }
Example #28
0
        /// <summary>
        /// Remove an event definition and add/remove methods
        /// </summary>
        /// <param name="edef">Event definition</param>
        public static void Delete(EventDefinition edef)
        {
            if (edef.DeclaringType != null)
            {
                Mono.Collections.Generic.Collection <EventDefinition> coll = edef.DeclaringType.Events;
                if (coll.Contains(edef))
                {
                    if (edef.AddMethod != null)
                    {
                        Delete(edef.AddMethod);
                    }
                    if (edef.RemoveMethod != null)
                    {
                        Delete(edef.RemoveMethod);
                    }

                    coll.Remove(edef);
                }
            }
        }
Example #29
0
        bool InjectLoadFromCustomArgument(Mono.Collections.Generic.Collection <Instruction> instructions, CustomAttributeArgument customArgument)
        {
            var arg = customArgument.Value;

            if (arg is TypeReference)
            {
                instructions.Add(Instruction.Create(OpCodes.Ldtoken, AssemblyDefinition.MainModule.ImportReference((TypeReference)arg)));
                instructions.Add(Instruction.Create(OpCodes.Call, m_GetTypeFromHandleFnRef));
            }
            else if (arg is bool)
            {
                instructions.Add(Instruction.Create(OpCodes.Ldc_I4, (bool)arg ? 1 : 0));
            }
            else
            {
                return(false);
            }

            return(true);
        }
Example #30
0
        StringBuilder AppendMemberRef(StringBuilder cref, MemberInfo member)
        {
            switch (member.GetMemberType())
            {
            case "Type": {
                Type type = (Type)member;
                cref.Append(type.Namespace).Append('.').Append(type.Name);
                return(cref);
            }

            default: AppendMemberRef(cref, (MemberInfo)member.DeclaringType); break;
            }

            if (member.GetMemberType() != "Constructor")
            {
                cref.Append(".").Append(member.Name);
            }

            Mono.Collections.Generic.Collection <ParameterInfo> p = null;
            if (member is MethodDefinition)
            {
                p = ((MethodDefinition)member).Parameters;
            }
            else if (member is PropertyDefinition)
            {
                p = ((PropertyInfo)member).GetMethod.Parameters;
            }
            if (p != null && p.Count > 0)
            {
                cref.Append("(");
                AppendMemberRef(cref, p [0].ParameterType);
                for (int i = 1; i < p.Count; ++i)
                {
                    cref.Append(", ");
                    AppendMemberRef(cref, p [1].ParameterType);
                }
                cref.Append(")");
            }

            return(cref);
        }
        private static StringBuilder ToXmlDocCommentMember <TMember>(TMember member, Mono.Collections.Generic.Collection <ParameterDefinition> memberParameters, out int namePosition)
            where TMember : MemberReference
        {
            StringBuilder builder = new StringBuilder();

            AppendXDCFullTypeNameTo(builder, member.DeclaringType)
            .Insert(0, XDCMemberPrefixes[typeof(TMember)])
            .Append('.');

            namePosition = builder.Length;
            builder.Append(member.Name);

            if (memberParameters.Count > 0)
            {
                builder.Append('(');
                AppendXDCParameterTypesTo(builder, ToParameterTypes(memberParameters))
                .Append(')');
            }

            return(builder);
        }
Example #32
0
        MethodSpecification ImportMethodSpecification(MethodReference method, Mono.Collections.Generic.Collection <IGenericParameterProvider> context)
        {
            if (!method.IsGenericInstance)
            {
                throw new NotSupportedException();
            }

            var instance          = (GenericInstanceMethod)method;
            var element_method    = ImportMethod(instance.ElementMethod, context);
            var imported_instance = new GenericInstanceMethod(element_method);

            var arguments          = instance.GenericArguments;
            var imported_arguments = imported_instance.GenericArguments;

            for (int i = 0; i < arguments.Count; i++)
            {
                imported_arguments.Add(ImportType(arguments [i], context));
            }

            return(imported_instance);
        }
        private BamlGenerator CreateBamlGenerator(ILogger logger = null)
        {
            var mainAssembly = AssemblyDefinition.CreateAssembly(
                new AssemblyNameDefinition("ClassLibrary", Version.Parse("1.0")),
                "CLassLibrary", ModuleKind.Dll);

            var references = new Mono.Collections.Generic.Collection<AssemblyNameReference>
            {
                AssemblyNameReference.Parse("WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"),
                AssemblyNameReference.Parse("PresentationCore, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"),
                AssemblyNameReference.Parse("PresentationFramework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")
            };

            return new BamlGenerator(logger ?? Mock.Of<ILogger>(), references, mainAssembly);
        }