@@ -152,16 +152,18 @@ public void Clear ()
152
152
AssertOpCodeSequence ( new OpCode [ ] { } , method ) ;
153
153
}
154
154
155
- [ TestCase ( RoundtripType . None , false , false ) ]
156
- [ TestCase ( RoundtripType . Pdb , false , false ) ]
157
- [ TestCase ( RoundtripType . Pdb , true , false ) ]
158
- [ TestCase ( RoundtripType . Pdb , true , true ) ]
159
- [ TestCase ( RoundtripType . PortablePdb , false , false ) ]
160
- [ TestCase ( RoundtripType . PortablePdb , true , false ) ]
161
- [ TestCase ( RoundtripType . PortablePdb , true , true ) ]
162
- public void InsertAfterWithSymbolRoundtrip ( RoundtripType roundtripType , bool forceUnresolved , bool reverseScopes )
155
+ [ TestCase ( RoundtripType . None , false , false , false ) ]
156
+ [ TestCase ( RoundtripType . Pdb , false , false , false ) ]
157
+ [ TestCase ( RoundtripType . Pdb , true , false , false ) ]
158
+ [ TestCase ( RoundtripType . Pdb , true , false , true ) ]
159
+ [ TestCase ( RoundtripType . Pdb , true , true , false ) ]
160
+ [ TestCase ( RoundtripType . PortablePdb , false , false , false ) ]
161
+ [ TestCase ( RoundtripType . PortablePdb , true , false , false ) ]
162
+ [ TestCase ( RoundtripType . PortablePdb , true , false , true ) ]
163
+ [ TestCase ( RoundtripType . PortablePdb , true , true , false ) ]
164
+ public void InsertAfterWithSymbolRoundtrip ( RoundtripType roundtripType , bool forceUnresolved , bool reverseScopes , bool padIL )
163
165
{
164
- var methodBody = CreateTestMethodWithLocalScopes ( ) ;
166
+ var methodBody = CreateTestMethodWithLocalScopes ( padIL ) ;
165
167
methodBody = RoundtripMethodBody ( methodBody , roundtripType , forceUnresolved , reverseScopes ) ;
166
168
167
169
var il = methodBody . GetILProcessor ( ) ;
@@ -176,16 +178,18 @@ public void InsertAfterWithSymbolRoundtrip (RoundtripType roundtripType, bool fo
176
178
methodBody . Method . Module . Dispose ( ) ;
177
179
}
178
180
179
- [ TestCase ( RoundtripType . None , false , false ) ]
180
- [ TestCase ( RoundtripType . Pdb , false , false ) ]
181
- [ TestCase ( RoundtripType . Pdb , true , false ) ]
182
- [ TestCase ( RoundtripType . Pdb , true , true ) ]
183
- [ TestCase ( RoundtripType . PortablePdb , false , false ) ]
184
- [ TestCase ( RoundtripType . PortablePdb , true , false ) ]
185
- [ TestCase ( RoundtripType . PortablePdb , true , true ) ]
186
- public void RemoveWithSymbolRoundtrip ( RoundtripType roundtripType , bool forceUnresolved , bool reverseScopes )
181
+ [ TestCase ( RoundtripType . None , false , false , false ) ]
182
+ [ TestCase ( RoundtripType . Pdb , false , false , false ) ]
183
+ [ TestCase ( RoundtripType . Pdb , true , false , false ) ]
184
+ [ TestCase ( RoundtripType . Pdb , true , false , true ) ]
185
+ [ TestCase ( RoundtripType . Pdb , true , true , false ) ]
186
+ [ TestCase ( RoundtripType . PortablePdb , false , false , false ) ]
187
+ [ TestCase ( RoundtripType . PortablePdb , true , false , false ) ]
188
+ [ TestCase ( RoundtripType . PortablePdb , true , false , true ) ]
189
+ [ TestCase ( RoundtripType . PortablePdb , true , true , false ) ]
190
+ public void RemoveWithSymbolRoundtrip ( RoundtripType roundtripType , bool forceUnresolved , bool reverseScopes , bool padIL )
187
191
{
188
- var methodBody = CreateTestMethodWithLocalScopes ( ) ;
192
+ var methodBody = CreateTestMethodWithLocalScopes ( padIL ) ;
189
193
methodBody = RoundtripMethodBody ( methodBody , roundtripType , forceUnresolved , reverseScopes ) ;
190
194
191
195
var il = methodBody . GetILProcessor ( ) ;
@@ -200,16 +204,18 @@ public void RemoveWithSymbolRoundtrip (RoundtripType roundtripType, bool forceUn
200
204
methodBody . Method . Module . Dispose ( ) ;
201
205
}
202
206
203
- [ TestCase ( RoundtripType . None , false , false ) ]
204
- [ TestCase ( RoundtripType . Pdb , false , false ) ]
205
- [ TestCase ( RoundtripType . Pdb , true , false ) ]
206
- [ TestCase ( RoundtripType . Pdb , true , true ) ]
207
- [ TestCase ( RoundtripType . PortablePdb , false , false ) ]
208
- [ TestCase ( RoundtripType . PortablePdb , true , false ) ]
209
- [ TestCase ( RoundtripType . PortablePdb , true , true ) ]
210
- public void ReplaceWithSymbolRoundtrip ( RoundtripType roundtripType , bool forceUnresolved , bool reverseScopes )
207
+ [ TestCase ( RoundtripType . None , false , false , false ) ]
208
+ [ TestCase ( RoundtripType . Pdb , false , false , false ) ]
209
+ [ TestCase ( RoundtripType . Pdb , true , false , false ) ]
210
+ [ TestCase ( RoundtripType . Pdb , true , false , true ) ]
211
+ [ TestCase ( RoundtripType . Pdb , true , true , false ) ]
212
+ [ TestCase ( RoundtripType . PortablePdb , false , false , false ) ]
213
+ [ TestCase ( RoundtripType . PortablePdb , true , false , false ) ]
214
+ [ TestCase ( RoundtripType . PortablePdb , true , false , true ) ]
215
+ [ TestCase ( RoundtripType . PortablePdb , true , true , false ) ]
216
+ public void ReplaceWithSymbolRoundtrip ( RoundtripType roundtripType , bool forceUnresolved , bool reverseScopes , bool padIL )
211
217
{
212
- var methodBody = CreateTestMethodWithLocalScopes ( ) ;
218
+ var methodBody = CreateTestMethodWithLocalScopes ( padIL ) ;
213
219
methodBody = RoundtripMethodBody ( methodBody , roundtripType , forceUnresolved , reverseScopes ) ;
214
220
215
221
var il = methodBody . GetILProcessor ( ) ;
@@ -224,16 +230,18 @@ public void ReplaceWithSymbolRoundtrip (RoundtripType roundtripType, bool forceU
224
230
methodBody . Method . Module . Dispose ( ) ;
225
231
}
226
232
227
- [ TestCase ( RoundtripType . None , false , false ) ]
228
- [ TestCase ( RoundtripType . Pdb , false , false ) ]
229
- [ TestCase ( RoundtripType . Pdb , true , false ) ]
230
- [ TestCase ( RoundtripType . Pdb , true , true ) ]
231
- [ TestCase ( RoundtripType . PortablePdb , false , false ) ]
232
- [ TestCase ( RoundtripType . PortablePdb , true , false ) ]
233
- [ TestCase ( RoundtripType . PortablePdb , true , true ) ]
234
- public void EditBodyWithScopesAndSymbolRoundtrip ( RoundtripType roundtripType , bool forceUnresolved , bool reverseScopes )
233
+ [ TestCase ( RoundtripType . None , false , false , false ) ]
234
+ [ TestCase ( RoundtripType . Pdb , false , false , false ) ]
235
+ [ TestCase ( RoundtripType . Pdb , true , false , false ) ]
236
+ [ TestCase ( RoundtripType . Pdb , true , false , true ) ]
237
+ [ TestCase ( RoundtripType . Pdb , true , true , false ) ]
238
+ [ TestCase ( RoundtripType . PortablePdb , false , false , false ) ]
239
+ [ TestCase ( RoundtripType . PortablePdb , true , false , false ) ]
240
+ [ TestCase ( RoundtripType . PortablePdb , true , false , true ) ]
241
+ [ TestCase ( RoundtripType . PortablePdb , true , true , false ) ]
242
+ public void EditBodyWithScopesAndSymbolRoundtrip ( RoundtripType roundtripType , bool forceUnresolved , bool reverseScopes , bool padIL )
235
243
{
236
- var methodBody = CreateTestMethodWithLocalScopes ( ) ;
244
+ var methodBody = CreateTestMethodWithLocalScopes ( padIL ) ;
237
245
methodBody = RoundtripMethodBody ( methodBody , roundtripType , forceUnresolved , reverseScopes ) ;
238
246
239
247
var il = methodBody . GetILProcessor ( ) ;
@@ -320,13 +328,16 @@ static void AssertLocalScope (MethodBody methodBody, ScopeDebugInformation scope
320
328
Assert . IsTrue ( scope . End . IsEndOfMethod ) ;
321
329
}
322
330
323
- static MethodBody CreateTestMethodWithLocalScopes ( )
331
+ static MethodBody CreateTestMethodWithLocalScopes ( bool padILWithNulls )
324
332
{
325
333
var module = ModuleDefinition . CreateModule ( "TestILProcessor" , ModuleKind . Dll ) ;
326
334
var type = new TypeDefinition ( "NS" , "TestType" , TypeAttributes . Public | TypeAttributes . Abstract | TypeAttributes . Sealed , module . ImportReference ( typeof ( object ) ) ) ;
327
335
module . Types . Add ( type ) ;
328
336
329
337
var methodBody = CreateTestMethod ( OpCodes . Nop , OpCodes . Ldloc_0 , OpCodes . Nop , OpCodes . Ldloc_1 , OpCodes . Nop , OpCodes . Ldloc_2 , OpCodes . Nop ) ;
338
+ if ( padILWithNulls )
339
+ methodBody . Instructions . Capacity += 10 ;
340
+
330
341
var method = methodBody . Method ;
331
342
method . ReturnType = module . ImportReference ( typeof ( void ) ) ;
332
343
type . Methods . Add ( method ) ;
0 commit comments