Skip to content

Add SemanticModel.WithoutAccessChecks() #378

@gafter

Description

@gafter

From: Omer Raviv
Sent: Thursday, November 6, 2014 12:43 PM
Subject: RE: Roslyn issues

Hey Guys,

Thanks a lot for your help, Kevin.

Of the two issues, 1# is the most crucial to us and the one we just can't ship without, so we’d really appreciate any possible help you could give us!

If I understand correctly, what we're asking for here amount to:

  1. Add a public API on SemanticModel to request a new SemanticModel that ignores accessibility checks, something like SemanticModel.WithSuppressAccessibilityChecks.
  2. Change every line of code where a Binder is created with BindingOptions.SemanticModel (9 places by my count), so that it also includes BindingFlags.SuppressAccessibilityChecks if that's what the SemanticModel specifies.
  3. Change the line in Binder.IsSymbolAccessibleConditional that says throw ExceptionUtilities.Unreachable; to say return true;

I'm sure there are many API design considerations here that I'm not aware of, but this is really all we're asking. Without this, we can’t get out of Roslyn the behavior that OzCode inherently depends on, and we’re kind of stuck.

Thanks a lot!

  • Omer

From: Tomas Matousek
Sent: Thursday, November 6, 2014 09:45 PM
Subject: RE: Roslyn issues

I think we need the same features for our EEs and to support interactive.

Re #1: The current implementation of EEs heavily depends on internals of the compiler. I’d like us to use less internal APIs and more public APIs that customers like CodeValue, Xamarin and others could leverage as well.
Re #2: To support interactive we are going to need a metadata reference whose internals are imported. Seems like exactly what Pavel is asking for.

Not sure when this work will be done. We are currently stretched thin.

Tomas


From: Kevin Pilch-Bisson
Sent: Thursday, November 6, 2014 11:36 AM
Subject: RE: Roslyn issues

Hey Guys,

Chuck/Tomas – OzCode is a VS extension that adds a bunch of functionality to the debugging experience. They are looking at moving over to using Roslyn, but there are a couple of issues blocking them at the moment. I’m wondering if you have ideas for workarounds, or thoughts about how we do these things in our own EEs.

  1.   Avoiding access checks so that they can use `SemanticModel` to look at private/internal data at debug time.  They tried changing the implementation of `IsSymbolAccessibleConditional` to just return `true`, and that works for them, but they don’t want to fork Roslyn and build their own compilation models just to get this working.
    
  2.   They’d like to import internal metadata, but `CompilationOptions.WithMetadataImportOptions` is internal.  Even if it wasn’t, they would need some way to tell VS to use that, so that they could re-use our compilations.
    

Any ideas?

Kevin Pilch-Bisson
http://twitter.com/Pilchie

[issue ported from TFS DevDiv 1078951]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions