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)]
39 public sealed class DebuggerVisualizerAttribute : Attribute
41 internal sealed class DebuggerVisualizerAttribute : Attribute
44 private string description;
45 private string visualizerSourceName;
46 private string visualizerName;
47 private string targetTypeName;
50 public DebuggerVisualizerAttribute (string visualizerTypeName)
52 this.visualizerName = visualizerTypeName;
55 public DebuggerVisualizerAttribute (Type visualizer)
57 if (visualizer == null)
58 throw new ArgumentNullException ("visualizer");
60 this.visualizerName = visualizer.AssemblyQualifiedName;
63 public DebuggerVisualizerAttribute (string visualizerTypeName, string visualizerObjectSourceTypeName)
65 this.visualizerName = visualizerTypeName;
66 this.visualizerSourceName = visualizerObjectSourceTypeName;
69 public DebuggerVisualizerAttribute (string visualizerTypeName, Type visualizerObjectSource)
71 if (visualizerObjectSource == null)
72 throw new ArgumentNullException ("visualizerObjectSource");
74 this.visualizerName = visualizerTypeName;
75 this.visualizerSourceName = visualizerObjectSource.AssemblyQualifiedName;
78 public DebuggerVisualizerAttribute (Type visualizer, string visualizerObjectSourceTypeName)
80 if (visualizer == null)
81 throw new ArgumentNullException ("visualizer");
83 this.visualizerName = visualizer.AssemblyQualifiedName;
84 this.visualizerSourceName = visualizerObjectSourceTypeName;
87 public DebuggerVisualizerAttribute (Type visualizer, Type visualizerObjectSource)
89 if (visualizer == null)
90 throw new ArgumentNullException ("visualizer");
91 if (visualizerObjectSource == null)
92 throw new ArgumentNullException ("visualizerObjectSource");
94 this.visualizerName = visualizer.AssemblyQualifiedName;
95 this.visualizerSourceName = visualizerObjectSource.AssemblyQualifiedName;
98 public string Description {
113 targetTypeName = target.AssemblyQualifiedName;
117 public string TargetTypeName {
119 return targetTypeName;
122 targetTypeName = value;
126 // Debugged program-side type
127 public string VisualizerObjectSourceTypeName {
129 return visualizerSourceName;
133 // Debugger-side type
134 public string VisualizerTypeName {
136 return visualizerName;