2 // System.Diagnostics.DebuggerVisualizerAttribute.cs
5 // Chris Toshok (toshok@novell.com)
9 // Copyright (C) 2005 Novell, Inc (http://www.novell.com)
11 // Permission is hereby granted, free of charge, to any person obtaining
12 // a copy of this software and associated documentation files (the
13 // "Software"), to deal in the Software without restriction, including
14 // without limitation the rights to use, copy, modify, merge, publish,
15 // distribute, sublicense, and/or sell copies of the Software, and to
16 // permit persons to whom the Software is furnished to do so, subject to
17 // the following conditions:
19 // The above copyright notice and this permission notice shall be
20 // included in all copies or substantial portions of the Software.
22 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
26 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
27 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
32 using System.Runtime.InteropServices;
34 namespace System.Diagnostics
36 [AttributeUsageAttribute(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Assembly, AllowMultiple=true)]
38 public sealed class DebuggerVisualizerAttribute : Attribute
40 private string description;
41 private string visualizerSourceName;
42 private string visualizerName;
43 private string targetTypeName;
46 public DebuggerVisualizerAttribute (string visualizerTypeName)
48 this.visualizerName = visualizerTypeName;
51 public DebuggerVisualizerAttribute (Type visualizer)
53 if (visualizer == null)
54 throw new ArgumentNullException ("visualizer");
56 this.visualizerName = visualizer.AssemblyQualifiedName;
59 public DebuggerVisualizerAttribute (string visualizerTypeName, string visualizerObjectSourceTypeName)
61 this.visualizerName = visualizerTypeName;
62 this.visualizerSourceName = visualizerObjectSourceTypeName;
65 public DebuggerVisualizerAttribute (string visualizerTypeName, Type visualizerObjectSource)
67 if (visualizerObjectSource == null)
68 throw new ArgumentNullException ("visualizerObjectSource");
70 this.visualizerName = visualizerTypeName;
71 this.visualizerSourceName = visualizerObjectSource.AssemblyQualifiedName;
74 public DebuggerVisualizerAttribute (Type visualizer, string visualizerObjectSourceTypeName)
76 if (visualizer == null)
77 throw new ArgumentNullException ("visualizer");
79 this.visualizerName = visualizer.AssemblyQualifiedName;
80 this.visualizerSourceName = visualizerObjectSourceTypeName;
83 public DebuggerVisualizerAttribute (Type visualizer, Type visualizerObjectSource)
85 if (visualizer == null)
86 throw new ArgumentNullException ("visualizer");
87 if (visualizerObjectSource == null)
88 throw new ArgumentNullException ("visualizerObjectSource");
90 this.visualizerName = visualizer.AssemblyQualifiedName;
91 this.visualizerSourceName = visualizerObjectSource.AssemblyQualifiedName;
94 public string Description {
109 targetTypeName = target.AssemblyQualifiedName;
113 public string TargetTypeName {
115 return targetTypeName;
118 targetTypeName = value;
122 // Debugged program-side type
123 public string VisualizerObjectSourceTypeName {
125 return visualizerSourceName;
129 // Debugger-side type
130 public string VisualizerTypeName {
132 return visualizerName;