Example #1
0
        private static string getClassNameFromType(Type type)
        {
            if (type == null)
            {
                return("<Module>");
            }
            if (ClassLoaderWrapper.IsRemappedType(type))
            {
                return(DotNetTypeWrapper.GetName(type));
            }
            TypeWrapper tw = ClassLoaderWrapper.GetWrapperFromType(type);

            if (tw != null)
            {
                if (tw.IsPrimitive)
                {
                    return(DotNetTypeWrapper.GetName(type));
                }
#if !FIRST_PASS
                if (tw.IsUnsafeAnonymous)
                {
                    return(tw.ClassObject.getName());
                }
#endif
                return(tw.Name);
            }
            return(type.FullName);
        }
        private static string GetFileName(StackFrame frame)
        {
            MethodBase mb = frame.GetMethod();

            if (mb != null)
            {
                TypeWrapper tw = ClassLoaderWrapper.GetWrapperFromType(mb.DeclaringType);
                if (tw != null)
                {
                    return(tw.GetSourceFileName());
                }
            }
            return(null);
        }
Example #3
0
        private static string getClassNameFromType(Type type)
        {
            if (ClassLoaderWrapper.IsRemappedType(type))
            {
                return(DotNetTypeWrapper.GetName(type));
            }
            TypeWrapper tw = ClassLoaderWrapper.GetWrapperFromType(type);

            if (tw != null)
            {
                if (tw.IsPrimitive)
                {
                    return(DotNetTypeWrapper.GetName(type));
                }
                return(tw.Name);
            }
            return(type.FullName);
        }
        private static int GetLineNumber(StackFrame frame)
        {
            int ilOffset = frame.GetILOffset();

            if (ilOffset != StackFrame.OFFSET_UNKNOWN)
            {
                MethodBase mb = frame.GetMethod();
                if (mb != null)
                {
                    TypeWrapper tw = ClassLoaderWrapper.GetWrapperFromType(mb.DeclaringType);
                    if (tw != null)
                    {
                        return(tw.GetSourceLineNumber(mb, ilOffset));
                    }
                }
            }
            return(-1);
        }
 internal override TypeWrapper GetWrapperFromAssemblyType(Type type)
 {
     // we have to special case the fake types here
     if (type.IsGenericType && !type.IsGenericTypeDefinition)
     {
         TypeWrapper outer = ClassLoaderWrapper.GetWrapperFromType(type.GetGenericArguments()[0]);
         foreach (TypeWrapper inner in outer.InnerClasses)
         {
             if (inner.TypeAsTBD == type)
             {
                 return(inner);
             }
             foreach (TypeWrapper inner2 in inner.InnerClasses)
             {
                 if (inner2.TypeAsTBD == type)
                 {
                     return(inner2);
                 }
             }
         }
         return(null);
     }
     return(base.GetWrapperFromAssemblyType(type));
 }