Skip to content

Commit

Permalink
Don't assume the system.object does not have any fields
Browse files Browse the repository at this point in the history
  • Loading branch information
marek-safar committed Oct 8, 2010
1 parent 0fe5c11 commit ad115a8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
7 changes: 6 additions & 1 deletion mcs/mcs/membercache.cs
Expand Up @@ -486,9 +486,14 @@ public static MemberSpec FindBaseMember (MemberCore member, out MemberSpec bestC
{
bestCandidate = null;
var container = member.Parent.PartialContainer.Definition;
if (!container.IsInterface)
if (!container.IsInterface) {
container = container.BaseType;

// It can happen for a user definition of System.Object
if (container == null)
return null;
}

string name = GetLookupName (member);
IList<MemberSpec> applicable;
var member_param = member is IParametersMember ? ((IParametersMember) member).Parameters : null;
Expand Down
5 changes: 4 additions & 1 deletion mcs/tests/test-616.cs
Expand Up @@ -6,7 +6,10 @@

namespace System
{
public class Object {}
public class Object
{
object value_with_no_base;
}

public struct Byte {}
public struct Int16 {}
Expand Down

0 comments on commit ad115a8

Please sign in to comment.