diff --git a/Framework/CorDebug/CorDebugClass.cs b/Framework/CorDebug/CorDebugClass.cs index a033cb644..08ebd6c88 100644 --- a/Framework/CorDebug/CorDebugClass.cs +++ b/Framework/CorDebug/CorDebugClass.cs @@ -122,7 +122,7 @@ int ICorDebugClass. GetStaticFieldValue (uint fieldDef, ICorDebugFrame pFrame, o int ICorDebugClass2.GetParameterizedType( CorElementType elementType, uint nTypeArgs, ICorDebugType []ppTypeArgs, out ICorDebugType ppType ) { // CorDebugClass.GetParameterizedType is not implemented - ppType = null; + ppType = new CorDebugGenericType(elementType, null, this.Assembly); return Utility.COM_HResults.S_OK; } diff --git a/Framework/CorDebug/CorDebugType.cs b/Framework/CorDebug/CorDebugType.cs index 247c13cd4..657b2aabe 100644 --- a/Framework/CorDebug/CorDebugType.cs +++ b/Framework/CorDebug/CorDebugType.cs @@ -72,12 +72,23 @@ public class CorDebugGenericType : ICorDebugType CorElementType m_elemType; public RuntimeValue m_rtv; public CorDebugAppDomain m_appDomain; + private CorDebugAssembly m_assembly; + // This is used to resolve values into types when we know the appdomain, but not the assembly. public CorDebugGenericType(CorElementType elemType, RuntimeValue rtv, CorDebugAppDomain appDomain) - { + { + m_elemType = elemType; + m_rtv = rtv; + m_appDomain = appDomain; + } + + // This constructor is used exclusively for resovling potentially (but never really) generic classes into fully specified types. + // Generics are not supported by netmf, but we still need to be able to convert classes into fully specified types. + public CorDebugGenericType(CorElementType elemType, RuntimeValue rtv, CorDebugAssembly assembly) + { m_elemType = elemType; m_rtv = rtv; - m_appDomain = appDomain; + m_assembly = assembly; } int ICorDebugType.EnumerateTypeParameters(out ICorDebugTypeEnum ppTyParEnum) @@ -102,7 +113,7 @@ int ICorDebugType.GetRank(out uint pnRank) int ICorDebugType.GetClass(out ICorDebugClass ppClass) { - ppClass = CorDebugValue.ClassFromRuntimeValue(m_rtv, m_appDomain); + ppClass = CorDebugValue.ClassFromRuntimeValue(m_rtv, this.AppDomain); return Utility.COM_HResults.S_OK; } @@ -115,8 +126,12 @@ int ICorDebugType.GetFirstTypeParameter(out ICorDebugType value) int ICorDebugType.GetStaticFieldValue(uint fieldDef, ICorDebugFrame pFrame, out ICorDebugValue ppValue) { - ppValue = null; - return Utility.COM_HResults.E_NOTIMPL; + uint fd = TinyCLR_TypeSystem.ClassMemberIndexFromCLRToken(fieldDef, this.Assembly); + this.Process.SetCurrentAppDomain(this.AppDomain); + RuntimeValue rtv = this.Engine.GetStaticFieldValue(fd); + ppValue = CorDebugValue.CreateValue(rtv, this.AppDomain); + + return Utility.COM_HResults.S_OK; } int ICorDebugType.GetBase(out ICorDebugType pBase) @@ -124,5 +139,36 @@ int ICorDebugType.GetBase(out ICorDebugType pBase) pBase = null; return Utility.COM_HResults.E_NOTIMPL; } + + public CorDebugAssembly Assembly + { + [System.Diagnostics.DebuggerHidden] + get { return m_assembly; } + } + + public Engine Engine + { + [System.Diagnostics.DebuggerHidden] + get { return this.Process?.Engine; } + } + + public CorDebugProcess Process + { + [System.Diagnostics.DebuggerHidden] + get { return this.Assembly?.Process; } + } + + public CorDebugAppDomain AppDomain + { + [System.Diagnostics.DebuggerHidden] + get + { + if (m_appDomain != null) + return m_appDomain; + else + return this.Assembly?.AppDomain; + } + } + } }