1

I have written one custom visualizer for visual studio, which works on class (user defined) and collection (generics).

But its now showing in application. i have put the dlls on proper place and thats not a issue...

the issue is its Type defining.

I have put below attribute on visualizer class.

[assembly: System.Diagnostics.DebuggerVisualizer(
typeof(ObjectToI.WriteICodeFromObject),
typeof(VisualizerObjectSource),
Target = typeof(System.Object),**here i am not sure what to put as my visualizer will work for both user defined classes and generics collections.**
Description = "Object To I Code Visualizer")]

please suggest what should i put in target type as my visualizer will work for user defined classes and lists/IEnumerable.

I have tried System.Object but that is not working

I have tried System.Collections.Generic.IList but that also not working, even not on List..

please suggest...

Dr. Rajesh Rolen
  • 14,029
  • 41
  • 106
  • 178
  • Why do you think the target is the problem? If you use `System.Object` you should be able to open the visualizer for any object. – Adi Lester May 25 '13 at 20:00
  • @AdiLester: Because its not working with that..looks like its not supporting it http://stackoverflow.com/questions/6506819/debugger-visualizer-for-any-icollection-and-icollectiont-types – Dr. Rajesh Rolen May 26 '13 at 04:27
  • If I remember correctly, you cannot set Object to be your Visualizer target. You need to be more specific than that. The following visualizer works on lists, you can probably find what you need here: http://www.codeproject.com/Articles/25268/A-Generic-List-and-Dictionary-Debugger-Visualizer – jessehouwing May 26 '13 at 15:46

1 Answers1

2

You cannot specify the target type as Target = typeof(System.Object) in your code. Since an object of type 'Object' and 'Array' cannot be visualized.

From MSDN : You can write a custom visualizer for an object of any managed class except for Object or Array. Link : [http://msdn.microsoft.com/en-us/library/e2zc529c.aspx ][1]

For lists/IEnumerable :

Specify the target as Target = typeof(List<>) or Target = typeof(ObservableCollection<>)

For UserDefined Class :

Specify the target as Target = typeof(MyClass)

or

replace the Target with TargetTypeName = "MyNamespace.MyClass, MyNamespace"

This will work.

Murugan
  • 1,441
  • 1
  • 12
  • 22