DebuggerVisualizers

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
Is it possible to target an interface instead of a specific type when
writing a debugger visualizer?

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 ?

//Roger
 
Ive managed to emit classes with the DebugVisualizer attribute on using a
type name string for the visualizer,

however i get filenot found:

See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.IO.FileNotFoundException: Could not load file or assembly
'Puzzle.NAspect.Debug.NET2, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=a8e5914f83beaab3' or one of its dependencies. can not find file
File name: 'Puzzle.NAspect.Debug.NET2, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=a8e5914f83beaab3'
at System.Reflection.Assembly.nLoad(AssemblyName fileName, String
codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark&
stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef,
Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean
forIntrospection)


Ive read the "installing visualizers" in msdn and tried to put the
visualizer assembly in both the my documents and in the visualstudio
visualizers folder , but I still get the same error.

does the assembly have to be installed in the gac?
 
Roger said:
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.EntityCollectionVisualizer ),
typeof( VisualizerObjectSource ),
Target = typeof(
SD.LLBLGen.Pro.ORMSupportClasses.EntityCollectionBase<> ),
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

--
 
The problem in my case is that the targets are runtime emitted and does not
share a baseclass so I have to decorate them with the debuggervisualizer
attrib.

It turns out that when using fully qualified names vs.net does NOT!! probe
the visualizer folders thus cannot find the assembly.

however, if I put the visualizer into the vs.net/IDE folder the assembly can
be loaded.

BUT, only if I use the "DebuggerVisualizer(string)" ctor,
If I use the "DebuggerVisualizer(string,string)" ctor it wont look in the
IDE folder either and you get file not found there to.

so it seems very much like the debuggervisualzier api is bugged when it
comes to qualified names instead of using types.

//Roger
 
Roger said:
The problem in my case is that the targets are runtime emitted and
does not share a baseclass so I have to decorate them with the
debuggervisualizer attrib.

It turns out that when using fully qualified names vs.net does NOT!!
probe the visualizer folders thus cannot find the assembly.

however, if I put the visualizer into the vs.net/IDE folder the
assembly can be loaded.

BUT, only if I use the "DebuggerVisualizer(string)" ctor,
If I use the "DebuggerVisualizer(string,string)" ctor it wont look
in the IDE folder either and you get file not found there to.

so it seems very much like the debuggervisualzier api is bugged when
it comes to qualified names instead of using types.

aha, this might be the reason why it didn't work when I added the
attributes to the types with strings (and fully qualifified names). I
still couldn't get it work with interfaces though.

Sees we need debugger visualizers for the debugger visualizers api
code ;)

FB

--
 
Back
Top