@@ -113,7 +113,45 @@ int ISOSDacInterface.GetAppDomainConfigFile(ClrDataAddress appDomain, int count,
113
113
int ISOSDacInterface . GetAppDomainData ( ClrDataAddress addr , void * data )
114
114
=> _legacyImpl is not null ? _legacyImpl . GetAppDomainData ( addr , data ) : HResults . E_NOTIMPL ;
115
115
int ISOSDacInterface . GetAppDomainList ( uint count , [ In , MarshalUsing ( CountElementName = "count" ) , Out ] ClrDataAddress [ ] values , uint * pNeeded )
116
- => _legacyImpl is not null ? _legacyImpl . GetAppDomainList ( count , values , pNeeded ) : HResults . E_NOTIMPL ;
116
+ {
117
+ int hr = HResults . S_OK ;
118
+ try
119
+ {
120
+ uint i = 0 ;
121
+ TargetPointer appDomainPointer = _target . ReadGlobalPointer ( Constants . Globals . AppDomain ) ;
122
+ TargetPointer appDomain = _target . ReadPointer ( appDomainPointer ) ;
123
+
124
+ if ( appDomain != TargetPointer . Null && values . Length > 0 )
125
+ {
126
+ values [ 0 ] = appDomain . ToClrDataAddress ( _target ) ;
127
+ i = 1 ;
128
+ }
129
+
130
+ if ( pNeeded is not null )
131
+ {
132
+ * pNeeded = i ;
133
+ }
134
+ }
135
+ catch ( System . Exception ex )
136
+ {
137
+ hr = ex . HResult ;
138
+ }
139
+ #if DEBUG
140
+ if ( _legacyImpl is not null )
141
+ {
142
+ ClrDataAddress [ ] valuesLocal = new ClrDataAddress [ count ] ;
143
+ uint neededLocal ;
144
+ int hrLocal = _legacyImpl . GetAppDomainList ( count , valuesLocal , & neededLocal ) ;
145
+ Debug . Assert ( hrLocal == hr , $ "cDAC: { hr : x} , DAC: { hrLocal : x} ") ;
146
+ Debug . Assert ( pNeeded == null || * pNeeded == neededLocal ) ;
147
+ if ( values is not null && values . Length > 0 && valuesLocal . Length > 0 )
148
+ {
149
+ Debug . Assert ( values [ 0 ] == valuesLocal [ 0 ] , $ "cDAC: { values [ 0 ] : x} , DAC: { valuesLocal [ 0 ] : x} ") ;
150
+ }
151
+ }
152
+ #endif
153
+ return hr ;
154
+ }
117
155
int ISOSDacInterface . GetAppDomainName ( ClrDataAddress addr , uint count , char * name , uint * pNeeded )
118
156
=> _legacyImpl is not null ? _legacyImpl . GetAppDomainName ( addr , count , name , pNeeded ) : HResults . E_NOTIMPL ;
119
157
int ISOSDacInterface . GetAppDomainStoreData ( void * data )
0 commit comments