Fix issue where unknown types would bind to the first available type, as they inherit from system.object
This commit is contained in:
parent
493a8ebb9d
commit
575889bed1
|
@ -92,14 +92,14 @@ namespace Upsilon.BaseTypes
|
|||
{
|
||||
private System.Type RealType { get; set; }
|
||||
|
||||
public UndefinedUserDataTypeContainer(System.Type realType) : base("unset")
|
||||
public UndefinedUserDataTypeContainer(System.Type realType) : base(realType.Name)
|
||||
{
|
||||
if (realType == null)
|
||||
throw new Exception("Type can't be null");
|
||||
RealType = realType;
|
||||
}
|
||||
|
||||
public UndefinedUserDataTypeContainer(Type t, System.Type realType) : base(t, "unset")
|
||||
public UndefinedUserDataTypeContainer(Type t, System.Type realType) : base(t, realType.Name)
|
||||
{
|
||||
if (realType == null)
|
||||
throw new Exception("Type can't be null");
|
||||
|
|
|
@ -53,6 +53,8 @@ namespace Upsilon.BoundTypes
|
|||
|
||||
public static string GetTypeName(System.Type type)
|
||||
{
|
||||
if (type == null)
|
||||
return null;
|
||||
if (TypeLookup.TryGetValue(type, out var bDefKey))
|
||||
{
|
||||
return bDefKey;
|
||||
|
|
|
@ -41,6 +41,9 @@ namespace Upsilon.BoundTypes
|
|||
var currentBaseType = type.BaseType;
|
||||
while (currentBaseType != null)
|
||||
{
|
||||
// We don't want the global object type to be returned
|
||||
if (currentBaseType == typeof(object))
|
||||
break;
|
||||
yield return currentBaseType;
|
||||
currentBaseType = currentBaseType.BaseType;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue