[System.ServiceModel] Prevent crash in Dispatcher.ListenerLoopManager… (#7136)
[mono-project.git] / mono / tests / bug-60848.cs
blob7f1183ad4e7a345981067f4b090214bf73a0013b
1 using System;
2 using System.Text;
4 [Obsolete("test")]
5 public static class Program
7 public const string UnicodeLowSurrogate = "l\uDC00";
8 public const string UnicodeHighSurrogate = "h\uD800";
9 public const string UnicodeReplacementCharacter = "\uFFFD";
11 public static int Main ()
13 int exitCode = 0;
15 var tuples = new [] {
16 ( typeof (Program), "0074 0065 0073 0074" ),
17 ( typeof (A), "0068 FFFD FFFD" ),
18 ( typeof (B), "006C FFFD FFFD" ),
19 ( typeof (C), "006C FFFD FFFD 0068 FFFD FFFD" ),
20 ( typeof (D), "0068 FFFD FFFD 006C FFFD FFFD" )
23 foreach (var tup in tuples) {
24 var type = tup.Item1;
25 var a = ((ObsoleteAttribute)type.GetCustomAttributes(true)[0]);
26 var m = a.Message;
28 var sb = new StringBuilder();
30 if (m != null) {
31 foreach (var ch in m)
32 sb.AppendFormat("{0:X4} ", (uint)ch);
33 } else {
34 sb.Append("null");
37 var expected = tup.Item2;
38 var actual = sb.ToString().Trim();
39 if (actual != expected) {
40 Console.WriteLine("Attribute on type {0} failed to decode:", type);
41 Console.WriteLine(" expected '{0}' but got '{1}'", expected, actual);
42 exitCode += 1;
43 } else {
44 Console.WriteLine("{0} {1}", type, actual);
48 return exitCode;
52 [Obsolete(Program.UnicodeHighSurrogate)]
53 public class A {
56 [Obsolete(Program.UnicodeLowSurrogate)]
57 public class B {
60 [Obsolete(Program.UnicodeLowSurrogate + Program.UnicodeHighSurrogate)]
61 public class C {
64 [Obsolete(Program.UnicodeHighSurrogate + Program.UnicodeLowSurrogate)]
65 public class D {