oak-msil 0.0.11

Microsoft Intermediate Language (MSIL) parser with support for .NET Common Language Infrastructure and bytecode analysis.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
// MSIL (Microsoft Intermediate Language) Test File
// This file tests various MSIL syntax elements for lexer testing

// Assembly metadata and declarations
.assembly extern mscorlib
{
    .publickeytoken = (B7 7A 5C 56 19 34 E0 89)
    .ver 4:0:0:0
}

.assembly extern System
{
    .publickeytoken = (B7 7A 5C 56 19 34 E0 89)
    .ver 4:0:0:0
}

.assembly extern System.Core
{
    .publickeytoken = (B7 7A 5C 56 19 34 E0 89)
    .ver 4:0:0:0
}

.assembly ComprehensiveTest
{
    .custom instance void [mscorlib]System.Reflection.AssemblyTitleAttribute::.ctor(string) = ( 01 00 12 43 6F 6D 70 72 65 68 65 6E 73 69 76 65 20 54 65 73 74 00 00 )
    .custom instance void [mscorlib]System.Reflection.AssemblyDescriptionAttribute::.ctor(string) = ( 01 00 2A 43 6F 6D 70 72 65 68 65 6E 73 69 76 65 20 4D 53 49 4C 20 54 65 73 74 20 41 73 73 65 6D 62 6C 79 00 00 )
    .custom instance void [mscorlib]System.Reflection.AssemblyConfigurationAttribute::.ctor(string) = ( 01 00 00 00 00 )
    .custom instance void [mscorlib]System.Reflection.AssemblyCompanyAttribute::.ctor(string) = ( 01 00 0B 54 65 73 74 20 43 6F 6D 70 61 6E 79 00 00 )
    .custom instance void [mscorlib]System.Reflection.AssemblyProductAttribute::.ctor(string) = ( 01 00 12 43 6F 6D 70 72 65 68 65 6E 73 69 76 65 20 54 65 73 74 00 00 )
    .custom instance void [mscorlib]System.Reflection.AssemblyCopyrightAttribute::.ctor(string) = ( 01 00 12 43 6F 70 79 72 69 67 68 74 20 32 30 32 34 00 00 )
    .custom instance void [mscorlib]System.Reflection.AssemblyTrademarkAttribute::.ctor(string) = ( 01 00 00 00 00 )
    .custom instance void [mscorlib]System.Reflection.AssemblyVersionAttribute::.ctor(string) = ( 01 00 07 31 2E 30 2E 30 2E 30 00 00 )
    .custom instance void [mscorlib]System.Reflection.AssemblyFileVersionAttribute::.ctor(string) = ( 01 00 07 31 2E 30 2E 30 2E 30 00 00 )
    .hash algorithm 0x00008004
    .ver 1:0:0:0
}

.module ComprehensiveTest.exe
.imagebase 0x00400000
.file alignment 0x00000200
.stackreserve 0x00100000
.subsystem 0x0003       // WINDOWS_CUI
.corflags 0x00000001    //  ILONLY

