Switching .Decompiler from netstandard2.0 to net8.0?
We are currently discussing switching the decompilation engine away from netstandard2.0 to latest net8.0 (for the next major version to be released sometime mid of next year, 2024 that is).
@CyrusNajmabadi @sharwell @dibarbet @jaredpar could you please tag anyone on Roslyn / VS Debugger interested for their opinion / guidance?
With libraries it's usually been my experience that you want to be maximally compatible.
Why all the way to latest major and not... say netstandard2.1 or net6.0 to give a little leeway to users?
Going past net8.0 seems a little premature.
In any case, we're currently using 7.2.x with net6.0, so not being forced to change that is obviously in my best interest :P
The reason for suggesting net80 is that given we are shooting for mid 2024, net60 would be almost at support end by then (see https://dotnet.microsoft.com/en-us/platform/support/policy). Edit: ILSpy 9.0 will be net80 irrespective of this topic.
We're interested, though this would likely force us to have to do decompilation outside of visual studio (which is netfx only). I'm actually fully ok with us doing that, but it would still take a bit of effort on our part.
Do you have any perf wins here that woudl help motivate us costing this into our plans? Thanks!
Note: i cannot speak for debugger. Someone there would have to weigh in on if this would be feasible for them, or if it would be a blocker. @tmat Do you have any thoughts on who could look into that side?
cc @andrewcrawley for the debugger
I would prefer to see it multi-targeted, with both netstandard2.0 and net6.0/net8.0 targets. Otherwise, it could result in a significant performance penalty for users who disable multi-process execution in Visual Studio for performance reasons.
@christophwille What benefits did you have in mind moving to net8.0? Just the general goodness of a newer library or was something specifically blocked?
The reason for suggesting net80 is that given we are shooting for mid 2024, net60 would be almost at support end by then (see https://dotnet.microsoft.com/en-us/platform/support/policy). Edit: ILSpy 9.0 will be net80 irrespective of this topic.
Sure, but targeting an older framework doesn't (usually) prevent your users from running it on a newer framework, unless there are specific APIs that you can't target in the older framework.
If there are specific APIs that you want to take advantage of, I would have the library target the first release those APIs were available in.
Targeting a runtime for an application (i.e. ILSpy itself) is a far different calculus IMHO.
From the VS Debugger's perspective, we would strongly prefer that the decompiler engine maintain a netstandard2.0 target in addition to any targets that might be added. As others have noted, VS is netfx only, and it would be a huge amount of work to refactor the debugger to run the decompiler in a separate process.
What benefits did you have in mind moving to net8.0? Just the general goodness of a newer library or was something specifically blocked?
@jasonmalinowski There's nothing that's really a blocker, but you already mentioned it, yes, we'd like to move forward so that we can get access to newer APIs that make things easier.
Some things that come to mind:
- Some language features require polyfills (
System.Index/System.Range/ NRTs) - Some language features require runtime support (static interface members)
- Working with
(ReadOnly)Span<T>is just painful, because of missing APIs on core types - Lots of little functions that make things easier or grant access to hardware intrinsics (recent example:
BitOperations.TrailingZeroCount())
The replies so far however show that those are rather minor wins far outweighed by the need of the decompiler to be used in older .NET versions.
Well, it is settled then that the papercuts will have to keep accruing until major downstream consumers can move away from netfw4x.
Well, it is settled then that the papercuts will have to keep accruing until major downstream consumers can move away from netfw4x.
You could start using #ifdef and use newer functionality (i.e. the hardware intrinsics mentioned earlier) along side the current implementations and multi-target (then in the future you can stop multi-targetting and remove the older code and #ifdefs. This will allow users on newer frameworks to get the benefits without leaving netfx users out in the cold.
Multi-targeting will only make our lives more complicated, it is easier for us to stick with one target, and that will continue to be netstandard2.0.
Multi-targeting will only make our lives more complicated, it is easier for us to stick with one target, and that will continue to be netstandard2.0.
@christophwille I would advice to still look into adding one other newer .NET versions as a secondary target. Even if you make zero changes to the code-base, targeting a newer version of .NET can allow the compiler to optimize some pieces of code better (especially when it comes to string interpolation and similar) and improve performance significantly enough. Consumers of the library that target these newer frameworks anyway will then fully benefit from this as well.