You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 25, 2026. It is now read-only.
Repository navigation
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
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.
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.
Activity
MichalStrehovsky commentedon Aug 3, 2020
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.