// Custom attributes
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32) = ( 01 00 08 00 00 00 00 00 )
.custom instance void [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::.ctor() = ( 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78 63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 )

// Namespace and class definitions
.namespace ComprehensiveTest
{
    // Enum definition
    .class public auto ansi sealed Status
                  extends [mscorlib]System.Enum
    {
        .field public specialname rtspecialname int32 value__
        .field public static literal valuetype ComprehensiveTest.Status Pending = int32(0)
        .field public static literal valuetype ComprehensiveTest.Status Active = int32(1)
        .field public static literal valuetype ComprehensiveTest.Status Inactive = int32(2)
        .field public static literal valuetype ComprehensiveTest.Status Completed = int32(3)
    }

    // Interface definition
    .class interface public abstract auto ansi ITestInterface
    {
        .method public hidebysig newslot abstract virtual 
                        instance int32  Calculate(int32 x, int32 y) cil managed
        {
        }

        .method public hidebysig newslot abstract virtual 
                        instance string  GetDescription() cil managed
        {
        }
    }

    // Delegate definition
    .class public auto ansi sealed TestDelegate
                  extends [mscorlib]System.MulticastDelegate
    {
        .method public hidebysig specialname rtspecialname 
                        instance void  .ctor(object 'object',
                                                                    native int 'method') runtime managed
        {
        }

        .method public hidebysig newslot virtual 
                        instance void  Invoke(string message) runtime managed
        {
        }

        .method public hidebysig newslot virtual 
                        instance class [mscorlib]System.IAsyncResult 
                        BeginInvoke(string message,
                                                class [mscorlib]System.AsyncCallback callback,
                                                object 'object') runtime managed
        {
        }

        .method public hidebysig newslot virtual 
                        instance void  EndInvoke(class [mscorlib]System.IAsyncResult result) runtime managed
        {
        }
    }

    // Generic class definition
    .class public auto ansi beforefieldinit 'GenericContainer`1'<T>
                  extends [mscorlib]System.Object
    {
        .field private !T m_value
        .field private static int32 s_count

        // Static constructor
        .method private hidebysig specialname rtspecialname static 
                        void  .cctor() cil managed
        {
            .maxstack  8
            IL_0000:  ldc.i4.0
            IL_0001:  stsfld     int32 class ComprehensiveTest.'GenericContainer`1'<!T>::s_count
            IL_0006:  ret
        }

        // Instance constructor
        .method public hidebysig specialname rtspecialname 
                        instance void  .ctor() cil managed
        {
            .maxstack  8
            IL_0000:  ldarg.0
            IL_0001:  call       instance void [mscorlib]System.Object::.ctor()
            IL_0006:  ldsfld     int32 class ComprehensiveTest.'GenericContainer`1'<!T>::s_count
            IL_000b:  ldc.i4.1
            IL_000c:  add
            IL_000d:  stsfld     int32 class ComprehensiveTest.'GenericContainer`1'<!T>::s_count
            IL_0012:  ret
        }

        // Constructor with parameter
        .method public hidebysig specialname rtspecialname 
                        instance void  .ctor(!T value) cil managed
        {
            .maxstack  8
            IL_0000:  ldarg.0
            IL_0001:  call       instance void [mscorlib]System.Object::.ctor()
            IL_0006:  ldarg.0
            IL_0007:  ldarg.1
            IL_0008:  stfld      !0 class ComprehensiveTest.'GenericContainer`1'<!T>::m_value
            IL_000d:  ldsfld     int32 class ComprehensiveTest.'GenericContainer`1'<!T>::s_count
            IL_0012:  ldc.i4.1
            IL_0013:  add
            IL_0014:  stsfld     int32 class ComprehensiveTest.'GenericContainer`1'<!T>::s_count
            IL_0019:  ret
        }

        // Property getter
        .method public hidebysig specialname 
                        instance !T  get_Value() cil managed
        {
            .maxstack  1
            .locals init (!T V_0)
            IL_0000:  ldarg.0
            IL_0001:  ldfld      !0 class ComprehensiveTest.'GenericContainer`1'<!T>::m_value
            IL_0006:  stloc.0
            IL_0007:  br.s       IL_0009
            IL_0009:  ldloc.0
            IL_000a:  ret
        }

        // Property setter
        .method public hidebysig specialname 
                        instance void  set_Value(!T 'value') cil managed
        {
            .maxstack  8
            IL_0000:  ldarg.0
            IL_0001:  ldarg.1
            IL_0002:  stfld      !0 class ComprehensiveTest.'GenericContainer`1'<!T>::m_value
            IL_0007:  ret
        }

        // Property declaration
        .property instance !T Value()
        {
            .get instance !T ComprehensiveTest.'GenericContainer`1'::get_Value()
            .set instance void ComprehensiveTest.'GenericContainer`1'::set_Value(!T)
        }

        // Static property
        .method public hidebysig specialname static 
                        int32  get_Count() cil managed
        {
            .maxstack  1
            .locals init (int32 V_0)
            IL_0000:  ldsfld     int32 class ComprehensiveTest.'GenericContainer`1'<!T>::s_count
            IL_0005:  stloc.0
            IL_0006:  br.s       IL_0008
            IL_0008:  ldloc.0
            IL_0009:  ret
        }

        .property int32 Count()
        {
            .get int32 ComprehensiveTest.'GenericContainer`1'::get_Count()
        }
    }

    // Main test class
    .class public auto ansi beforefieldinit TestClass
                  extends [mscorlib]System.Object
                  implements ComprehensiveTest.ITestInterface
    {
        // Fields
        .field private int32 m_instanceField
        .field private static string s_staticField
        .field public string PublicField
        .field assembly string InternalField
        .field family string ProtectedField
        .field famandassem string ProtectedInternalField
        .field private static literal int32 CONSTANT_VALUE = int32(42)

        // Events
        .field private class ComprehensiveTest.TestDelegate TestEvent
        .event ComprehensiveTest.TestDelegate TestEvent
        {
            .addon instance void ComprehensiveTest.TestClass::add_TestEvent(class ComprehensiveTest.TestDelegate)
            .removeon instance void ComprehensiveTest.TestClass::remove_TestEvent(class ComprehensiveTest.TestDelegate)
        }

        // Static constructor
        .method private hidebysig specialname rtspecialname static 
                        void  .cctor() cil managed
        {
            .maxstack  8
            IL_0000:  ldstr      "Static initialization"
            IL_0005:  stsfld     string ComprehensiveTest.TestClass::s_staticField
            IL_000a:  ret
        }

        // Instance constructor
        .method public hidebysig specialname rtspecialname 
                        instance void  .ctor() cil managed
        {
            .maxstack  8
            IL_0000:  ldarg.0
            IL_0001:  call       instance void [mscorlib]System.Object::.ctor()
            IL_0006:  ldarg.0
            IL_0007:  ldc.i4.0
            IL_0008:  stfld      int32 ComprehensiveTest.TestClass::m_instanceField
            IL_000d:  ldarg.0
            IL_000e:  ldstr      "Default public field"
            IL_0013:  stfld      string ComprehensiveTest.TestClass::PublicField
            IL_0018:  ret
        }

        // Constructor with parameters
        .method public hidebysig specialname rtspecialname 
                        instance void  .ctor(int32 value, string text) cil managed
        {
            .maxstack  8
            IL_0000:  ldarg.0
            IL_0001:  call       instance void [mscorlib]System.Object::.ctor()
            IL_0006:  ldarg.0
            IL_0007:  ldarg.1
            IL_0008:  stfld      int32 ComprehensiveTest.TestClass::m_instanceField
            IL_000d:  ldarg.0
            IL_000e:  ldarg.2
            IL_000f:  stfld      string ComprehensiveTest.TestClass::PublicField
            IL_0014:  ret
        }

        // Interface implementation
        .method public hidebysig newslot virtual final 
                        instance int32  Calculate(int32 x, int32 y) cil managed
        {
            .override ComprehensiveTest.ITestInterface::Calculate
            .maxstack  2
            .locals init (int32 V_0)
            IL_0000:  ldarg.1
            IL_0001:  ldarg.2
            IL_0002:  add
            IL_0003:  stloc.0
            IL_0004:  br.s       IL_0006
            IL_0006:  ldloc.0
            IL_0007:  ret
        }

        .method public hidebysig newslot virtual final 
                        instance string  GetDescription() cil managed
        {
            .override ComprehensiveTest.ITestInterface::GetDescription
            .maxstack  1
            .locals init (string V_0)
            IL_0000:  ldstr      "TestClass implementation"
            IL_0005:  stloc.0
            IL_0006:  br.s       IL_0008
            IL_0008:  ldloc.0
            IL_0009:  ret
        }

        // Event accessors
        .method public hidebysig specialname 
                        instance void  add_TestEvent(class ComprehensiveTest.TestDelegate 'value') cil managed
        {
            .maxstack  3
            .locals init (class ComprehensiveTest.TestDelegate V_0,
                                        class ComprehensiveTest.TestDelegate V_1,
                                        class ComprehensiveTest.TestDelegate V_2)
            IL_0000:  ldarg.0
            IL_0001:  ldfld      class ComprehensiveTest.TestDelegate ComprehensiveTest.TestClass::TestEvent
            IL_0006:  stloc.0
            IL_0007:  ldloc.0
            IL_0008:  stloc.1
            IL_0009:  ldloc.1
            IL_000a:  ldarg.1
            IL_000b:  call       class [mscorlib]System.Delegate [mscorlib]System.Delegate::Combine(class [mscorlib]System.Delegate,
                                                                                                                                                                                                class [mscorlib]System.Delegate)
            IL_0010:  castclass  ComprehensiveTest.TestDelegate
            IL_0015:  stloc.2
            IL_0016:  ldarg.0
            IL_0017:  ldflda     class ComprehensiveTest.TestDelegate ComprehensiveTest.TestClass::TestEvent
            IL_001c:  ldloc.2
            IL_001d:  ldloc.1
            IL_001e:  call       !!0 [mscorlib]System.Threading.Interlocked::CompareExchange<class ComprehensiveTest.TestDelegate>(!!0&,
                                                                                                                                                                                                                                                            !!0,
                                                                                                                                                                                                                                                            !!0)
            IL_0023:  stloc.0
            IL_0024:  ldloc.0
            IL_0025:  ldloc.1
            IL_0026:  bne.un.s   IL_0007
            IL_0028:  ret
        }

        .method public hidebysig specialname 
                        instance void  remove_TestEvent(class ComprehensiveTest.TestDelegate 'value') cil managed
        {
            .maxstack  3
            .locals init (class ComprehensiveTest.TestDelegate V_0,
                                        class ComprehensiveTest.TestDelegate V_1,
                                        class ComprehensiveTest.TestDelegate V_2)
            IL_0000:  ldarg.0
            IL_0001:  ldfld      class ComprehensiveTest.TestDelegate ComprehensiveTest.TestClass::TestEvent
            IL_0006:  stloc.0
            IL_0007:  ldloc.0
            IL_0008:  stloc.1
            IL_0009:  ldloc.1
            IL_000a:  ldarg.1
            IL_000b:  call       class [mscorlib]System.Delegate [mscorlib]System.Delegate::Remove(class [mscorlib]System.Delegate,
                                                                                                                                                                                            class [mscorlib]System.Delegate)
            IL_0010:  castclass  ComprehensiveTest.TestDelegate
            IL_0015:  stloc.2
            IL_0016:  ldarg.0
            IL_0017:  ldflda     class ComprehensiveTest.TestDelegate ComprehensiveTest.TestClass::TestEvent
            IL_001c:  ldloc.2
            IL_001d:  ldloc.1
            IL_001e:  call       !!0 [mscorlib]System.Threading.Interlocked::CompareExchange<class ComprehensiveTest.TestDelegate>(!!0&,
                                                                                                                                                                                                                                                            !!0,
                                                                                                                                                                                                                                                            !!0)
            IL_0023:  stloc.0
            IL_0024:  ldloc.0
            IL_0025:  ldloc.1
            IL_0026:  bne.un.s   IL_0007
            IL_0028:  ret
        }

        // Method with various instruction types
        .method public hidebysig 
                        instance void  ComplexMethod(int32 param1, 
                                                                                  string param2, 
                                                                                  bool param3) cil managed
        {
            .maxstack  3
            .locals init (int32 V_0,
                                        string V_1,
                                        bool V_2,
                                        int32 V_3,
                                        bool V_4)

            // Load constants
            IL_0000:  ldc.i4.0
            IL_0001:  stloc.0
            IL_0002:  ldstr      ""
            IL_0007:  stloc.1
            IL_0008:  ldc.i4.0
            IL_0009:  stloc.2

            // Arithmetic operations
            IL_000a:  ldarg.1
            IL_000b:  ldc.i4.s   10
            IL_000d:  add
            IL_000e:  stloc.3

            // Conditional branching
            IL_000f:  ldarg.3
            IL_0010:  brfalse.s  IL_0025

            // String operations
            IL_0012:  ldarg.2
            IL_0013:  ldstr      " - processed"
            IL_0018:  call       string [mscorlib]System.String::Concat(string, string)
            IL_001d:  stloc.1
            IL_001e:  ldc.i4.1
            IL_001f:  stloc.2
            IL_0020:  br.s       IL_002b

            IL_0022:  ldarg.2
            IL_0023:  stloc.1

            // Loop example
            IL_0025:  ldc.i4.0
            IL_0026:  stloc.0
            IL_0027:  br.s       IL_0035

            IL_0029:  ldloc.0
            IL_002a:  ldc.i4.1
            IL_002b:  add
            IL_002c:  stloc.0

            IL_002d:  ldloc.0
            IL_002e:  ldc.i4.s   10
            IL_0030:  clt
            IL_0032:  stloc.s    V_4
            IL_0034:  ldloc.s    V_4
            IL_0036:  brtrue.s   IL_0029

            // Method call
            IL_0038:  ldarg.0
            IL_0039:  ldloc.3
            IL_003a:  ldc.i4.5
            IL_003b:  call       instance int32 ComprehensiveTest.TestClass::Calculate(int32, int32)
            IL_0040:  pop

            IL_0041:  ret
        }

        // Method with exception handling
        .method public hidebysig 
                        instance int32  DivideWithExceptionHandling(int32 numerator, 
                                                                                                                  int32 denominator) cil managed
        {
            .maxstack  2
            .locals init (int32 V_0,
                                        class [mscorlib]System.Exception V_1)

            .try
            {
                IL_0000:  ldarg.1
                IL_0001:  ldarg.2
                IL_0002:  div
                IL_0003:  stloc.0
                IL_0004:  leave.s    IL_001a
            }
            catch [mscorlib]System.DivideByZeroException
            {
                IL_0006:  pop
                IL_0007:  ldc.i4.0
                IL_0008:  stloc.0
                IL_0009:  leave.s    IL_001a
            }
            catch [mscorlib]System.Exception
            {
                IL_000b:  stloc.1
                IL_000c:  ldloc.1
                IL_000d:  callvirt   instance string [mscorlib]System.Object::ToString()
                IL_0012:  call       void [mscorlib]System.Console::WriteLine(string)
                IL_0017:  ldc.i4.m1
                IL_0018:  stloc.0
                IL_0019:  leave.s    IL_001a
            }

            IL_001a:  ldloc.0
            IL_001b:  ret
        }

        // Method with finally block
        .method public hidebysig 
                        instance void  MethodWithFinally() cil managed
        {
            .maxstack  1
            .locals init (bool V_0)

            .try
            {
                IL_0000:  ldstr      "In try block"
                IL_0005:  call       void [mscorlib]System.Console::WriteLine(string)
                IL_000a:  leave.s    IL_001c
            }
            finally
            {
                IL_000c:  ldstr      "In finally block"
                IL_0011:  call       void [mscorlib]System.Console::WriteLine(string)
                IL_0016:  endfinally
            }

            IL_0017:  ldstr      "After try-finally"
            IL_001c:  call       void [mscorlib]System.Console::WriteLine(string)
            IL_0021:  ret
        }

        // Generic method
        .method public hidebysig 
                        instance !!T  GenericMethod<T>(!!T input) cil managed
        {
            .maxstack  1
            .locals init (!!T V_0)
            IL_0000:  ldarg.1
            IL_0001:  stloc.0
            IL_0002:  br.s       IL_0004
            IL_0004:  ldloc.0
            IL_0005:  ret
        }

        // Method with ref and out parameters
        .method public hidebysig 
                        instance void  RefOutMethod(int32& refParam, 
                                                                                [out] int32& outParam) cil managed
        {
            .param [2]
            .custom instance void [mscorlib]System.Runtime.InteropServices.OutAttribute::.ctor() = ( 01 00 00 00 )
            .maxstack  3
            IL_0000:  ldarg.1
            IL_0001:  ldarg.1
            IL_0002:  ldind.i4
            IL_0003:  ldc.i4.1
            IL_0004:  add
            IL_0005:  stind.i4
            IL_0006:  ldarg.2
            IL_0007:  ldc.i4.s   42
            IL_0009:  stind.i4
            IL_000a:  ret
        }

        // Async method (simplified)
        .method public hidebysig 
                        instance class [mscorlib]System.Threading.Tasks.Task 
                        AsyncMethod() cil managed
        {
            .custom instance void [mscorlib]System.Runtime.CompilerServices.AsyncStateMachineAttribute::.ctor(class [mscorlib]System.Type) = ( 01 00 2B 43 6F 6D 70 72 65 68 65 6E 73 69 76 65 54 65 73 74 2E 54 65 73 74 43 6C 61 73 73 2B 3C 41 73 79 6E 63 4D 65 74 68 6F 64 3E 64 5F 5F 31 00 00 )
            .maxstack  2
            .locals init (class [mscorlib]System.Threading.Tasks.Task V_0)
            IL_0000:  call       class [mscorlib]System.Threading.Tasks.Task [mscorlib]System.Threading.Tasks.Task::get_CompletedTask()
            IL_0005:  stloc.0
            IL_0006:  br.s       IL_0008
            IL_0008:  ldloc.0
            IL_0009:  ret
        }
    }

    // Program entry point
    .class private auto ansi beforefieldinit Program
                  extends [mscorlib]System.Object
    {
        .method private hidebysig static void  Main(string[] args) cil managed
        {
            .entrypoint
            .maxstack  4
            .locals init (class ComprehensiveTest.TestClass V_0,
                                        class ComprehensiveTest.'GenericContainer`1'<int32> V_1,
                                        class ComprehensiveTest.'GenericContainer`1'<string> V_2,
                                        int32 V_3,
                                        int32 V_4,
                                        string V_5)

            // Create test instance
            IL_0000:  newobj     instance void ComprehensiveTest.TestClass::.ctor()
            IL_0005:  stloc.0

            // Test basic functionality
            IL_0006:  ldloc.0
            IL_0007:  ldc.i4.s   10
            IL_0009:  ldc.i4.s   20
            IL_000b:  callvirt   instance int32 ComprehensiveTest.TestClass::Calculate(int32, int32)
            IL_0010:  stloc.3

            // Test generic container with int
            IL_0011:  ldc.i4.s   42
            IL_0013:  newobj     instance void class ComprehensiveTest.'GenericContainer`1'<int32>::.ctor(!0)
            IL_0018:  stloc.1

            // Test generic container with string
            IL_0019:  ldstr      "Hello World"
            IL_001e:  newobj     instance void class ComprehensiveTest.'GenericContainer`1'<string>::.ctor(!0)
            IL_0023:  stloc.2

            // Test exception handling
            IL_0024:  ldloc.0
            IL_0025:  ldc.i4.s   10
            IL_0027:  ldc.i4.0
            IL_0028:  call       instance int32 ComprehensiveTest.TestClass::DivideWithExceptionHandling(int32, int32)
            IL_002d:  stloc.s    V_4

            // Test ref/out parameters
            IL_002f:  ldloca.s   V_3
            IL_0031:  ldloca.s   V_4
            IL_0033:  ldloc.0
            IL_0034:  call       instance void ComprehensiveTest.TestClass::RefOutMethod(int32&, int32&)

            // Test complex method
            IL_0039:  ldloc.0
            IL_003a:  ldc.i4.s   100
            IL_003c:  ldstr      "Test message"
            IL_0041:  ldc.i4.1
            IL_0042:  call       instance void ComprehensiveTest.TestClass::ComplexMethod(int32, string, bool)

            // Test finally method
            IL_0047:  ldloc.0
            IL_0048:  call       instance void ComprehensiveTest.TestClass::MethodWithFinally()

            // Test generic method
            IL_004d:  ldloc.0
            IL_004e:  ldstr      "Generic test"
            IL_0053:  call       instance !!0 ComprehensiveTest.TestClass::GenericMethod<string>(!!0)
            IL_0058:  stloc.s    V_5

            // Output results
            IL_005a:  ldstr      "Calculation result: {0}"
            IL_005f:  ldloc.3
            IL_0060:  box        [mscorlib]System.Int32
            IL_0065:  call       void [mscorlib]System.Console::WriteLine(string, object)

            IL_006a:  ldstr      "Generic int value: {0}"
            IL_006f:  ldloc.1
            IL_0070:  call       instance !0 class ComprehensiveTest.'GenericContainer`1'<int32>::get_Value()
            IL_0075:  box        [mscorlib]System.Int32
            IL_007a:  call       void [mscorlib]System.Console::WriteLine(string, object)

            IL_007f:  ldstr      "Generic string value: {0}"
            IL_0084:  ldloc.2
            IL_0085:  call       instance !0 class ComprehensiveTest.'GenericContainer`1'<string>::get_Value()
            IL_008a:  call       void [mscorlib]System.Console::WriteLine(string, object)

            IL_008f:  ldstr      "Division result: {0}"
            IL_0094:  ldloc.s    V_4
            IL_0096:  box        [mscorlib]System.Int32
            IL_009b:  call       void [mscorlib]System.Console::WriteLine(string, object)

            IL_00a0:  ldstr      "Ref parameter: {0}, Out parameter: {1}"
            IL_00a5:  ldloc.3
            IL_00a6:  box        [mscorlib]System.Int32
            IL_00ab:  ldloc.s    V_4
            IL_00ad:  box        [mscorlib]System.Int32
            IL_00b2:  call       void [mscorlib]System.Console::WriteLine(string, object, object)

            IL_00b7:  ldstr      "Generic method result: {0}"
            IL_00bc:  ldloc.s    V_5
            IL_00be:  call       void [mscorlib]System.Console::WriteLine(string, object)

            IL_00c3:  ldstr      "Container count: {0}"
            IL_00c8:  call       int32 class ComprehensiveTest.'GenericContainer`1'<int32>::get_Count()
            IL_00cd:  box        [mscorlib]System.Int32
            IL_00d2:  call       void [mscorlib]System.Console::WriteLine(string, object)

            IL_00d7:  ldstr      "Press any key to exit..."
            IL_00dc:  call       void [mscorlib]System.Console::WriteLine(string)
            IL_00e1:  call       valuetype [mscorlib]System.ConsoleKeyInfo [mscorlib]System.Console::ReadKey()
            IL_00e6:  pop

            IL_00e7:  ret
        }

        .method public hidebysig specialname rtspecialname 
                        instance void  .ctor() cil managed
        {
            .maxstack  8
            IL_0000:  ldarg.0
            IL_0001:  call       instance void [mscorlib]System.Object::.ctor()
            IL_0006:  ret
        }
    }
}

// Global methods (outside namespace)
.method public hidebysig static void GlobalMethod() cil managed
{
    .maxstack  1
    IL_0000:  ldstr      "Global method called"
    IL_0005:  call       void [mscorlib]System.Console::WriteLine(string)
    IL_000a:  ret
}

// P/Invoke declaration
.method public hidebysig static pinvokeimpl("kernel32.dll" winapi) 
                bool GetComputerNameA(class [mscorlib]System.Text.StringBuilder lpBuffer,
                                                            uint32& nSize) cil managed preservesig
{
}

// Unmanaged function pointer
.method public hidebysig static 
                method void *(int32) GetFunctionPointer() cil managed
{
    .maxstack  1
    .locals init (method void *(int32) V_0)
    IL_0000:  ldnull
    IL_0001:  stloc.0
    IL_0002:  br.s       IL_0004
    IL_0004:  ldloc.0
    IL_0005:  ret
}

// Data section
.data cil I_00003000 = bytearray (
        48 65 6C 6C 6F 20 57 6F 72 6C 64 00 // "Hello World\0"
)

.data cil I_00003010 = bytearray (
        01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10
)

// Version info
.ver 1:0:0:0