Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8976925
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T19:15:26+00:00 2026-06-15T19:15:26+00:00

I am using Roslyn’s September 2012 CTP. What is the most elegant way to

  • 0

I am using Roslyn’s September 2012 CTP.

What is the most elegant way to get unresolved types in a c# code document? Eg. Type Guid requires the System namespace. Currently I have something like this:

            var semanticModel = (SemanticModel)document.GetSemanticModel();
            var tree = (SyntaxTree)document.GetSyntaxTree();

            //get unresolved types
            var unresolvedTypes = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>()
                .Where(x => semanticModel.GetSymbolInfo(x).Symbol == null);

Is it correct to use IdentifierNameSyntax and GetSymbolInfo?

Also what is the difference between GetSymbolInfo and GetTypeInfo, they both look very similar to me.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T19:15:27+00:00Added an answer on June 15, 2026 at 7:15 pm

    There are several questions here.

    Q: Is it correct to use IdentifierNameSyntax?
    A: You probably want to use SimpleNameSyntax to handle resolving generic types. Also, you may not want to look at ALL SimpleNameSyntax elements. You will get false positives for things that are not actually in a type context (for example, imagine some code like var x = Console();

    Q: Is it correct to use GetSymbolInfo and check for null?
    A: Yes, this is the right thing to check here.

    Q: What is the difference between GetSymbolInfo and GetTypeInfo?
    A: For a syntax that represents a type name, there is no difference. However, for arbitrary expressions GetSymbolInfo represents the specific symbol of the expression (for example, method call, indexer access, array access, overloaded operator, etc), and GetTypeInfo represents the resulting type (so that you would know what type to generate if you were adding a declaration for the expression). Take for example the InvocationExpressionSyntax for “myString.GetHashCode()“. GetSymbolInfo would return the method symbol for GetHashCode(), while GetTypeInfo would return System.Int32.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using Roslyn's Workspaces, is there any way to acquire a hook into the active
I want to use Roslyn to get all types used in a piece of
I'm writing an application using Roslyn to syntactically and semantically analyse C# source code.
Is it possible to modify source code before compilation using Roslyn within MSBuild task
Using Microsoft Roslyn I am trying to determine if a methods return type is
I am using the Roslyn CTP and I am trying to determine if the
Using a populated Table Type as the source for a TSQL-Merge. I want to
Using SQL Server 2008 R2 we are looking for a way to select the
Using the Redis info command, I am able to get all the stats of
Using Location.getBearing(); I seem to get randomly changing bearings. Aka, I can turn the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.