Roger wrote:
Hi,
Is it possible to target an interface instead of a specific type when
writing a debugger visualizer?
No. Only classes.
I cant get it to work , everything works fine if i target a class ,
but if i target an interface i cant use the visualizer on types that
implement the interface..
Im trying to create a visualizer for runtime emitted types so I cant
specify in advace what types to target.
another problem seems to be if you would apply the visualizer attrib
onto my emitted types, the emitted types would get a dependency to
the microsoft.visualstudio.* dll
Is there anyway to apply a visualizer to emitted types that does not
share a basetype ?
Add the visualizers to a separate assembly and in that assembly add
attributes like:
[assembly: DebuggerVisualizer(
typeof( SD.LLBLGen.Pro.DebugVisualizers.EntityCollectionVi sualizer ),
typeof( VisualizerObjectSource ),
Target = typeof(
SD.LLBLGen.Pro.ORMSupportClasses.EntityCollectionB ase<> ),
Description = "Entity Collection Visualizer" )]
I use a class for the actual visualizer (which derives from
DialogDebuggerVisualizer) and a form class which is the actual
visualizer (form). The assembly attribute has to be placed outside a
namespace declaration so for example below the using statements.
In the example above I also illustrate how you can apply a debugger
visualizer on a generic type. This only works if you specify it as an
'open type', as I showed above.
Your visualizer assembly has references to vs.net assemblies and the
assemblies which contain the types visualized with the visualizers.
This way you can create whatever visualizers you want without having
the visualizer code inside your actual assembly
Be sure the debugger visualizer assembly is placed in one of the two
folders supported for this, see the debugger visualizer documentation
in the vs.net documentation for details on that. THis also goes for the
assemblies REFERENCED by the debugger visualizer, as VS.NET will load
these assemblies on its own, so fusion has to be able to load them on
its own.
Frans
--
------------------------------------------------------------------------
Get LLBLGen Pro, productive O/R mapping for .NET:
http://www.llblgen.com
My .NET blog:
http://weblogs.asp.net/fbouma
Microsoft MVP (C#)
------------------------------------------------------------------------