Code Monkey home page Code Monkey logo

internalsvisiblefromroslyn's Introduction

[InternalsVisibleFrom("Roslyn.dll")]

[InternalsVisibleFrom("Roslyn.dll")] is tool which injects [InternalsVisibleTo("xxx")] into Roslyns dlls and creates NuGet packages.

Why is injecting InternalsVisibleTo needed?

Every good library developer is trying to never break public API for backward compatibility(specially when your library is used by thousands Visual Studio plugins or NuGet Diagnostic Analyzers). Which means when Roslyn team decides to expose some type/method to public they must spend a lot of time to think if that type/method makes sense, if they can improve it, thread safety of API... This takes a lot of time and since VisualStudio 2015 has year in name(VS14 didn't :)) they don't have time atm to work on exposing all API needed for IDEs to work with Roslyn. So they cheat by using [InternalsVisibleTo("VisualStudio.dlls")]. Also keeping things that Plugins or Analyzers don't need and only VisualStudio uses makes a lot of sense because it gives VS and Roslyn team ability to change API for VS need without thinking of other library users. Problem is that this methods are essential for other tools/IDEs like OmniSharp or MonoDevelop. Developers of this tools are totally OK with API breakage(we don't live in GAC age anymore, we are in NuGet age).

Roslyn team told us we should tell them what APIs we need/use so they make them pulic so they can prioritise opening that API. Which makes sense, but in age of IDEs where we learn about API via code completion it's super hard to know what they should open if you don't it's there, yes I can go look in Roslyn code but that takes a lot of time and also time between request and API becoming public in code can be very long. In this period reflection can be used... If I was OK with using reflection I wouldn't develop in C# but in JavaScript...

How it works

Very simple really... Mostly it just opens roslyn dlls with Cecil and adds InternalsVisibleTo attribute and there is some logic to create NuGet packages. See Program.cs which explains better :)

internalsvisiblefromroslyn's People

Contributors

stirno avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

stirno

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.