@@ -15,33 +15,33 @@ namespace nanoFramework.Tools.VisualStudio.Extension
15
15
public class CorDebugTypeArray : ICorDebugType
16
16
{
17
17
CorDebugValueArray m_ValueArray ;
18
-
19
- public CorDebugTypeArray ( CorDebugValueArray valArray )
18
+
19
+ public CorDebugTypeArray ( CorDebugValueArray valArray )
20
20
{
21
- m_ValueArray = valArray ;
21
+ m_ValueArray = valArray ;
22
22
}
23
23
24
- int ICorDebugType . EnumerateTypeParameters ( out ICorDebugTypeEnum ppTyParEnum )
24
+ int ICorDebugType . EnumerateTypeParameters ( out ICorDebugTypeEnum ppTyParEnum )
25
25
{
26
26
ppTyParEnum = null ;
27
27
return COM_HResults . E_NOTIMPL ;
28
28
}
29
29
30
- int ICorDebugType . GetType ( out CorElementType ty )
30
+ int ICorDebugType . GetType ( out CorElementType ty )
31
31
{
32
32
// This is for arrays. ELEMENT_TYPE_SZARRAY - means single demensional array.
33
33
ty = CorElementType . ELEMENT_TYPE_SZARRAY ;
34
34
return COM_HResults . S_OK ;
35
35
}
36
36
37
- int ICorDebugType . GetRank ( out uint pnRank )
37
+ int ICorDebugType . GetRank ( out uint pnRank )
38
38
{
39
39
// ELEMENT_TYPE_SZARRAY - means single demensional array.
40
40
pnRank = 1 ;
41
41
return COM_HResults . S_OK ;
42
42
}
43
43
44
- int ICorDebugType . GetClass ( out ICorDebugClass ppClass )
44
+ int ICorDebugType . GetClass ( out ICorDebugClass ppClass )
45
45
{
46
46
ppClass = CorDebugValue . ClassFromRuntimeValue ( m_ValueArray . RuntimeValue , m_ValueArray . AppDomain ) ;
47
47
return COM_HResults . S_OK ;
@@ -52,19 +52,19 @@ int ICorDebugType.GetClass (out ICorDebugClass ppClass)
52
52
* of element in the array.
53
53
* It control viewing of arrays elements in the watch window of debugger.
54
54
*/
55
- int ICorDebugType . GetFirstTypeParameter ( out ICorDebugType value )
55
+ int ICorDebugType . GetFirstTypeParameter ( out ICorDebugType value )
56
56
{
57
57
value = new CorDebugGenericType ( CorElementType . ELEMENT_TYPE_CLASS , m_ValueArray . RuntimeValue , m_ValueArray . AppDomain ) ;
58
58
return COM_HResults . S_OK ;
59
59
}
60
60
61
- int ICorDebugType . GetStaticFieldValue ( uint fieldDef , ICorDebugFrame pFrame , out ICorDebugValue ppValue )
62
- {
61
+ int ICorDebugType . GetStaticFieldValue ( uint fieldDef , ICorDebugFrame pFrame , out ICorDebugValue ppValue )
62
+ {
63
63
ppValue = null ;
64
64
return COM_HResults . E_NOTIMPL ;
65
65
}
66
66
67
- int ICorDebugType . GetBase ( out ICorDebugType pBase )
67
+ int ICorDebugType . GetBase ( out ICorDebugType pBase )
68
68
{
69
69
pBase = null ;
70
70
return COM_HResults . E_NOTIMPL ;
@@ -77,11 +77,55 @@ public class CorDebugGenericType : ICorDebugType
77
77
public RuntimeValue m_rtv ;
78
78
public CorDebugAppDomain m_appDomain ;
79
79
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.
80
115
public CorDebugGenericType ( CorElementType elemType , RuntimeValue rtv , CorDebugAppDomain appDomain )
81
- {
116
+ {
82
117
m_elemType = elemType ;
83
118
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 ;
85
129
}
86
130
87
131
int ICorDebugType . EnumerateTypeParameters ( out ICorDebugTypeEnum ppTyParEnum )
@@ -106,7 +150,7 @@ int ICorDebugType.GetRank(out uint pnRank)
106
150
107
151
int ICorDebugType . GetClass ( out ICorDebugClass ppClass )
108
152
{
109
- ppClass = CorDebugValue . ClassFromRuntimeValue ( m_rtv , m_appDomain ) ;
153
+ ppClass = CorDebugValue . ClassFromRuntimeValue ( m_rtv , AppDomain ) ;
110
154
return COM_HResults . S_OK ;
111
155
}
112
156
@@ -119,8 +163,13 @@ int ICorDebugType.GetFirstTypeParameter(out ICorDebugType value)
119
163
120
164
int ICorDebugType . GetStaticFieldValue ( uint fieldDef , ICorDebugFrame pFrame , out ICorDebugValue ppValue )
121
165
{
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 ;
124
173
}
125
174
126
175
int ICorDebugType . GetBase ( out ICorDebugType pBase )
0 commit comments