2 using System
.Collections
.Generic
;
7 public long a1
, a2
, a3
, a4
;
11 public A1 a1
, a2
, a3
, a4
;
15 public A2 a1
, a2
, a3
, a4
;
19 public A3 a1
, a2
, a3
, a4
;
23 public A4 a1
, a2
, a3
, a4
;
26 public static int foo () {
29 /* Prevent a5 from being optimized away */
31 a5
.a1
.a1
.a1
.a1
.a1
= 5;
36 // call an icall so we have a big chance to hit the
37 // stack overflow in unmanaged code
38 static void Recurse () {
39 Type t
= typeof (Dictionary
<,>);
40 t
.GetGenericArguments ();
44 public static int Main () {
45 // Try overflow in managed code
50 catch (StackOverflowException
) {
51 Console
.WriteLine ("Stack overflow caught.");
57 // Try overflow in unmanaged code
61 } catch (Exception ex
) {
62 Console
.WriteLine ("Handled: {0}", ex
.Message
);
65 // Check that the stack protection is properly restored
68 } catch (Exception ex
) {
69 Console
.WriteLine ("Again: {0}", ex
.Message
);