0xd4d / dnlib

Reads and writes .NET assemblies and modules
MIT License
2.14k stars 583 forks source link

Consider adding a net6.0 as an additional target framework #514

Closed ElektroKill closed 1 year ago

ElektroKill commented 1 year ago

The new versions of .NET offer additional API's which can be used by Roslyn when compiling C# code to generate more performant code. One of the most notable changes for codegen is the use of string-builder-like on stack structs for string interpolation instead of the classic concatenation calls or format calls.

Adding net6.0 as a TFM would allow Roslyn to apply these optimizations when compiling for that target. dnlib consumers could then benefit from improved string performance when using dnlib.

Note: I have no ran any benchmarks and the performance improvements are theoretical.

ElektroKill commented 1 year ago

If this is green-lighted, I can contribute this change.

wtfsck commented 1 year ago

Sure. I just checked the csproj file and we have this, does it also need to be updated?

  <ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
    <PackageReference Include="System.Reflection.Emit" Version="4.7.0" />
    <PackageReference Include="System.Reflection.Emit.Lightweight" Version="4.7.0" />
  </ItemGroup>