Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReadArchitecture() fails on .NET Core assembly #337

Closed
sbomer opened this Issue Feb 24, 2017 · 3 comments

Comments

Projects
None yet
2 participants
@sbomer
Copy link
Contributor

sbomer commented Feb 24, 2017

This looks similar to 329.

I get this stacktrace:

Unhandled Exception: System.NotSupportedException: Specified method is not supported.
   at Mono.Cecil.PE.ImageReader.ReadArchitecture()
   at Mono.Cecil.PE.ImageReader.ReadImage()
   at Mono.Cecil.PE.ImageReader.ReadImage(Disposable`1 stream, String file_name)
   at Mono.Cecil.ModuleDefinition.ReadModule(String fileName, ReaderParameters parameters)
   at ceciltest.Program.Main(String[] args)

Repro steps

ceciltest.tar.gz
dotnet restore
dotnet run

Other info
This version of System.Runtime.dll came from /home/sven/bin/shared/Microsoft.NETCore.App/1.1.1/System.Runtime.dll.

dotnet cli version info:

sven@sven-ubuntu-16:~/ceciltest$ dotnet --info
.NET Command Line Tools (1.0.0-rc4-004842)

Product Information:
 Version:            1.0.0-rc4-004842
 Commit SHA-1 hash:  7238b3efa2

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  16.04
 OS Platform: Linux
 RID:         ubuntu.16.04-x64
 Base Path:   /home/sven/bin/sdk/1.0.0-rc4-004842

@jbevain

This comment has been minimized.

Copy link
Owner

jbevain commented Feb 24, 2017

@sbomer we need to find out why on earth this PE file has 0xfd1d for architecture.

It's not a documented constant for IMAGE_FILE_HEADER.Machine, which could trip other tools.

@jbevain

This comment has been minimized.

Copy link
Owner

jbevain commented Feb 24, 2017

Well I guess this explains it:

https://github.com/dotnet/coreclr/blob/6f7aa7967c607b8c667518314ab937c0d7547025/src/inc/pedecoder.h#L94-L107

0xfd1d is IMAGE_FILE_MACHINE_ARM64 ^IMAGE_FILE_MACHINE_NATIVE_OS_OVERRIDE

Where IMAGE_FILE_MACHINE_NATIVE_OS_OVERRIDE is defined for Linux.

@jbevain jbevain closed this in bb40c21 Feb 24, 2017

jbevain added a commit that referenced this issue Feb 24, 2017

Merge pull request #338 from jbevain/fix-readarch
Fix ReadArchitecture, fix #337
@sbomer

This comment has been minimized.

Copy link
Contributor Author

sbomer commented Feb 25, 2017

Wow, thanks for the fast response and fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.