@@ -15,33 +15,33 @@ namespace nanoFramework.Tools.VisualStudio.Extension
1515    public  class  CorDebugTypeArray  :  ICorDebugType 
1616    { 
1717        CorDebugValueArray  m_ValueArray ; 
18-          
19-         public  CorDebugTypeArray (   CorDebugValueArray  valArray   ) 
18+ 
19+         public  CorDebugTypeArray ( CorDebugValueArray  valArray ) 
2020        { 
21-             m_ValueArray  =  valArray ;   
21+             m_ValueArray  =  valArray ; 
2222        } 
2323
24-         int  ICorDebugType . EnumerateTypeParameters   ( out  ICorDebugTypeEnum  ppTyParEnum ) 
24+         int  ICorDebugType . EnumerateTypeParameters ( out  ICorDebugTypeEnum  ppTyParEnum ) 
2525        { 
2626            ppTyParEnum  =  null ; 
2727            return  COM_HResults . E_NOTIMPL ; 
2828        } 
2929
30-         int  ICorDebugType . GetType   ( out  CorElementType  ty ) 
30+         int  ICorDebugType . GetType ( out  CorElementType  ty ) 
3131        { 
3232            // This is for arrays. ELEMENT_TYPE_SZARRAY - means single demensional array. 
3333            ty  =  CorElementType . ELEMENT_TYPE_SZARRAY ; 
3434            return  COM_HResults . S_OK ; 
3535        } 
3636
37-         int  ICorDebugType . GetRank   ( out  uint  pnRank ) 
37+         int  ICorDebugType . GetRank ( out  uint  pnRank ) 
3838        { 
3939            // ELEMENT_TYPE_SZARRAY - means single demensional array. 
4040            pnRank  =  1 ; 
4141            return  COM_HResults . S_OK ; 
4242        } 
4343
44-         int  ICorDebugType . GetClass   ( out  ICorDebugClass  ppClass ) 
44+         int  ICorDebugType . GetClass ( out  ICorDebugClass  ppClass ) 
4545        { 
4646            ppClass  =  CorDebugValue . ClassFromRuntimeValue ( m_ValueArray . RuntimeValue ,  m_ValueArray . AppDomain ) ; 
4747            return  COM_HResults . S_OK ; 
@@ -52,19 +52,19 @@ int ICorDebugType.GetClass (out ICorDebugClass ppClass)
5252         *  of element in the array. 
5353         *  It control viewing of arrays elements in the watch window of debugger. 
5454         */ 
55-         int  ICorDebugType . GetFirstTypeParameter   ( out  ICorDebugType  value ) 
55+         int  ICorDebugType . GetFirstTypeParameter ( out  ICorDebugType  value ) 
5656        { 
5757            value  =  new  CorDebugGenericType ( CorElementType . ELEMENT_TYPE_CLASS ,  m_ValueArray . RuntimeValue ,  m_ValueArray . AppDomain ) ; 
5858            return  COM_HResults . S_OK ; 
5959        } 
6060
61-         int  ICorDebugType . GetStaticFieldValue   ( uint  fieldDef ,  ICorDebugFrame  pFrame ,  out  ICorDebugValue  ppValue ) 
62-         {              
61+         int  ICorDebugType . GetStaticFieldValue ( uint  fieldDef ,  ICorDebugFrame  pFrame ,  out  ICorDebugValue  ppValue ) 
62+         { 
6363            ppValue  =  null ; 
6464            return  COM_HResults . E_NOTIMPL ; 
6565        } 
6666
67-         int  ICorDebugType . GetBase   ( out  ICorDebugType  pBase ) 
67+         int  ICorDebugType . GetBase ( out  ICorDebugType  pBase ) 
6868        { 
6969            pBase  =  null ; 
7070            return  COM_HResults . E_NOTIMPL ; 
@@ -77,11 +77,55 @@ public class CorDebugGenericType : ICorDebugType
7777        public  RuntimeValue  m_rtv ; 
7878        public  CorDebugAppDomain  m_appDomain ; 
7979
80+         public  CorDebugAssembly  Assembly 
81+         { 
82+             [ System . Diagnostics . DebuggerHidden ] 
83+             get ; 
84+         } 
85+ 
86+         public  Engine  Engine 
87+         { 
88+             [ System . Diagnostics . DebuggerHidden ] 
89+             get  {  return  this . Process ? . Engine ;  } 
90+         } 
91+ 
92+         public  CorDebugProcess  Process 
93+         { 
94+             [ System . Diagnostics . DebuggerHidden ] 
95+             get  {  return  this . Assembly ? . Process ;  } 
96+         } 
97+ 
98+         public  CorDebugAppDomain  AppDomain 
99+         { 
100+             [ System . Diagnostics . DebuggerHidden ] 
101+             get 
102+             { 
103+                 if  ( m_appDomain  !=  null ) 
104+                 { 
105+                     return  m_appDomain ; 
106+                 } 
107+                 else 
108+                 { 
109+                     return  this . Assembly ? . AppDomain ; 
110+                 } 
111+             } 
112+         } 
113+ 
114+         // This is used to resolve values into types when we know the appdomain, but not the assembly. 
80115        public  CorDebugGenericType ( CorElementType  elemType ,  RuntimeValue  rtv ,  CorDebugAppDomain  appDomain ) 
81-         {   
116+         { 
82117            m_elemType  =  elemType ; 
83118            m_rtv  =  rtv ; 
84-             m_appDomain  =  appDomain ;  
119+             m_appDomain  =  appDomain ; 
120+         } 
121+ 
122+         // This constructor is used exclusively for resolving potentially (but never really) generic classes into fully specified types. 
123+         // Generics are not supported (yet) but we still need to be able to convert classes into fully specified types.       
124+         public  CorDebugGenericType ( CorElementType  elemType ,  RuntimeValue  rtv ,  CorDebugAssembly  assembly ) 
125+         { 
126+             m_elemType  =  elemType ; 
127+             m_rtv  =  rtv ; 
128+             Assembly  =  assembly ; 
85129        } 
86130
87131        int  ICorDebugType . EnumerateTypeParameters ( out  ICorDebugTypeEnum  ppTyParEnum ) 
@@ -106,7 +150,7 @@ int ICorDebugType.GetRank(out uint pnRank)
106150
107151        int  ICorDebugType . GetClass ( out  ICorDebugClass  ppClass ) 
108152        { 
109-             ppClass  =  CorDebugValue . ClassFromRuntimeValue ( m_rtv ,  m_appDomain ) ; 
153+             ppClass  =  CorDebugValue . ClassFromRuntimeValue ( m_rtv ,  AppDomain ) ; 
110154            return  COM_HResults . S_OK ; 
111155        } 
112156
@@ -119,8 +163,13 @@ int ICorDebugType.GetFirstTypeParameter(out ICorDebugType value)
119163
120164        int  ICorDebugType . GetStaticFieldValue ( uint  fieldDef ,  ICorDebugFrame  pFrame ,  out  ICorDebugValue  ppValue ) 
121165        { 
122-             ppValue  =  null ; 
123-             return  COM_HResults . E_NOTIMPL ; 
166+             uint  fd  =  nanoCLR_TypeSystem . ClassMemberIndexFromCLRToken ( fieldDef ,  this . Assembly ) ; 
167+ 
168+             this . Process . SetCurrentAppDomain ( this . AppDomain ) ; 
169+             RuntimeValue  rtv  =  this . Engine . GetStaticFieldValue ( fd ) ; 
170+             ppValue  =  CorDebugValue . CreateValue ( rtv ,  this . AppDomain ) ; 
171+ 
172+             return  COM_HResults . S_OK ; 
124173        } 
125174
126175        int  ICorDebugType . GetBase ( out  ICorDebugType  pBase ) 
0 commit comments