Browse Source

Add lost ExceptionHandling pretty tests

pull/863/head
Siegfried Pammer 8 years ago
parent
commit
150803760b
  1. 46
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/ExceptionHandling.cs
  2. 132
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/ExceptionHandling.il
  3. 101
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/ExceptionHandling.opt.il
  4. 153
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/ExceptionHandling.opt.roslyn.il
  5. 189
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/ExceptionHandling.roslyn.il

46
ICSharpCode.Decompiler.Tests/TestCases/Pretty/ExceptionHandling.cs

@ -17,6 +17,8 @@
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
using System;
namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
{ {
public abstract class ExceptionHandling public abstract class ExceptionHandling
@ -35,5 +37,49 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
return false; return false;
} }
public bool SimpleTryCatchException()
{
try {
Console.WriteLine("Try");
return this.B(new Random().Next());
} catch (Exception) {
Console.WriteLine("CatchException");
}
return false;
}
public bool SimpleTryCatchExceptionWithName()
{
try {
Console.WriteLine("Try");
return this.B(new Random().Next());
} catch (Exception ex) {
Console.WriteLine("CatchException ex: " + ex.ToString());
}
return false;
}
#if !LEGACY_CSC
public bool SimpleTryCatchExceptionWithNameAndCondition()
{
try {
Console.WriteLine("Try");
return this.B(new Random().Next());
} catch (Exception ex) when (ex.Message.Contains("test")) {
Console.WriteLine("CatchException ex: " + ex.ToString());
}
return false;
}
#endif
public bool SimpleTryFinally()
{
try {
Console.WriteLine("Try");
} finally {
Console.WriteLine("Finally");
}
return false;
}
} }
} }

132
ICSharpCode.Decompiler.Tests/TestCases/Pretty/ExceptionHandling.il

