private void CheckCompatibility() {
// If reference is agnostic, then compatible
PortableExecutableKinds RefPEKindFlags;
ImageFileMachine RefPEMachineArchitecture;
this.assembly.ManifestModule.GetPEKind(out RefPEKindFlags, out RefPEMachineArchitecture);
if (RefPEMachineArchitecture == ImageFileMachine.I386 &&
PortableExecutableKinds.ILOnly == (RefPEKindFlags & (PortableExecutableKinds.ILOnly | PortableExecutableKinds.Required32Bit))) {
return;
}
// Warn if building an agnostic assembly, but referenced assembly is not.
PortableExecutableKinds PEKindFlags = engine.PEKindFlags;
ImageFileMachine PEMachineArchitecture = engine.PEMachineArchitecture;
if (PEMachineArchitecture == ImageFileMachine.I386 &&
PortableExecutableKinds.ILOnly == (PEKindFlags & (PortableExecutableKinds.ILOnly | PortableExecutableKinds.Required32Bit))) {
// We are agnostic, but the reference is not. Do not emit a warning - this is a very common
// case. Many of the system libraries are platform specific.
return;
}
// Warning if architectures don't match.
if (RefPEMachineArchitecture != PEMachineArchitecture) {
JScriptException e = new JScriptException(JSError.IncompatibleAssemblyReference);
e.value = this.assemblyName;
this.engine.OnCompilerError(e);
}
}
}