ILSpy icon indicating copy to clipboard operation
ILSpy copied to clipboard

Show architecture name in DLL containing unmanaged code for ReadToRun targeting Linux

Open sudoudaisuke opened this issue 1 year ago • 2 comments

Is your feature request related to a problem? Please describe. Publish the dll for linux-x64 ReadyToRun.

<PropertyGroup>
    <PublishReadyToRun>true</PublishReadyToRun>
    <RuntimeIdentifier>linux-x64</RuntimeIdentifier>
</PropertyGroup>

And display the dll header in ILSpy 9.0.0.7833-preview3.

// /tmp/sample.dll
// sample, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
// Global type: <Module>
// Entry point: Program.<Main>$
// Architecture: 64797
// This assembly contains unmanaged code.
// Runtime: v4.0.30319
// Hash algorithm: SHA1
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(/*Could not decode attribute arguments.*/)]
[assembly: TargetFramework(".NETCoreApp,Version=v8.0", FrameworkDisplayName = ".NET 8.0")]

"Architecture: 64797 (0xFD1D)" means Linux X64 binary. So please show detailed description instead of numbers.

Additional context

  • https://github.com/icsharpcode/ILSpy/blob/9986104c3f80626529a8ccfb1569a37e86f50950/ILSpy/Languages/Language.cs#L545-L570
  • https://github.com/dotnet/runtime/issues/36364
  • https://github.com/dotnet/runtime/blob/1e3544ec04e27538f3d38d274f7a65277f0d681f/src/coreclr/inc/pedecoder.h#L96-L111

sudoudaisuke avatar Nov 20 '24 01:11 sudoudaisuke

This doesn't look like logic inside the R2R plugin.

cshung avatar Feb 25 '25 17:02 cshung

@cshung thanks for pointing this out... I just tried to create an R2R image from ICSharpCode.Decompiler.dll using the following command-line (after reading this guide: https://learn.microsoft.com/en-us/dotnet/core/deploying/ready-to-run):

dotnet publish ICSharpCode.Decompiler\ICSharpCode.Decompiler.csproj --runtime win-x64 -p:PublishReadyToRun=true

and then load "\ICSharpCode.Decompiler\bin\Debug\netstandard2.0\win-x64\publish\ICSharpCode.Decompiler.dll" in ILSpy...

no matter, which RID I use.... ILSpy always shows "; The file is not a ReadyToRun image"... I am a bit puzzled by this... if R2R is not supported I would expect the dotnet publish command to fail and provide an error message.

@sudoudaisuke to make it easier for me to look into this problem, may I ask you to provide an example binary; thank you very much!

siegfriedpammer avatar Mar 02 '25 23:03 siegfriedpammer