public static Type TryDetectCaller()

in csharp/NativeUtils/VariablesMapper.cs [147:172]


        public static Type TryDetectCaller()
        {
#if STACK_TRACE_DETECT_CALLER
            StackTrace st = new StackTrace();
            for (int i = 0; i < st.FrameCount; ++i)
            {
                StackFrame sf = st.GetFrame(i);
                if (sf == null)
                    return null; // It is dangeroud to skip unkown frames, so just report I don't know.

                MethodBase m = sf.GetMethod();
                if (m == null)
                    return null;

                Type dt = m.DeclaringType;
                if (dt == null)
                    return null;

                if (!knownTypes.Any(knownType => dt.IsAssignableFrom(knownType)))
                    return dt;
            }
            return null;
#else
            return null;
#endif
        }