get { return isManifestModule; }
}
+ public Guid ModuleVersionId
+ {
+ get { return module.ModuleVersionId; }
+ }
+
private void CheckManifestModule()
{
if (!IsManifestModule)
--- /dev/null
+// CS1703: An assembly with the same identity `System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' has already been imported. Consider removing one of the references
+// Line: 0
+// Compiler options: -r:../class/lib/net_4_0/System.dll
+
public abstract bool HasObjectType (T assembly);
protected abstract string[] GetDefaultReferences ();
- public abstract T LoadAssemblyFile (string fileName);
- public abstract T LoadAssemblyDefault (string assembly);
+ public abstract T LoadAssemblyFile (string fileName, bool isImplicitReference);
public abstract void LoadReferences (ModuleContainer module);
protected void Error_FileNotFound (string fileName)
// Load mscorlib.dll as the first
//
if (module.Compiler.Settings.StdLib) {
- corlib_assembly = LoadAssemblyDefault ("mscorlib.dll");
+ corlib_assembly = LoadAssemblyFile ("mscorlib.dll", true);
} else {
corlib_assembly = default (T);
}
T a;
foreach (string r in module.Compiler.Settings.AssemblyReferences) {
- a = LoadAssemblyFile (r);
+ a = LoadAssemblyFile (r, false);
if (a == null || EqualityComparer<T>.Default.Equals (a, corlib_assembly))
continue;
}
foreach (var entry in module.Compiler.Settings.AssemblyReferencesAliases) {
- a = LoadAssemblyFile (entry.Item2);
+ a = LoadAssemblyFile (entry.Item2, false);
if (a == null)
continue;
if (compiler.Settings.LoadDefaultReferences) {
foreach (string r in GetDefaultReferences ()) {
- a = LoadAssemblyDefault (r);
+ a = LoadAssemblyFile (r, true);
if (a == null)
continue;
public void LoadAssembly (string file)
{
var loader = new DynamicLoader (importer, ctx);
- var assembly = loader.LoadAssemblyFile (file);
+ var assembly = loader.LoadAssemblyFile (file, false);
if (assembly == null)
return;
return assembly.GetType (compiler.BuiltinTypes.Object.FullName) != null;
}
- public override Assembly LoadAssemblyFile (string fileName)
+ public override Assembly LoadAssemblyFile (string fileName, bool isImplicitReference)
{
bool? has_extension = null;
foreach (var path in paths) {
if (an.Name != loaded_name.Name)
continue;
- if (an.CodeBase == loaded_name.CodeBase)
+ if (module.ModuleVersionId == entry.Item3.ManifestModule.ModuleVersionId)
return entry.Item3;
if (((an.Flags | loaded_name.Flags) & AssemblyNameFlags.PublicKey) == 0) {
return assembly;
}
} catch {
- Error_FileCorrupted (file);
+ if (!isImplicitReference)
+ Error_FileCorrupted (file);
+
return null;
}
}
- Error_FileNotFound (fileName);
+ if (!isImplicitReference)
+ Error_FileNotFound (fileName);
+
return null;
}
return null;
}
- //
- // Optimized default assembly loader version
- //
- public override Assembly LoadAssemblyDefault (string assembly)
- {
- foreach (var path in paths) {
- var file = Path.Combine (path, assembly);
-
- if (compiler.Settings.DebugFlags > 0)
- Console.WriteLine ("Probing default assembly location `{0}'", file);
-
- if (!File.Exists (file))
- continue;
-
- try {
- if (compiler.Settings.DebugFlags > 0)
- Console.WriteLine ("Loading default assembly `{0}'", file);
-
- var a = domain.LoadFile (file);
- if (a != null) {
- loaded_names.Add (Tuple.Create (a.GetName (), file, a));
- }
-
- return a;
- } catch {
- // Default assemblies can fail to load without error
- return null;
- }
- }
-
- return null;
- }
-
public override void LoadReferences (ModuleContainer module)
{
List<Tuple<RootNamespace, Assembly>> loaded;
return assembly.GetType (compiler.BuiltinTypes.Object.FullName) != null;
}
- public override Assembly LoadAssemblyFile (string fileName)
- {
- return LoadAssemblyFile (fileName, false);
- }
-
- Assembly LoadAssemblyFile (string assembly, bool soft)
+ public override Assembly LoadAssemblyFile (string assembly, bool isImplicitReference)
{
Assembly a = null;
a = Assembly.Load (ass);
}
} catch (FileNotFoundException) {
- bool err = !soft;
+ bool err = !isImplicitReference;
foreach (string dir in paths) {
string full_path = Path.Combine (dir, assembly);
if (!assembly.EndsWith (".dll") && !assembly.EndsWith (".exe"))
return a;
}
- public override Assembly LoadAssemblyDefault (string fileName)
- {
- return LoadAssemblyFile (fileName, true);
- }
-
Module LoadModuleFile (AssemblyDefinitionDynamic assembly, string module)
{
string total_log = "";