Note that there are some explanatory texts on larger screens.

plurals
  1. POITypeResolutionService not resolving any types
    text
    copied!<p>I'm working on a visual studio 2008 add-in that will generate data-access code by looking at the method signature combined with a set of options the user enters in a dialog. </p> <p>For analyzing the method signature I use the ITypeResolutionService of visual studio to lookup a type that either exists in the current project, in the referenced projects or in the referenced assemblies.</p> <p>For this I created the following functionality:</p> <pre><code>private ITypeResolutionService _typeResolutionService; private ITypeDiscoveryService _typeDiscoveryService; /// &lt;summary&gt; /// Initializes a new instance of the TypeResolver class. /// &lt;/summary&gt; public TypeResolver(VisualStudioServiceProvider serviceProvider, Project project) { IVsSolution solution = serviceProvider.GetService&lt;IVsSolution&gt;(); DynamicTypeService typeResolver = serviceProvider.GetService&lt;DynamicTypeService&gt;(); IVsHierarchy hierarchy = null; solution.GetProjectOfUniqueName(project.UniqueName, out hierarchy); _typeResolutionService = typeResolver.GetTypeResolutionService(hierarchy); _typeDiscoveryService = typeResolver.GetTypeDiscoveryService(hierarchy); } /// &lt;summary&gt; /// Resolves a type in the current solution /// &lt;/summary&gt; /// &lt;param name="name"&gt;Name of the type to resolve&lt;/param&gt; /// &lt;returns&gt;Returns the resolved type; otherwise null&lt;/returns&gt; public Type Resolve(string name) { return _typeResolutionService.GetType(name, true); } </code></pre> <p>It does resolve non-generic types, but sadly doesn't work on generic types. Does anybody have an idea on how to get the above snippet working for generic types too?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload