Skip to content
This repository was archived by the owner on Sep 25, 2026. It is now read-only.
This repository was archived by the owner on Sep 25, 2026. It is now read-only.

This change in Reflection is going to kill a lot of projects #1402

Closed

Description

@SuperJMN

Having read this:
https://github.com/mono/linker/blob/master/docs/design/reflection-flow.md

I have the confirmation that some open source projects aren't going to endure the hit of this breaking change.

For instance, I've talked with some authors and told me it's a huge roadblock. One of them is the author of an awesome DI IoC container, and I guess the same issue will apply to many others.

Some projects that rely heavily in Reflection will have a hard time doing their stuff with this change.

Beware, the OSS community isn't happy with changes like this and a lot of projects will die.

This is just an invitation to rethink and reconsider it. There are more apps that rely on reflection / dynamic code than you think.

Activity

  1. MichalStrehovsky commented on Aug 3, 2020

    @MichalStrehovsky
    Member

    I have the confirmation that some open source projects aren't going to endure the hit of this breaking change.

    We're not going to do a breaking change to the ecosystem. Quoting from the document linked above: "In .NET 5, we would like to carve out a subset of reflection patterns that can be made compatible in the presence of ILLink. Since linking is optional, users do not have to adhere to this subset. They can still use ILLink if they do not adhere to this subset, but we will not provide guarantees that linking won't change the semantics of their app. Linker will warn if a reflection pattern within the app is not compatible."

    Linking is an extra step that has to be opted into (it's off by default). If a library is not compatible, the linker will issue warnings and user will have to either turn the linker back off, or switch it to a conservative mode.

    Reflection was never safe in the presence of linking. IL Linker that shipped in .NET Core 3.0 only had a super conservative mode that didn't touch user code at all and only removed unused .NET framework code. It didn't trim much as a result, and still had a small chance of breaking apps.

    We're aware that the annotations added in .NET 5 only enable a subset of reflection scenarios. It's not possible to make arbitrary reflection work with trimming. Other frameworks with the kind of unrestricted reflection as in .NET struggle with this too (e.g. trimming in Java).

    There will be a new mode of IL Linker based on these annotations that enables a lot more trimming at the expense of restricting the reflection patterns available to trimmed apps.

    I hope that clears things up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions