Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make CompilationOptions.MetadataImportOptions public. #24468

Merged
merged 2 commits into from
Jan 26, 2018

Conversation

AlekseyTs
Copy link
Contributor

Fixes #6748.

@AlekseyTs AlekseyTs requested a review from a team as a code owner January 26, 2018 05:50
@AlekseyTs AlekseyTs added Concept-API This issue involves adding, removing, clarification, or modification of an API. Area-Compilers labels Jan 26, 2018
@AlekseyTs
Copy link
Contributor Author

@dotnet/roslyn-compiler Please review

@AlekseyTs
Copy link
Contributor Author

CC @jaredpar, @gafter For public API change.

@AlekseyTs
Copy link
Contributor Author

@dotnet/roslyn-compiler Please review

/// Specifies whether to import members with accessibility other than public or protected by default.
/// Default value is <see cref="MetadataImportOptions.Public"/>. The value specified is not going to
/// affect correctness of analysis performed by compilers because all members needed for correctness
/// are going to be imported regadless. This setting can force compilation to import members that it
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

regadless [](start = 37, length = 9)

Typo s/regadless/regardless/

Copy link
Member

@jcouv jcouv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@AlekseyTs AlekseyTs merged commit 172ceaf into dotnet:dev15.7.x Jan 26, 2018
@jcouv jcouv added this to the 15.7 milestone Feb 2, 2018
AlekseyTs added a commit that referenced this pull request Feb 27, 2018
…nd add validation for the specified value. (#25046)

This is a follow-up for #24468
@ghost
Copy link

ghost commented Jul 31, 2018

I am fairly certain this does not work with VBCSCompiler.exe, which compiles C# projects. I am creating a Roslyn Diagnostic Analyzer, below is a snippet of the relevant code.

 public override void Initialize(AnalysisContext context)
 {
           context.RegisterCompilationStartAction(SetMetadataImportOptions);
 }

private void SetMetadataImportOptions(CompilationStartAnalysisContext obj)
{
          obj.Compilation.Options.WithMetadataImportOptions(MetadataImportOptions.All);
}

When I debug the process I can see the MetadataImportOptions value does not change when SetMetadataImportOptions is called. When I use reflection to set the MetadataImportOptions, everything works. Is this behavior expected?

I am running Visual Studio 2017 version 15.7.5 and Microsoft.CodeAnalysis.CSharp.Workspaces version 2.8.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Compilers Concept-API This issue involves adding, removing, clarification, or modification of an API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants