public static void CheckStructWithPack() { var assemblyLoader = new AssemblyLoader(); assemblyLoader.AddSearchDirectory(Path.GetDirectoryName(typeof(Types).Assembly.Location)); var ilCompiler = new ILCompiler(new ExtendedCompilerBackend(new NopCompilerBackend())); // Check exception for fixed size layout { var structType = assemblyLoader.Resolve(typeof(StructWithPack)); var ex = Assert.Throws <CompilerException>(() => ilCompiler.CompileType(structType)); StringAssert.Contains("The packing size `8` of the struct", ex.Message); } }
/// <summary> /// Initialises the ILCompiler. /// </summary> /// <returns>True if initialisation completed successfully. Otherwise false.</returns> private static bool InitILCompiler() { bool OK = false; try { TheILCompiler = new ILCompiler(TheSettings); OK = true; } catch (Exception ex) { if (ExecutingUnderMSBuild) { MSBuild_OutputError(ex); } else { OutputError(ex); } OK = false; } return OK; }
protected override void Compile() { Source = ILCompiler.Compile(Info, this); }