CodeTypeRef in invalid state - by schuchri

Status : 


Sign in
to vote
ID 790287 Comments
Status Active Workarounds
Type Bug Repros 1
Opened 6/17/2013 12:29:22 AM
Access Restriction Public


Sometimes when looking at CodeTypeRefs the CodeModel seems to be in an invalid state.

The CodeTypeRef.AsFullName property doesn't return the fully-qualified name (ie. "Namespace.Class") but only the class name (ie. "Class").

The problem with this is that this is expected behavior for CodeTypeRefs that are generic type/method parameters (ie. "T"). 

The real problem lies in the fact that there is no way to distinguish between a CodeTypeRef that represents a generic parameter (=> expected behavior) or a CodeTypeRef that represents an actual type and just doesn't return the fully-qualified name (=> error).

In the debugger a property called "IsGeneric" is visible on the CodeTypeRef instance, however this property always seems to be false.
Sign in to post a comment.
Posted by schuchri on 7/11/2013 at 11:10 AM

I'm sorry it took so long (vacation...).

The attached solution is a good way to show this error. It is a VisualStudio extension that outputs something whenever it finds a CodeTypeRef with a not fully qualified type name with a length > 2 (to avoid output for every generic parameter like T).

However the real problem lies in the fact that the error seems to only occur in large solutions. Maybe the error comes from the fact that VS hasn't parsed all the necessary source files (--> the ones with types that are referenced) in all the projects yet and therefore can't provide accurate information for some types. This theory would also explain why the error hardly ever occurs on files that are re-opened automatically on solution load (the code model has more than enough time to build itself up between the opening of the file while all the other projects are loaded).

So I sadly can't supply you with a solution that reliably reproduces the error when it is opened with the supplied VSExtension. Maybe you can use a big Microsoft internal solution for that purpose.

Another important point is: Even with big projects the error does not occur always, so several tests should be made.
Posted by Microsoft on 7/11/2013 at 9:42 AM

I'm closing this issue as a few weeks have passed with no additional information.

Kind Regards,
Dustin Campbell
Visual Studio Managed Languages
Posted by Microsoft on 6/21/2013 at 9:38 AM

Thanks for contacting us about this issue. Unfortunately, we have been unable to reproduce the problem. Would you be able to provide a sample extension project that reproduces the problem? That would help greatly in our investigation.

Kind Regards,
Dustin Campbell
Visual Studio Managed Languages
Posted by Microsoft on 6/17/2013 at 2:05 AM
Thanks for your feedback.

We are rerouting this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.
Posted by Microsoft on 6/17/2013 at 12:50 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(