paths.AddRange (compiler.Settings.ReferencesLookupPaths);
}
- public abstract bool HasObjectType (T assembly);
+ public abstract T HasObjectType (T assembly);
protected abstract string[] GetDefaultReferences ();
public abstract T LoadAssemblyFile (string fileName, bool isImplicitReference);
public abstract void LoadReferences (ModuleContainer module);
//
// corlib assembly is the first referenced assembly which contains System.Object
//
- if (HasObjectType (assembly.Item2)) {
- corlib_assembly = assembly.Item2;
+ corlib_assembly = HasObjectType (assembly.Item2);
+ if (corlib_assembly != null) {
+ if (corlib_assembly != assembly.Item2) {
+ var ca = corlib_assembly;
+ i = loaded.FindIndex (l => l.Item2 == ca);
+ }
+
loaded.RemoveAt (i);
break;
}
readonly List<Tuple<AssemblyName, string, Assembly>> loaded_names;
static readonly Dictionary<string, string[]> sdk_directory;
Dictionary<AssemblyName, List<string[]>> resolved_version_mismatches;
+ static readonly TypeName objectTypeName = new TypeName ("System", "Object");
static StaticLoader ()
{
return list;
}
- public override bool HasObjectType (Assembly assembly)
+ public override Assembly HasObjectType (Assembly assembly)
{
try {
- return assembly.GetType (compiler.BuiltinTypes.Object.FullName) != null;
+ // System.Object can be forwarded and ikvm
+ // transparently finds it in target assembly therefore
+ // need to return actual obj assembly becauase in such
+ // case it's different to assembly parameter
+ var obj = assembly.FindType (objectTypeName);
+ return obj == null ? null : obj.Assembly;
} catch (Exception e) {
throw new InternalErrorException (e, "Failed to load assembly `{0}'", assembly.FullName);
}
<ErrorReport>prompt</ErrorReport>\r
<WarningLevel>4</WarningLevel>\r
<UseVSHostingProcess>false</UseVSHostingProcess>\r
- <Commandlineparameters>y.cs</Commandlineparameters>\r
+ <Commandlineparameters></Commandlineparameters>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
<DebugType>pdbonly</DebugType>\r
return Path.GetDirectoryName (typeof (object).Assembly.Location);
}
- public override bool HasObjectType (Assembly assembly)
+ public override Assembly HasObjectType (Assembly assembly)
{
- return assembly.GetType (compiler.BuiltinTypes.Object.FullName) != null;
+ return assembly.GetType (compiler.BuiltinTypes.Object.FullName) == null ? null : assembly;
}
public override Assembly LoadAssemblyFile (string assembly, bool isImplicitReference)
--- /dev/null
+// Compiler options: /noconfig /nostdlib -r:../class/lib/net_4_x/Facades/System.Runtime.dll -r:../class/lib/net_4_x/mscorlib.dll
+
+using System;
+
+class TypeForwarderOfSystemObject
+{
+ void TestAttributeReadDoesNotCrash ()
+ {
+ System.Runtime.InteropServices.Marshal.ReadByte (IntPtr.Zero, 0);
+ }
+
+ static void Main ()
+ {
+ }
+}
</method>
</type>
</test>
+ <test name="test-937.cs">
+ <type name="TypeForwarderOfSystemObject">
+ <method name="Void TestAttributeReadDoesNotCrash()" attrs="129">
+ <size>14</size>
+ </method>
+ <method name="Void Main()" attrs="145">
+ <size>2</size>
+ </method>
+ <method name="Void .ctor()" attrs="6278">
+ <size>7</size>
+ </method>
+ </type>
+ </test>
<test name="test-94.cs">
<type name="Base">
<method name="Int32 IVehicle.Start()" attrs="481">