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 8976527
In Process

The Archive Base Latest Questions

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

I am creating a workspace in memory for unit testing purposes, but I cannot

  • 0

I am creating a workspace in memory for unit testing purposes, but I cannot access the symbol info of a certain InvocationExpression (which is required for the CodeIssue I am testing). Here is a simplified example of a test that fails. Please help?

        var solution =
            Solution.Create(SolutionId.CreateNewId())
                    .AddCSharpProject(Title, Title, out projectId)
                    .AddMetadataReference(projectId, MetadataReference.CreateAssemblyReference("mscorlib"))
                    .AddMetadataReference(projectId, MetadataReference.CreateAssemblyReference("Microsoft.CSharp"))
                    .AddMetadataReference(projectId, MetadataReference.CreateAssemblyReference("System"))
                    .AddMetadataReference(projectId, MetadataReference.CreateAssemblyReference("System.Core"))
                    .AddMetadataReference(projectId, MetadataReference.CreateAssemblyReference("System.Web"))
                    .AddDocument(projectId, "MyFile.cs",
                        @"using System.Web;
                        public partial class _Default : Page
                        {
                            protected void Page_Load(object sender, EventArgs e, string s)
                            {
                                Response.Write(""hello"");
                            }
                        }"
                    , out documentId);



        var mydocument = solution.GetDocument(documentId);
        var tree = mydocument.GetSyntaxTree();
        var model = mydocument.GetSemanticModel();
        var responseWriteLine = tree.GetRoot().DescendantNodesAndSelf().First(x => x.GetLocation().GetLineSpan(false).StartLinePosition.Line == 5 && x is InvocationExpressionSyntax);

        Assert.IsNotNull(model.GetSymbolInfo(responseWriteLine.Expression).Symbol);
  • 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:09:58+00:00Added an answer on June 15, 2026 at 7:09 pm

    I added some usings to the code snippet which were missing.

     var solution =
                Solution.Create(SolutionId.CreateNewId())
                        .AddCSharpProject(Title, Title, out projectId)
                        .AddMetadataReference(projectId, MetadataReference.CreateAssemblyReference("mscorlib"))
                        .AddMetadataReference(projectId, MetadataReference.CreateAssemblyReference("Microsoft.CSharp"))
                        .AddMetadataReference(projectId, MetadataReference.CreateAssemblyReference("System"))
                        .AddMetadataReference(projectId, MetadataReference.CreateAssemblyReference("System.Core"))
                        .AddMetadataReference(projectId, MetadataReference.CreateAssemblyReference("System.Web"))
                        .AddDocument(projectId, "MyFile.cs",
                            @"using System;
                            using System.Web;
                            using System.Web.UI;
    
                            public partial class _Default : Page
                            {
                                protected void Page_Load(object sender, EventArgs e, string s)
                                {
                                    Response.Write(""hello"");
                                }
                            }"
                        , out documentId);
    
    
    
                var mydocument = solution.GetDocument(documentId);
                var tree = mydocument.GetSyntaxTree();
                SemanticModel model = (SemanticModel)mydocument.GetSemanticModel();
    
                var responseWriteLine = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First();
                Assert.IsNotNull(model.GetSymbolInfo(responseWriteLine.Expression).Symbol);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am creating a class in which I want to generate a temporary workspace
I tried creating a test project with maven and the unit testing worked fine.
I am creating an application using WPF which is using Prism framework. I have
I want to connect two projects. I have no idea about creating workspace and
I am using eclipse CDT for creating the projects. I am creating a workspace
I am creating a project with eclipse, but am unfamiliar with their folder structure.
I'm creating an application with Java and SWT, and have a workspace generated on
I copied the ApiDemos sample to my workspace, then tried creating a new project
Im having trouble creating a workspace and downloading the files from a Team Foundation
Creating tests with rspec works fine, but if I want to execute those tests,

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.