@ -10,7 +10,7 @@
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4.. .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0 .ver 4:0:0:0
} }
.assembly ejk2wcey .assembly '3ufueglz'
{ {
.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.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 // ....T..WrapNonEx .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 // ....T..WrapNonEx
@ -20,15 +20,15 @@
.hash algorithm 0x00008004 .hash algorithm 0x00008004
.ver 0:0:0:0 .ver 0:0:0:0
} }
.module ejk2wcey.dll .module '3ufueglz.dll'
// MVID: {FBD2FAE4-D125-4C61-B03A-EB51D0392AD4} // MVID: {11FA4C6A-1160-4F37-B429-D5A05548EC92}
.custom instance void [mscorlib]System.Security.UnverifiableCodeAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Security.UnverifiableCodeAttribute::.ctor() = ( 01 00 00 00 )
.imagebase 0x10000000 .imagebase 0x10000000
.file alignment 0x00000200 .file alignment 0x00000200
.stackreserve 0x00100000 .stackreserve 0x00100000
.subsystem 0x0003 // WINDOWS_CUI .subsystem 0x0003 // WINDOWS_CUI
.corflags 0x00000001 // ILONLY .corflags 0x00000001 // ILONLY
// Image base: 0x02F20000 // Image base: 0x02D90000
// =============== CLASS MEMBERS DECLARATION =================== // =============== CLASS MEMBERS DECLARATION ===================
@ -95,6 +95,130 @@
IL_002a: ret IL_002a: ret
} // end of method ExceptionHandling::ConditionalReturnInThrow } // end of method ExceptionHandling::ConditionalReturnInThrow
.method public hidebysig instance bool
SimpleTryCatchException() cil managed
{
// Code size 56 (0x38)
.maxstack 2
.locals init (bool V_0)
IL_0000: nop
.try
{
IL_0001: nop
IL_0002: ldstr "Try"
IL_0007: call void [mscorlib]System.Console::WriteLine(string)
IL_000c: nop
IL_000d: ldarg.0
IL_000e: newobj instance void [mscorlib]System.Random::.ctor()
IL_0013: callvirt instance int32 [mscorlib]System.Random::Next()
IL_0018: callvirt instance bool ICSharpCode.Decompiler.Tests.TestCases.Pretty.ExceptionHandling::B(int32)
IL_001d: stloc.0
IL_001e: leave.s IL_0035
} // end .try
catch [mscorlib]System.Exception
{
IL_0020: pop
IL_0021: nop
IL_0022: ldstr "CatchException"
IL_0027: call void [mscorlib]System.Console::WriteLine(string)
IL_002c: nop
IL_002d: nop
IL_002e: leave.s IL_0030
} // end handler
IL_0030: nop
IL_0031: ldc.i4.0
IL_0032: stloc.0
IL_0033: br.s IL_0035
IL_0035: nop
IL_0036: ldloc.0
IL_0037: ret
} // end of method ExceptionHandling::SimpleTryCatchException
.method public hidebysig instance bool
SimpleTryCatchExceptionWithName() cil managed
{
// Code size 67 (0x43)
.maxstack 2
.locals init (class [mscorlib]System.Exception V_0,
bool V_1)
IL_0000: nop
.try
{
IL_0001: nop
IL_0002: ldstr "Try"
IL_0007: call void [mscorlib]System.Console::WriteLine(string)
IL_000c: nop
IL_000d: ldarg.0
IL_000e: newobj instance void [mscorlib]System.Random::.ctor()
IL_0013: callvirt instance int32 [mscorlib]System.Random::Next()
IL_0018: callvirt instance bool ICSharpCode.Decompiler.Tests.TestCases.Pretty.ExceptionHandling::B(int32)
IL_001d: stloc.1
IL_001e: leave.s IL_0040
} // end .try
catch [mscorlib]System.Exception
{
IL_0020: stloc.0
IL_0021: nop
IL_0022: ldstr "CatchException ex: "
IL_0027: ldloc.0
IL_0028: callvirt instance string [mscorlib]System.Object::ToString()
IL_002d: call string [mscorlib]System.String::Concat(string,
string)
IL_0032: call void [mscorlib]System.Console::WriteLine(string)
IL_0037: nop
IL_0038: nop
IL_0039: leave.s IL_003b
} // end handler
IL_003b: nop
IL_003c: ldc.i4.0
IL_003d: stloc.1
IL_003e: br.s IL_0040
IL_0040: nop
IL_0041: ldloc.1
IL_0042: ret
} // end of method ExceptionHandling::SimpleTryCatchExceptionWithName
.method public hidebysig instance bool
SimpleTryFinally() cil managed
{
// Code size 37 (0x25)
.maxstack 1
.locals init (bool V_0)
IL_0000: nop
.try
{
IL_0001: nop
IL_0002: ldstr "Try"
IL_0007: call void [mscorlib]System.Console::WriteLine(string)
IL_000c: nop
IL_000d: nop
IL_000e: leave.s IL_001e
} // end .try
finally
{
IL_0010: nop
IL_0011: ldstr "Finally"
IL_0016: call void [mscorlib]System.Console::WriteLine(string)
IL_001b: nop
IL_001c: nop
IL_001d: endfinally
} // end handler
IL_001e: nop
IL_001f: ldc.i4.0
IL_0020: stloc.0
IL_0021: br.s IL_0023
IL_0023: ldloc.0
IL_0024: ret
} // end of method ExceptionHandling::SimpleTryFinally
.method family hidebysig specialname rtspecialname .method family hidebysig specialname rtspecialname
instance void .ctor() cil managed instance void .ctor() cil managed
{ {

101
ICSharpCode.Decompiler.Tests/TestCases/Pretty/ExceptionHandling.opt.il

@ -10,7 +10,7 @@
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4.. .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0 .ver 4:0:0:0
} }
.assembly '5yiid5o5' .assembly c32aalgo
{ {
.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.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 // ....T..WrapNonEx .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 // ....T..WrapNonEx
@ -20,15 +20,15 @@
.hash algorithm 0x00008004 .hash algorithm 0x00008004
.ver 0:0:0:0 .ver 0:0:0:0
} }
.module '5yiid5o5.dll' .module c32aalgo.dll
// MVID: {0663308F-828F-4074-8F95-7D8DB8535889} // MVID: {7AB7254E-121A-428F-A78B-253019D759D6}
.custom instance void [mscorlib]System.Security.UnverifiableCodeAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Security.UnverifiableCodeAttribute::.ctor() = ( 01 00 00 00 )
.imagebase 0x10000000 .imagebase 0x10000000
.file alignment 0x00000200 .file alignment 0x00000200
.stackreserve 0x00100000 .stackreserve 0x00100000
.subsystem 0x0003 // WINDOWS_CUI .subsystem 0x0003 // WINDOWS_CUI
.corflags 0x00000001 // ILONLY .corflags 0x00000001 // ILONLY
// Image base: 0x02EC0000 // Image base: 0x00850000
// =============== CLASS MEMBERS DECLARATION =================== // =============== CLASS MEMBERS DECLARATION ===================
@ -81,6 +81,99 @@
IL_001b: ret IL_001b: ret
} // end of method ExceptionHandling::ConditionalReturnInThrow } // end of method ExceptionHandling::ConditionalReturnInThrow
.method public hidebysig instance bool
SimpleTryCatchException() cil managed
{
// Code size 46 (0x2e)
.maxstack 2
.locals init (bool V_0)
.try
{
IL_0000: ldstr "Try"
IL_0005: call void [mscorlib]System.Console::WriteLine(string)
IL_000a: ldarg.0
IL_000b: newobj instance void [mscorlib]System.Random::.ctor()
IL_0010: callvirt instance int32 [mscorlib]System.Random::Next()
IL_0015: callvirt instance bool ICSharpCode.Decompiler.Tests.TestCases.Pretty.ExceptionHandling::B(int32)
IL_001a: stloc.0
IL_001b: leave.s IL_002c
} // end .try
catch [mscorlib]System.Exception
{
IL_001d: pop
IL_001e: ldstr "CatchException"
IL_0023: call void [mscorlib]System.Console::WriteLine(string)
IL_0028: leave.s IL_002a
} // end handler
IL_002a: ldc.i4.0
IL_002b: ret
IL_002c: ldloc.0
IL_002d: ret
} // end of method ExceptionHandling::SimpleTryCatchException
.method public hidebysig instance bool
SimpleTryCatchExceptionWithName() cil managed
{
// Code size 57 (0x39)
.maxstack 2
.locals init (class [mscorlib]System.Exception V_0,
bool V_1)
.try
{
IL_0000: ldstr "Try"
IL_0005: call void [mscorlib]System.Console::WriteLine(string)
IL_000a: ldarg.0
IL_000b: newobj instance void [mscorlib]System.Random::.ctor()
IL_0010: callvirt instance int32 [mscorlib]System.Random::Next()
IL_0015: callvirt instance bool ICSharpCode.Decompiler.Tests.TestCases.Pretty.ExceptionHandling::B(int32)
IL_001a: stloc.1
IL_001b: leave.s IL_0037
} // end .try
catch [mscorlib]System.Exception
{
IL_001d: stloc.0
IL_001e: ldstr "CatchException ex: "
IL_0023: ldloc.0
IL_0024: callvirt instance string [mscorlib]System.Object::ToString()
IL_0029: call string [mscorlib]System.String::Concat(string,
string)
IL_002e: call void [mscorlib]System.Console::WriteLine(string)
IL_0033: leave.s IL_0035
} // end handler
IL_0035: ldc.i4.0
IL_0036: ret
IL_0037: ldloc.1
IL_0038: ret
} // end of method ExceptionHandling::SimpleTryCatchExceptionWithName
.method public hidebysig instance bool
SimpleTryFinally() cil managed
{
// Code size 25 (0x19)
.maxstack 1
.try
{
IL_0000: ldstr "Try"
IL_0005: call void [mscorlib]System.Console::WriteLine(string)
IL_000a: leave.s IL_0017
} // end .try
finally
{
IL_000c: ldstr "Finally"
IL_0011: call void [mscorlib]System.Console::WriteLine(string)
IL_0016: endfinally
} // end handler
IL_0017: ldc.i4.0
IL_0018: ret
} // end of method ExceptionHandling::SimpleTryFinally
.method family hidebysig specialname rtspecialname .method family hidebysig specialname rtspecialname
instance void .ctor() cil managed instance void .ctor() cil managed
{ {

153
ICSharpCode.Decompiler.Tests/TestCases/Pretty/ExceptionHandling.opt.roslyn.il

@ -25,14 +25,14 @@
.ver 0:0:0:0 .ver 0:0:0:0
} }
.module ExceptionHandling.dll .module ExceptionHandling.dll
// MVID: {94F74EA5-9EAF-4F51-8FC3-7F9FB3A51DE4} // MVID: {6C5D3E57-C537-472A-8DB8-E97514ED3668}
.custom instance void [mscorlib]System.Security.UnverifiableCodeAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Security.UnverifiableCodeAttribute::.ctor() = ( 01 00 00 00 )
.imagebase 0x10000000 .imagebase 0x10000000
.file alignment 0x00000200 .file alignment 0x00000200
.stackreserve 0x00100000 .stackreserve 0x00100000
.subsystem 0x0003 // WINDOWS_CUI .subsystem 0x0003 // WINDOWS_CUI
.corflags 0x00000001 // ILONLY .corflags 0x00000001 // ILONLY
// Image base: 0x023F0000 // Image base: 0x004C0000
// =============== CLASS MEMBERS DECLARATION =================== // =============== CLASS MEMBERS DECLARATION ===================
@ -85,6 +85,155 @@
IL_001b: ret IL_001b: ret
} // end of method ExceptionHandling::ConditionalReturnInThrow } // end of method ExceptionHandling::ConditionalReturnInThrow
.method public hidebysig instance bool
SimpleTryCatchException() cil managed
{
// Code size 46 (0x2e)
.maxstack 2
.locals init (bool V_0)
.try
{
IL_0000: ldstr "Try"
IL_0005: call void [mscorlib]System.Console::WriteLine(string)
IL_000a: ldarg.0
IL_000b: newobj instance void [mscorlib]System.Random::.ctor()
IL_0010: callvirt instance int32 [mscorlib]System.Random::Next()
IL_0015: callvirt instance bool ICSharpCode.Decompiler.Tests.TestCases.Pretty.ExceptionHandling::B(int32)
IL_001a: stloc.0
IL_001b: leave.s IL_002c
} // end .try
catch [mscorlib]System.Exception
{
IL_001d: pop
IL_001e: ldstr "CatchException"
IL_0023: call void [mscorlib]System.Console::WriteLine(string)
IL_0028: leave.s IL_002a
} // end handler
IL_002a: ldc.i4.0
IL_002b: ret
IL_002c: ldloc.0
IL_002d: ret
} // end of method ExceptionHandling::SimpleTryCatchException
.method public hidebysig instance bool
SimpleTryCatchExceptionWithName() cil managed
{
// Code size 57 (0x39)
.maxstack 2
.locals init (bool V_0,
class [mscorlib]System.Exception V_1)
.try
{
IL_0000: ldstr "Try"
IL_0005: call void [mscorlib]System.Console::WriteLine(string)
IL_000a: ldarg.0
IL_000b: newobj instance void [mscorlib]System.Random::.ctor()
IL_0010: callvirt instance int32 [mscorlib]System.Random::Next()
IL_0015: callvirt instance bool ICSharpCode.Decompiler.Tests.TestCases.Pretty.ExceptionHandling::B(int32)
IL_001a: stloc.0
IL_001b: leave.s IL_0037
} // end .try
catch [mscorlib]System.Exception
{
IL_001d: stloc.1
IL_001e: ldstr "CatchException ex: "
IL_0023: ldloc.1
IL_0024: callvirt instance string [mscorlib]System.Object::ToString()
IL_0029: call string [mscorlib]System.String::Concat(string,
string)
IL_002e: call void [mscorlib]System.Console::WriteLine(string)
IL_0033: leave.s IL_0035
} // end handler
IL_0035: ldc.i4.0
IL_0036: ret
IL_0037: ldloc.0
IL_0038: ret
} // end of method ExceptionHandling::SimpleTryCatchExceptionWithName
.method public hidebysig instance bool
SimpleTryCatchExceptionWithNameAndCondition() cil managed
{
// Code size 91 (0x5b)
.maxstack 2
.locals init (bool V_0,
class [mscorlib]System.Exception V_1)
.try
{
IL_0000: ldstr "Try"
IL_0005: call void [mscorlib]System.Console::WriteLine(string)
IL_000a: ldarg.0
IL_000b: newobj instance void [mscorlib]System.Random::.ctor()
IL_0010: callvirt instance int32 [mscorlib]System.Random::Next()
IL_0015: callvirt instance bool ICSharpCode.Decompiler.Tests.TestCases.Pretty.ExceptionHandling::B(int32)
IL_001a: stloc.0
IL_001b: leave.s IL_0059
} // end .try
filter
{
IL_001d: isinst [mscorlib]System.Exception
IL_0022: dup
IL_0023: brtrue.s IL_0029
IL_0025: pop
IL_0026: ldc.i4.0
IL_0027: br.s IL_003d
IL_0029: stloc.1
IL_002a: ldloc.1
IL_002b: callvirt instance string [mscorlib]System.Exception::get_Message()
IL_0030: ldstr "test"
IL_0035: callvirt instance bool [mscorlib]System.String::Contains(string)
IL_003a: ldc.i4.0
IL_003b: cgt.un
IL_003d: endfilter
} // end filter
{ // handler
IL_003f: pop
IL_0040: ldstr "CatchException ex: "
IL_0045: ldloc.1
IL_0046: callvirt instance string [mscorlib]System.Object::ToString()
IL_004b: call string [mscorlib]System.String::Concat(string,
string)
IL_0050: call void [mscorlib]System.Console::WriteLine(string)
IL_0055: leave.s IL_0057
} // end handler
IL_0057: ldc.i4.0
IL_0058: ret
IL_0059: ldloc.0
IL_005a: ret
} // end of method ExceptionHandling::SimpleTryCatchExceptionWithNameAndCondition
.method public hidebysig instance bool
SimpleTryFinally() cil managed
{
// Code size 25 (0x19)
.maxstack 1
.try
{
IL_0000: ldstr "Try"
IL_0005: call void [mscorlib]System.Console::WriteLine(string)
IL_000a: leave.s IL_0017
} // end .try
finally
{
IL_000c: ldstr "Finally"
IL_0011: call void [mscorlib]System.Console::WriteLine(string)
IL_0016: endfinally
} // end handler
IL_0017: ldc.i4.0
IL_0018: ret
} // end of method ExceptionHandling::SimpleTryFinally
.method family hidebysig specialname rtspecialname .method family hidebysig specialname rtspecialname
instance void .ctor() cil managed instance void .ctor() cil managed
{ {

189
ICSharpCode.Decompiler.Tests/TestCases/Pretty/ExceptionHandling.roslyn.il

@ -25,14 +25,14 @@
.ver 0:0:0:0 .ver 0:0:0:0
} }
.module ExceptionHandling.dll .module ExceptionHandling.dll
// MVID: {BD40B406-5ECB-4E3A-BB48-79827F1BFB21} // MVID: {132EAF1E-6B6D-4E21-B000-D06E1A4188E3}
.custom instance void [mscorlib]System.Security.UnverifiableCodeAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Security.UnverifiableCodeAttribute::.ctor() = ( 01 00 00 00 )
.imagebase 0x10000000 .imagebase 0x10000000
.file alignment 0x00000200 .file alignment 0x00000200
.stackreserve 0x00100000 .stackreserve 0x00100000
.subsystem 0x0003 // WINDOWS_CUI .subsystem 0x0003 // WINDOWS_CUI
.corflags 0x00000001 // ILONLY .corflags 0x00000001 // ILONLY
// Image base: 0x02A10000 // Image base: 0x03070000
// =============== CLASS MEMBERS DECLARATION =================== // =============== CLASS MEMBERS DECLARATION ===================
@ -95,6 +95,191 @@
IL_0025: ret IL_0025: ret
} // end of method ExceptionHandling::ConditionalReturnInThrow } // end of method ExceptionHandling::ConditionalReturnInThrow
.method public hidebysig instance bool
SimpleTryCatchException() cil managed
{
// Code size 54 (0x36)
.maxstack 2
.locals init (bool V_0)
IL_0000: nop
.try
{
IL_0001: nop
IL_0002: ldstr "Try"
IL_0007: call void [mscorlib]System.Console::WriteLine(string)
IL_000c: nop
IL_000d: ldarg.0
IL_000e: newobj instance void [mscorlib]System.Random::.ctor()
IL_0013: callvirt instance int32 [mscorlib]System.Random::Next()
IL_0018: callvirt instance bool ICSharpCode.Decompiler.Tests.TestCases.Pretty.ExceptionHandling::B(int32)
IL_001d: stloc.0
IL_001e: leave.s IL_0034
} // end .try
catch [mscorlib]System.Exception
{
IL_0020: pop
IL_0021: nop
IL_0022: ldstr "CatchException"
IL_0027: call void [mscorlib]System.Console::WriteLine(string)
IL_002c: nop
IL_002d: nop
IL_002e: leave.s IL_0030
} // end handler
IL_0030: ldc.i4.0
IL_0031: stloc.0
IL_0032: br.s IL_0034
IL_0034: ldloc.0
IL_0035: ret
} // end of method ExceptionHandling::SimpleTryCatchException
.method public hidebysig instance bool
SimpleTryCatchExceptionWithName() cil managed
{
// Code size 65 (0x41)
.maxstack 2
.locals init (bool V_0,
class [mscorlib]System.Exception V_1)
IL_0000: nop
.try
{
IL_0001: nop
IL_0002: ldstr "Try"
IL_0007: call void [mscorlib]System.Console::WriteLine(string)
IL_000c: nop
IL_000d: ldarg.0
IL_000e: newobj instance void [mscorlib]System.Random::.ctor()
IL_0013: callvirt instance int32 [mscorlib]System.Random::Next()
IL_0018: callvirt instance bool ICSharpCode.Decompiler.Tests.TestCases.Pretty.ExceptionHandling::B(int32)
IL_001d: stloc.0
IL_001e: leave.s IL_003f
} // end .try
catch [mscorlib]System.Exception
{
IL_0020: stloc.1
IL_0021: nop
IL_0022: ldstr "CatchException ex: "
IL_0027: ldloc.1
IL_0028: callvirt instance string [mscorlib]System.Object::ToString()
IL_002d: call string [mscorlib]System.String::Concat(string,
string)
IL_0032: call void [mscorlib]System.Console::WriteLine(string)
IL_0037: nop
IL_0038: nop
IL_0039: leave.s IL_003b
} // end handler
IL_003b: ldc.i4.0
IL_003c: stloc.0
IL_003d: br.s IL_003f
IL_003f: ldloc.0
IL_0040: ret
} // end of method ExceptionHandling::SimpleTryCatchExceptionWithName
.method public hidebysig instance bool
SimpleTryCatchExceptionWithNameAndCondition() cil managed
{
// Code size 101 (0x65)
.maxstack 2
.locals init (bool V_0,
class [mscorlib]System.Exception V_1,
bool V_2)
IL_0000: nop
.try
{
IL_0001: nop
IL_0002: ldstr "Try"
IL_0007: call void [mscorlib]System.Console::WriteLine(string)
IL_000c: nop
IL_000d: ldarg.0
IL_000e: newobj instance void [mscorlib]System.Random::.ctor()
IL_0013: callvirt instance int32 [mscorlib]System.Random::Next()
IL_0018: callvirt instance bool ICSharpCode.Decompiler.Tests.TestCases.Pretty.ExceptionHandling::B(int32)
IL_001d: stloc.0
IL_001e: leave.s IL_0063
} // end .try
filter
{
IL_0020: isinst [mscorlib]System.Exception
IL_0025: dup
IL_0026: brtrue.s IL_002c
IL_0028: pop
IL_0029: ldc.i4.0
IL_002a: br.s IL_0042
IL_002c: stloc.1
IL_002d: ldloc.1
IL_002e: callvirt instance string [mscorlib]System.Exception::get_Message()
IL_0033: ldstr "test"
IL_0038: callvirt instance bool [mscorlib]System.String::Contains(string)
IL_003d: stloc.2
IL_003e: ldloc.2
IL_003f: ldc.i4.0
IL_0040: cgt.un
IL_0042: endfilter
} // end filter
{ // handler
IL_0044: pop
IL_0045: nop
IL_0046: ldstr "CatchException ex: "
IL_004b: ldloc.1
IL_004c: callvirt instance string [mscorlib]System.Object::ToString()
IL_0051: call string [mscorlib]System.String::Concat(string,
string)
IL_0056: call void [mscorlib]System.Console::WriteLine(string)
IL_005b: nop
IL_005c: nop
IL_005d: leave.s IL_005f
} // end handler
IL_005f: ldc.i4.0
IL_0060: stloc.0
IL_0061: br.s IL_0063
IL_0063: ldloc.0
IL_0064: ret
} // end of method ExceptionHandling::SimpleTryCatchExceptionWithNameAndCondition
.method public hidebysig instance bool
SimpleTryFinally() cil managed
{
// Code size 36 (0x24)
.maxstack 1
.locals init (bool V_0)
IL_0000: nop
.try
{
IL_0001: nop
IL_0002: ldstr "Try"
IL_0007: call void [mscorlib]System.Console::WriteLine(string)
IL_000c: nop
IL_000d: nop
IL_000e: leave.s IL_001e
} // end .try
finally
{
IL_0010: nop
IL_0011: ldstr "Finally"
IL_0016: call void [mscorlib]System.Console::WriteLine(string)
IL_001b: nop
IL_001c: nop
IL_001d: endfinally
} // end handler
IL_001e: ldc.i4.0
IL_001f: stloc.0
IL_0020: br.s IL_0022
IL_0022: ldloc.0
IL_0023: ret
} // end of method ExceptionHandling::SimpleTryFinally
.method family hidebysig specialname rtspecialname .method family hidebysig specialname rtspecialname
instance void .ctor() cil managed instance void .ctor() cil managed
{ {

Loading…
Cancel
Save